* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #c0392b; --primary-dark: #a93226; --primary-light: #fadbd8;
  --primary-soft: #e74c3c; --primary-gradient: linear-gradient(135deg, #c0392b, #e74c3c);
  --secondary: #5a7a9a; --secondary-light: #d4e6f1;
  --success: #27ae60; --success-light: #d5f5e3;
  --warning: #f39c12; --warning-light: #fdebd0;
  --danger: #c0392b; --danger-light: #fadbd8;
  --info: #2980b9; --info-light: #d6eaf8;
  --bg: #f0f4f8; --bg-alt: #e8edf3;
  --white: #ffffff; --off-white: #fafbfc;
  --text: #2c3e50; --text-soft: #5d6d7e; --text-muted: #95a5a6;
  --border: #e2e8f0; --border-soft: #eef2f7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06); --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08); --shadow-xl: 0 12px 48px rgba(0,0,0,0.1);
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 24px;
  --header-height: 60px; --font-sm: 12px; --font-base: 14px; --font-lg: 18px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --card-bg: #ffffff; --hover-bg: #f1f5f9; --thead-bg: #eef2f7;
}
html { overflow-x: hidden; width: 100%; -webkit-font-smoothing: antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Tahoma', sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden; width: 100%; direction: rtl;
}

/* ====== DARK MODE ====== */
body.dark-mode {
  --bg: #0d1117; --bg-alt: #161b22; --white: #161b22; --off-white: #0d1117;
  --text: #e6edf3; --text-soft: #8b949e; --text-muted: #6e7681;
  --border: #30363d; --border-soft: #21262d;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3); --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --card-bg: #161b22; --hover-bg: #1c2128; --thead-bg: #21262d;
  --primary-light: #3d1a1a; --secondary-light: #1a2a3d;
  --success-light: #1a3a2a; --warning-light: #3a2a1a;
  --danger-light: #3d1a1a; --info-light: #1a2a3d;
}
body.dark-mode .login-box { background: rgba(22,27,34,0.95); }
body.dark-mode .login-box .form-control { background: #0d1117; border-color: #30363d; color: #e6edf3; }
body.dark-mode .login-error { background: #3d1a1a; border-color: #c0392b; }
body.dark-mode .brand-text { color: #e74c3c; }
body.dark-mode .sub-icon-label { color: #8b949e; }
body.dark-mode .sub-icon-card { background: var(--card-bg); }
body.dark-mode .main-icon-card { background: var(--card-bg); }
body.dark-mode .main-icon-label { color: #e6edf3; }
body.dark-mode .gov-card { background: var(--card-bg); }
body.dark-mode .gov-name { color: #e6edf3; }
body.dark-mode .gov-count { color: #8b949e; }
body.dark-mode .hosp-card { background: var(--card-bg); }
body.dark-mode .data-table thead th { background: var(--thead-bg); color: #e6edf3; }
body.dark-mode .data-table th, body.dark-mode .data-table td { border-color: var(--border); }
body.dark-mode .data-table .gov-even { background: #161b22; }
body.dark-mode .data-table .gov-odd { background: #0d1117; }
body.dark-mode .page-title { color: #e6edf3; }
body.dark-mode .btn-outline { border-color: var(--border); color: #8b949e; }
body.dark-mode .btn-outline:hover { background: var(--hover-bg); color: #e6edf3; }
body.dark-mode .menu-card { background: var(--card-bg); }
body.dark-mode .card { background: var(--card-bg); }
body.dark-mode .card-header { background: var(--bg-alt); color: #e6edf3; border-color: var(--border); }
body.dark-mode .card-header i { color: #e74c3c; }
body.dark-mode .header { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .dashboard-bar .db-stat { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .db-stat-number { color: #e6edf3; }
body.dark-mode .form-control { background: #0d1117; border-color: var(--border); color: #e6edf3; }
body.dark-mode .search-input { background: #0d1117; border-color: var(--border); color: #e6edf3; }
body.dark-mode .modal { background: var(--card-bg); }
body.dark-mode .modal-header { border-color: var(--border); }
body.dark-mode .modal-footer { border-color: var(--border); }
body.dark-mode .sub-nav { background: var(--card-bg); }
body.dark-mode .sub-nav-item:hover { background: var(--hover-bg); color: #e6edf3; }
body.dark-mode .user-badge { background: var(--bg-alt); color: #8b949e; }
body.dark-mode .date-display { color: #8b949e; }
body.dark-mode .app-footer { background: var(--card-bg); border-color: var(--border); }
body.dark-mode ::-webkit-scrollbar-track { background: #0d1117; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #30363d; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #484f58; }
body.dark-mode .stat-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .stat-card .stat-value { color: #e6edf3; }
body.dark-mode .stat-card .stat-label { color: #8b949e; }
body.dark-mode .main-icon-tip { background: #1c2128; }
body.dark-mode .main-icon-tip::after { border-top-color: #1c2128; }
body.dark-mode .stock-table thead th { background: #1c2128; color: #e6edf3; }
body.dark-mode .stock-table thead tr:nth-child(3) th { background: #21262d; color: #8b949e; }
body.dark-mode .stock-table td { border-color: var(--border); }
body.dark-mode .stock-table .total-cell { background: #1c1a10; color: #d4a017; }
body.dark-mode .stock-table .hosp-cell { color: #e6edf3; }
body.dark-mode .stock-table .gov-cell { background: #1c2128; }
body.dark-mode .stock-table .stock-row.row-late { background: #1c1010; }
body.dark-mode .stock-table .stock-row.row-late:hover { background: #2a1515 !important; }
body.dark-mode .stock-table tbody tr:hover { background: #1c2128 !important; }
body.dark-mode .clock-display { background: #1c2128; color: #58a6ff; }
body.dark-mode .perm-cat-body { background: #0d1117; }
body.dark-mode .perm-card { background: #161b22; border-color: var(--border); }
body.dark-mode .perm-card-label { color: #e6edf3; }
body.dark-mode .ind-form-box.input-box { background: #161b22; border-color: var(--border); }
body.dark-mode .ind-form-box.formula-box { background: #1a2a1a; border-color: #2a4a2a; }
body.dark-mode .ind-form-header.input-header { background: linear-gradient(135deg, #1c2128, #21262d); }
body.dark-mode .ind-form-header.formula-header { background: linear-gradient(135deg, #0a2a1a, #1a4a2a); }
body.dark-mode .ind-form-field { background: #0d1117; border-color: var(--border); }
body.dark-mode .ind-form-field.formula-field { background: #1a2a1a; border-color: #2a4a2a; }
body.dark-mode .ind-form-label { color: #8b949e; }
body.dark-mode .ind-form-input { background: #0d1117; border-color: var(--border); color: #e6edf3; }
body.dark-mode .ind-form-input.formula-val { background: #1a2a1a; border-color: #2a4a2a; color: #7ee787; }
body.dark-mode .ind-form-sub { background: #161b22; border-color: var(--border); }
body.dark-mode .ind-form-sub-header { background: #1c2128; color: #8b949e; border-color: var(--border); }
body.dark-mode .ind-form-box.formula-box .ind-form-sub-header { background: #1a3a1a; color: #7ee787; border-color: #2a4a2a; }
body.dark-mode .ind-table thead { position: sticky; top: 0; z-index: 10; }
body.dark-mode .ind-table .grp1 th { background: #1c2128; color: #e6edf3; }
body.dark-mode .ind-table .grp2 th { background: #21262d; color: #8b949e; }
body.dark-mode .ind-table .grp3 th { background: #21262d; color: #8b949e; }
body.dark-mode .ind-table tbody tr:nth-child(even) td { background: #161b22; }
body.dark-mode .ind-table tbody tr:hover td { background: rgba(255,255,255,0.03) !important; }
body.dark-mode .ind-table td { background: var(--card-bg); }
body.dark-mode .ind-table .gov-col { color: #e6edf3; }
body.dark-mode .ind-table .hosp-col { color: #58a6ff; }
body.dark-mode .ind-table tbody tr:nth-child(even) .gov-col { background: #161b22; }
body.dark-mode .strategic-table thead th { background: #1c2128; border-color: var(--border); }
body.dark-mode .strategic-table thead tr:first-child th { background: #21262d; }
body.dark-mode .strategic-table thead tr:nth-child(2) th { background: #161b22; }
body.dark-mode .strategic-table .row-light td { background: #161b22; }
body.dark-mode .strategic-table .row-dark td { background: #0d1117; }
body.dark-mode .strategic-table .gov-cell { background: #1c2128; }
body.dark-mode .strategic-table th, body.dark-mode .strategic-table td { border-color: var(--border); }
body.dark-mode .strategic-table .label-str { background: #1a3a2a; color: #7ee787; }
body.dark-mode .strategic-table .cell-str { background: #1a3a2a; color: #7ee787; }
body.dark-mode .strategic-table .cell-under { background: #3a2a1a; color: #ffb74d; }
body.dark-mode .data-table .avail-cell { background: #1a3a2a; color: #7ee787; }
body.dark-mode .data-table .total-cell { background: #1c1a10; color: #d4a017; }
body.dark-mode .data-table .agg-row { background: #2a1a1a; }
body.dark-mode .report-table td { border-color: var(--border); }
body.dark-mode .report-table .data-row.gov-light td { background: #161b22; }
body.dark-mode .report-table .data-row.gov-dark td { background: #0d1117; }
body.dark-mode .report-table .data-row.gov-light .sticky-col, body.dark-mode .report-table .data-row.gov-light .sticky-col2 { background: #161b22; }
body.dark-mode .report-table .data-row.gov-dark .sticky-col, body.dark-mode .report-table .data-row.gov-dark .sticky-col2 { background: #0d1117; }
body.dark-mode .report-table .avail-total { background: #1a2a3d !important; }
body.dark-mode .report-table .incoming-total { background: #1c1a10 !important; }
body.dark-mode .report-table .outgoing-total { background: #3d1a1a !important; }
body.dark-mode .report-table .disposal-total { background: #3d1010 !important; }
body.dark-mode .report-table .avail-cell { background: #1a3a2a !important; color: #7ee787; }
body.dark-mode .report-table .total-cell { background: #1c1a10 !important; }
body.dark-mode .stmt-table thead tr th { background: #1c2128; border-color: var(--border); }
body.dark-mode .stmt-table thead tr:first-child th { background: #21262d; }
body.dark-mode .stmt-table thead tr:nth-child(2) th { background: #161b22; }
body.dark-mode .stmt-table thead tr:nth-child(3) th { background: #161b22; }
body.dark-mode .stmt-table thead tr:nth-child(4) th { background: #1c2128; }
body.dark-mode .stmt-table th, body.dark-mode .stmt-table td { border-color: var(--border); }
body.dark-mode .stmt-table .stmt-label { background: #161b22 !important; }
body.dark-mode .stmt-table .avail-row td { background: #1a3a2a !important; }
body.dark-mode #totalTable thead th { background: #1c2128; border-bottom-color: var(--border); }
body.dark-mode #totalTable thead tr:first-child th { background: #21262d; }
body.dark-mode #totalTable thead tr:first-child th:nth-child(3), body.dark-mode #totalTable thead tr:first-child th:nth-child(4) { background: #1a2a3d; }
body.dark-mode #totalTable thead tr:nth-child(2) th { background: #161b22; }
body.dark-mode #totalTable thead tr:nth-child(3) th { background: #1c2128; color: #8b949e; }
body.dark-mode #totalTable td { border-color: var(--border); }
body.dark-mode #totalTable .avail-cell { background: #1a3a2a; color: #7ee787; }
body.dark-mode #totalTable .total-cell { background: #1c1a10; }
body.dark-mode #totalTable .gov-cell { background: #1c2128 !important; }
body.dark-mode #totalTable .gov-even { background: #1c2128 !important; }
body.dark-mode #totalTable .gov-odd { background: #161b22 !important; }
body.dark-mode #totalTable .data-row.gov-light td { background: #161b22; }
body.dark-mode #totalTable .data-row.gov-dark td { background: #0d1117; }
body.dark-mode #totalTable .hosp-name { color: #e6edf3; }
body.dark-mode .consumption-table tbody tr:hover { background: #3d1a1a; }
body.dark-mode .stock-summary-cards .stat-card { background: #161b22; border-color: var(--border); }
body.dark-mode .stock-summary-cards .stat-card .stat-value { color: #e6edf3; }
body.dark-mode .stock-summary-cards .stat-card .stat-label { color: #8b949e; }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #e8edf3; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #c0c8d0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aab4; }

/* ====== ANIMATIONS ====== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes modalIn { from { transform: scale(0.96) translateY(8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ====== LOGIN PAGE (defined at end of file) ====== */

/* ====== APP LAYOUT ====== */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.header {
  padding: 0 20px; height: var(--header-height); display: flex; align-items: center;
  justify-content: space-between; background: var(--white);
  border-bottom: 2px solid var(--primary);
  box-shadow: 0 2px 12px rgba(192,57,43,0.06);
  position: sticky; top: 0; z-index: 100;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.header-left { display: flex; align-items: center; gap: 8px; }
.header-brand { font-size: 18px; font-weight: 800; color: var(--primary); }
.header-sep { color: var(--border); margin: 0 2px; }
.user-badge { font-size: 13px; color: var(--text-muted); background: var(--bg); padding: 4px 14px; border-radius: 20px; white-space: nowrap; }
.date-display { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.clock-display { display: inline-block; font-size: 14px; font-weight: 700; color: var(--text-soft); background: var(--bg); padding: 3px 10px; border-radius: 8px; margin: 0 4px; direction: ltr; font-family: 'Courier New', monospace; letter-spacing: 1px; }
.header-icon-btn { width: 36px; height: 36px; border-radius: 10px; border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: transparent; color: var(--text-muted); transition: all var(--transition); font-size: 16px; }
.header-icon-btn:hover { background: var(--hover-bg); color: var(--text); }
.logout-btn { color: var(--danger) !important; }
.logout-btn:hover { background: rgba(220,53,69,0.12) !important; color: #c82333 !important; }
.content { padding: 20px; min-height: calc(100vh - var(--header-height) - 50px); max-width: 100%; }
.page-card { background: var(--card-bg); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 20px; border: 1px solid var(--border-soft); }
.page-card-header { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.page-card-header i { font-size: 18px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; padding: 12px 16px; background: var(--bg); border-radius: 10px; }
.filter-bar select, .filter-bar input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; transition: border-color var(--transition); }
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }
.app-footer { text-align: center; padding: 14px 20px; font-size: 13px; color: var(--primary); border-top: 2px solid var(--primary); background: var(--white); font-weight: 600; }

/* ====== PAGE CONTAINER ====== */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }

/* ====== CARDS ====== */
.card { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); margin-bottom: 16px; border: 1px solid var(--border-soft); overflow: hidden; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--text); background: var(--bg); }
.card-header h3 { font-size: 14px; }
.card-header i { color: var(--primary); }
.card-body { padding: 18px; }

/* ====== DASHBOARD STATS BAR ====== */
#dashboardBar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
  margin-bottom: 24px; animation: slideDown 0.3s ease;
}
.db-stat {
  background: var(--white); border-radius: 14px; padding: 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft);
  transition: all var(--transition); cursor: default;
}
.db-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.db-stat-icon {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: #fff; flex-shrink: 0;
}
.db-stat-info { display: flex; flex-direction: column; }
.db-stat-number { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.db-stat-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.db-stat-icon-red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.db-stat-icon-blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.db-stat-icon-green { background: linear-gradient(135deg, #27ae60, #1e8449); }
.db-stat-icon-orange { background: linear-gradient(135deg, #f39c12, #e67e22); }
.db-stat-icon-purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.db-stat-icon-teal { background: linear-gradient(135deg, #1abc9c, #16a085); }
.db-stat-icon-pink { background: linear-gradient(135deg, #e91e63, #c2185b); }

/* ====== PROFILE ====== */
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--primary-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem; box-shadow: 0 6px 20px rgba(192,57,43,0.25);
}

/* ====== STATS GRID ====== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--white); padding: 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--border-soft);
  transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card i { font-size: 28px; color: var(--primary); background: var(--primary-light); padding: 12px; border-radius: 10px; }
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ====== SUB-ICON GRID ====== */
.sub-icons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; max-width: 560px; margin: 30px auto; }
.sub-icon-card { background: var(--white); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 24px 14px; text-align: center; cursor: pointer; transition: all var(--transition); border: 2px solid transparent; position: relative; overflow: hidden; }
.sub-icon-card:hover { transform: translateY(-4px) scale(1.02); border-color: var(--primary); box-shadow: var(--shadow-md); }
.sub-icon-circle { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; box-shadow: 0 6px 18px rgba(0,0,0,0.15); transition: all var(--transition); overflow: hidden; }
.sub-icon-circle i { font-size: 26px; color: #fff; }
.sub-icon-card:hover .sub-icon-circle { transform: scale(1.08); }
.sub-icon-label { font-size: 13px; font-weight: 600; color: var(--text-soft); }

/* ====== GOVERNORATE GRID ====== */
.gov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.gov-card { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 20px 14px; text-align: center; cursor: pointer; transition: all var(--transition); border: 2px solid transparent; }
.gov-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.gov-icon { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.gov-icon i { font-size: 26px; color: #fff; }
.gov-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.gov-count { font-size: 11px; color: var(--text-muted); }

/* ====== MAIN ICONS (DASHBOARD) ====== */
.main-icons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px; max-width: 750px; margin: 50px auto; }
.main-icon-card { background: var(--white); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 36px 14px 26px; text-align: center; cursor: pointer; transition: all var(--transition); border: 2px solid transparent; position: relative; overflow: hidden; }
.main-icon-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: var(--primary); transform: scaleX(0); transition: transform var(--transition); }
.main-icon-card:hover { transform: translateY(-6px) scale(1.02); border-color: var(--primary); box-shadow: var(--shadow-lg); }
.main-icon-card:hover::after { transform: scaleX(1); }
.main-icon-circle { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); transition: all var(--transition); overflow: hidden; }
.main-icon-card:hover .main-icon-circle { transform: scale(1.08); }
.main-icon-circle i { font-size: 34px; color: #fff; }
.main-icon-label { font-size: 17px; font-weight: 700; color: var(--text-soft); letter-spacing: -0.3px; }
.main-icon-tip {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  background: #2c3e50; color: #fff; font-size: 10px; padding: 8px 12px;
  border-radius: 8px; opacity: 0; pointer-events: none;
  transition: all 0.25s; z-index: 10; direction: rtl;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2); line-height: 1.8; min-width: 110px;
}
.main-icon-tip .tip-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 11px; }
.main-icon-tip .tip-item i { width: 14px; text-align: center; font-size: 10px; opacity: 0.8; }
.main-icon-tip::after {
  content: ''; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 6px solid #2c3e50;
}
.main-icon-card:hover .main-icon-tip { opacity: 1; top: -8px; }
.page-title { font-size: 18px; font-weight: 800; padding: 8px 0 8px 12px; margin-bottom: 8px; border-right: 4px solid var(--primary); background: linear-gradient(to left, transparent, var(--primary-light)); color: var(--text); display: flex; align-items: center; gap: 8px; }
.page-title i { font-size: 20px; }

/* ====== HOSPITAL GRID ====== */
.hosp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.hosp-card { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 18px 14px; text-align: center; cursor: pointer; transition: all var(--transition); border: 2px solid transparent; }
.hosp-card:hover { transform: translateY(-2px); border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.hosp-icon { width: 50px; height: 50px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.hosp-icon i { font-size: 22px; color: var(--primary); }
.hosp-name { font-size: 13px; font-weight: 600; }

/* ====== BLOOD GRID ====== */
.blood-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.blood-item { text-align: center; padding: 14px 8px; border-radius: 10px; background: var(--bg); border: 2px solid transparent; transition: border-color var(--transition); }
.blood-item .type { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.blood-item .qty { font-size: 22px; font-weight: 800; }
.blood-item .label { font-size: 11px; color: var(--text-muted); }
.blood-item.low { border-color: var(--danger); } .blood-item.low .qty { color: var(--danger); }
.blood-item.medium { border-color: var(--warning); } .blood-item.medium .qty { color: var(--warning); }
.blood-item.good { border-color: var(--success); } .blood-item.good .qty { color: var(--success); }

/* ====== TABLE ====== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; touch-action: pan-x pan-y pinch-zoom; }
table { width: 100%; border-collapse: collapse; }
table th { text-align: right; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
table tbody tr:hover { background: var(--bg); }
table tr:last-child td { border-bottom: none; }

/* ====== BUTTONS ====== */
.btn { padding: 10px 20px; border: none; border-radius: 10px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: all var(--transition); font-weight: 600; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary-gradient); color: #fff; } .btn-primary:hover { box-shadow: 0 4px 16px rgba(192,57,43,0.3); }
.btn-secondary { background: var(--secondary); color: #fff; } .btn-secondary:hover { box-shadow: 0 4px 12px rgba(90,122,154,0.3); }
.btn-success { background: var(--success); color: #fff; } .btn-success:hover { box-shadow: 0 4px 12px rgba(39,174,96,0.3); }
.btn-danger { background: var(--danger); color: #fff; } .btn-danger:hover { box-shadow: 0 4px 12px rgba(192,57,43,0.3); }
.btn-warning { background: var(--warning); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 11px; border-radius: 8px; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text-soft); } .btn-outline:hover { background: var(--hover-bg); }
.btn-back { background: var(--primary-gradient); color: #fff; border: none; padding: 8px 20px; border-radius: 25px; font-size: 14px; font-weight: 700; cursor: pointer; transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px; }
.btn-back:hover { transform: scale(1.03); box-shadow: 0 4px 16px rgba(192,57,43,0.3); }

/* ====== PAGE ACTIONS ====== */
.page-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.page-actions-left { margin-right: auto; display: flex; gap: 8px; }
.search-input { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; min-width: 180px; transition: border-color var(--transition); }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }
.search-input-wrap { display: flex; align-items: center; }

/* ====== BADGE ====== */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-pending { background: var(--warning-light); color: #856404; }
.badge-approved { background: var(--success-light); color: #155724; }
.badge-rejected { background: var(--danger-light); color: #721c24; }
.badge-info { background: var(--info-light); color: #004085; }

/* ====== FORM ====== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--text-soft); }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; transition: all var(--transition); background: var(--off-white); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }
select.form-control { appearance: auto; }
textarea.form-control { min-height: 80px; resize: vertical; }

/* ====== MODAL ====== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--white); border-radius: var(--radius-lg); width: 100%; max-width: 550px; max-height: 90vh; overflow-y: auto; animation: modalIn 0.25s; box-shadow: var(--shadow-xl); }
@keyframes modalIn { from { transform: scale(0.96) translateY(8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 0 4px; transition: color var(--transition); }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ====== EMPTY ====== */
.empty-msg { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 14px; }
.empty-msg i { font-size: 36px; display: block; margin-bottom: 12px; color: var(--border); }

/* ====== MENU GRID ====== */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; max-width: 700px; margin: 40px auto; }
.menu-card { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 24px 14px; text-align: center; cursor: pointer; transition: all var(--transition); border: 2px solid transparent; }
.menu-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.menu-card i { font-size: 28px; color: var(--primary); background: var(--primary-light); padding: 14px; border-radius: 12px; margin-bottom: 10px; }
.menu-card span { display: block; font-size: 13px; font-weight: 600; margin-top: 6px; }

/* ====== DATA TABLE ====== */
.data-table { border-collapse: collapse; font-size: 11px; width: 100%; }
.data-table th, .data-table td { padding: 5px 7px; border: 1px solid var(--border); text-align: center; white-space: nowrap; }
.data-table thead th { background: var(--thead-bg); font-weight: 700; font-size: 10px; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table .gov-cell { background: var(--secondary); color: #fff; font-weight: 700; font-size: 12px; vertical-align: middle; }
.data-table .gov-even { background: var(--white); }
.data-table .gov-odd { background: var(--bg); }
.data-table .avail-cell { background: var(--success-light); font-weight: 600; color: #1e8449; }
.data-table .editable { cursor: pointer; }
.data-table .editable:hover { outline: 1px solid var(--secondary); outline-offset: -1px; }
.data-table .total-cell { font-weight: 700; background: var(--warning-light); }
.data-table .agg-row { background: #fff5f5; outline: 2px solid var(--secondary); outline-offset: -1px; }
.data-table .blood-header { background: #c0392b !important; color: #fff; }
.data-table .plasma-header { background: #27ae60 !important; color: #fff; }
.data-table .total-header { background: #ffc107 !important; color: #000; }
.data-table thead tr:first-child th { font-size: 11px; background: linear-gradient(135deg, var(--secondary), #6a8aaa) !important; color: #fff; }
.data-table thead tr:nth-child(2) th { font-size: 10px; }
.data-table thead tr:nth-child(3) th { font-size: 9px; padding: 4px 6px; font-weight: 700; color: #333; border-top: 2px solid #666; }
#dailyStockTable { min-width: 5500px; }

/* ====== SUB-NAV ====== */
.sub-nav { display: flex; gap: 4px; margin-bottom: 16px; background: var(--white); padding: 6px; border-radius: 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); }
.sub-nav-item { padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-muted); background: none; border: none; transition: all var(--transition); white-space: nowrap; }
.sub-nav-item:hover { background: var(--bg); color: var(--text); }
.sub-nav-item.active { background: var(--primary-gradient); color: #fff; }
.sub-page { display: none; }
.sub-page.active { display: block; animation: fadeIn 0.2s ease; }

/* ====== REPORT TABLE ====== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.report-table-wrap { overflow-x: auto; max-width: 100%; }
.report-table { border-collapse: collapse; font-size: 9px; width: 100%; }
.report-table th, .report-table td { border: 1px solid var(--border); padding: 3px 4px; text-align: center; white-space: nowrap; }
.report-table thead th { background: var(--thead-bg); font-weight: 600; position: sticky; top: 0; z-index: 2; }
.report-table .hl1 th { background: #e9ecef; font-size: 10px; }
.report-table .hl2 th { background: #f1f3f5; font-size: 9px; }
.report-table .hl3 th { background: #f8f9fa; font-size: 8px; padding: 1px 2px; }
.report-table .gov-cell { color: #fff; font-weight: 700; font-size: 10px; vertical-align: middle; text-align: center; min-width: 60px; }
.report-table .gov-even { background: var(--secondary) !important; }
.report-table .gov-odd { background: #6a8aaa !important; }
.report-table .data-row.gov-light td { background: var(--white); }
.report-table .data-row.gov-dark td { background: var(--bg); }
.report-table .data-row .sticky-col, .report-table .data-row .sticky-col2 { position: sticky; z-index: 1; }
.report-table .data-row.gov-light .sticky-col, .report-table .data-row.gov-light .sticky-col2 { background: var(--white); }
.report-table .data-row.gov-dark .sticky-col, .report-table .data-row.gov-dark .sticky-col2 { background: var(--bg); }
.report-table .avail-cell { background: var(--success-light) !important; font-weight: 600; }
.report-table .sticky-col { right: 0; border-left: 2px solid var(--border); min-width: 75px; text-align: right; padding-right: 10px; }
.report-table .sticky-col2 { right: 75px; border-left: 2px solid var(--border); min-width: 65px; }
.report-table .time-cell { color: var(--text-muted); }
.report-table .total-cell { font-weight: 700; background: var(--warning-light) !important; }
.report-table .total-col { font-weight: 700; }
.report-table .incoming-total { background: var(--warning-light) !important; }
.report-table .outgoing-total { background: var(--danger-light) !important; }
.report-table .disposal-total { background: #f5c6cb !important; }
.report-table .avail-total { background: var(--info-light) !important; }
.report-table td.editable { cursor: pointer; position: relative; }
.report-table td.editable:hover { outline: 1px solid var(--secondary); outline-offset: -1px; z-index: 1; }
.report-table .inline-input { width: 100%; border: none; background: transparent; text-align: center; font-size: 9px; padding: 0; margin: 0; outline: 2px solid var(--secondary); }

/* ====== REPORT FORM ====== */
.report-form-row { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.report-form-label { min-width: 35px; font-weight: 700; font-size: 13px; }
.report-form-field { display: flex; flex-direction: column; align-items: center; }
.report-form-field label { font-size: 9px; color: var(--text-muted); margin-bottom: 1px; }
.report-form-field input { width: 55px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 11px; text-align: center; }

/* ====== STOCK TABLE ====== */
.stock-table { border-collapse: collapse; font-size: 10px; width: 100%; min-width: 4800px; }
.stock-table th, .stock-table td { padding: 3px 5px; border: 1px solid var(--border); text-align: center; white-space: nowrap; }
.stock-table thead th { position: sticky; top: 0; z-index: 3; background: linear-gradient(135deg, var(--secondary), #4a6a8a); color: #fff; font-weight: 700; font-size: 9px; padding: 4px 5px; }
.stock-table thead tr:nth-child(2) th { font-size: 8px; padding: 2px 3px; }
.stock-table thead tr:nth-child(3) th { font-size: 8px; padding: 2px 3px; background: var(--thead-bg); color: var(--text-soft); border-top: 2px solid var(--secondary); }
.stock-table .blood-header { background: #c0392b !important; }
.stock-table .plasma-header { background: #27ae60 !important; }
.stock-table .th-blood { font-size: 10px !important; font-weight: 800 !important; }
.stock-table .th-plasma { font-size: 10px !important; font-weight: 800 !important; }
.stock-table .th-total { font-size: 9px !important; }
.stock-table .btotal-header { background: linear-gradient(135deg, #f39c12, #e67e22) !important; color: #fff !important; }
.stock-table .ptotal-header { background: linear-gradient(135deg, #16a085, #1abc9c) !important; color: #fff !important; }
.stock-table .th-meta { background: var(--secondary) !important; color: #fff !important; }
.stock-table tbody tr { transition: background 0.15s; }
.stock-table tbody tr:hover { background: var(--bg) !important; }
.stock-table .stock-row.row-late { background: #fff5f5; }
.stock-table .stock-row.row-late:hover { background: #ffe0e0 !important; }
.stock-table .gov-cell { background: var(--secondary); padding: 6px !important; vertical-align: middle; }
.stock-table .gov-badge { background: rgba(255,255,255,0.2); color: #fff; font-weight: 700; font-size: 12px; padding: 6px 10px; border-radius: 8px; display: inline-block; }
.stock-table .hosp-cell { font-weight: 600; color: var(--text); min-width: 80px; }
.stock-table .avail-cell { font-weight: 700; }
.stock-table .total-cell { font-weight: 700; background: var(--warning-light); color: #7d6608; }
.stock-table .total-avail { color: #1e8449; font-size: 12px; }
.stock-table .editable { cursor: pointer; transition: background 0.15s; }
.stock-table .editable:hover { outline: 2px solid var(--info); outline-offset: -1px; }
.stock-table .cell-late { color: var(--danger) !important; font-weight: 700 !important; }
.stock-table .cell-ok { color: var(--success); font-weight: 600; }
.stock-table .time-cell { color: var(--text-muted); font-size: 9px; }

/* ====== STOCK SUMMARY CARDS ====== */
.stock-summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stock-summary-cards .stat-card { display: flex; align-items: center; gap: 14px; background: var(--white); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); transition: all var(--transition); }
.stock-summary-cards .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stock-summary-cards .stat-card .stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.stock-summary-cards .stat-card-blood .stat-icon { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stock-summary-cards .stat-card-plasma .stat-icon { background: linear-gradient(135deg, #27ae60, #1e8449); }
.stock-summary-cards .stat-card-plat .stat-icon { background: linear-gradient(135deg, #f39c12, #e67e22); }
.stock-summary-cards .stat-card-hosp .stat-icon { background: linear-gradient(135deg, #3498db, #2980b9); }
.stock-summary-cards .stat-card .stat-info { display: flex; flex-direction: column; }
.stock-summary-cards .stat-card .stat-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stock-summary-cards .stat-card .stat-label { font-size: 11px; color: var(--text-muted); }

/* ====== STOCK MANG STICKY HEADER ====== */
#dailyStockWrap { max-height: 70vh; overflow-y: auto; overflow-x: auto; }
#dailyStockTable { border-collapse: separate; border-spacing: 0; }
#dailyStockTable thead { position: sticky; top: 0; z-index: 10; }
#dailyStockTable thead tr:nth-child(1) th { position: sticky; top: 0; z-index: 11; background: var(--secondary); color: #fff; }
#dailyStockTable thead tr:nth-child(2) th { position: sticky; top: 28px; z-index: 10; background: #4a6a8a; color: #fff; }
#dailyStockTable thead tr:nth-child(3) th { position: sticky; top: 56px; z-index: 10; background: #3b5998; color: #fff; }

/* ====== STATEMENT TABLE ====== */
.stmt-table { border-collapse: collapse; width: 100%; font-size: 11px; margin-top: 10px; }
.stmt-table th, .stmt-table td { border: 1px solid #666; padding: 5px 7px; text-align: center; }
.stmt-table thead th { background: #4472C4; color: #fff; font-weight: 700; font-size: 10px; }
.stmt-table thead tr th { background: #4472C4; color: #fff; font-weight: 700; }
.stmt-table thead tr:first-child th { font-size: 11px; }
.stmt-table thead tr:nth-child(2) th { background: #5B9BD5; font-size: 10px; }
.stmt-table thead tr:nth-child(3) th { background: #7FBAE0; font-size: 9px; border-top: 2px solid #fff; }
.stmt-table thead tr:nth-child(4) th { background: #A0CAEB; font-size: 9px; }
.stmt-table .total-cell { font-weight: 700; background: var(--warning-light) !important; }
.stmt-table .avail-row td { background: var(--success-light) !important; font-weight: 600; }
.stmt-table .stmt-label { font-weight: 700; text-align: right; min-width: 80px; background: var(--thead-bg) !important; font-size: 10px; }
.stmt-header { margin-bottom: 10px; font-size: 12px; line-height: 1.8; }
.stmt-header div { margin-bottom: 3px; }
.stmt-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.plat-editable, .cryo-editable { cursor: pointer; }
.plat-editable:hover, .cryo-editable:hover { outline: 2px solid var(--secondary); outline-offset: -2px; }
.plat-editable[contenteditable="true"], .cryo-editable[contenteditable="true"] { outline: 2px solid var(--secondary); background: var(--white); }

/* ====== BRANCH STATEMENT ====== */
.branch-stmt-report { max-width: 1000px; margin: 0 auto; }
.branch-stmt-report .stmt-table th, .branch-stmt-report .stmt-table td { font-size: 12px; padding: 7px 10px; }
.branch-stmt-report .stmt-table thead tr th { font-size: 11px; }
.branch-stmt-report .stmt-table thead tr:nth-child(2) th { font-size: 11px; background: #5B9BD5; font-weight: 700; }
.branch-stmt-report .deriv-label { font-weight: 700; color: var(--primary); font-size: 11px; }
.branch-stmt-report .avail-row td { font-weight: 700; background: var(--success-light); }
.branch-stmt-report .stmt-table td:last-child,
.branch-stmt-report .stmt-table td:nth-last-child(2) { direction: ltr; font-family: 'Consolas', monospace; font-size: 11px; white-space: nowrap; }

/* ====== TOTAL TABLE ====== */
#totalTable { min-width: 1800px; font-size: 11px; border-collapse: collapse; }
#totalTable th, #totalTable td { padding: 4px 6px; border: 1px solid var(--border); white-space: nowrap; text-align: center; }
#totalTable thead th { background: var(--thead-bg); font-weight: 700; font-size: 10px; border-bottom: 2px solid #aaa; }
#totalTable thead tr:first-child th { font-size: 11px; }
#totalTable thead tr:first-child th:nth-child(3),
#totalTable thead tr:first-child th:nth-child(4) { font-size: 12px; font-weight: 700; background: #d4e6f1; }
#totalTable thead tr:nth-child(2) th { font-size: 10px; }
#totalTable thead tr:nth-child(3) th { font-size: 9px; font-weight: 700; color: #333; border-top: 2px solid #aaa; }
#totalTable .blood-header { background: #c0392b !important; color: #fff; }
#totalTable .plasma-header { background: #27ae60 !important; color: #fff; }
#totalTable .total-header { background: #ffc107 !important; color: #000; }
#totalTable .avail-cell { background: var(--success-light); font-weight: 600; color: #1e8449; }
#totalTable .total-cell { font-weight: 700; background: var(--warning-light); }
#totalTable .gov-cell { color: #fff; font-weight: 700; font-size: 13px; vertical-align: middle; width: 50px; min-width: 50px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 2px; }
#totalTable .gov-even { background: var(--secondary) !important; }
#totalTable .gov-odd { background: #6a8aaa !important; }
#totalTable .hosp-name { font-size: 12px; min-width: 100px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 6px; }
#totalTable .data-row.gov-light td { background: var(--white); }
#totalTable .data-row.gov-dark td { background: var(--bg); }
#totalTable .time-cell { font-size: 13px; font-weight: 700; color: #8B4513; direction: ltr; letter-spacing: 1px; }
#totalTable .date-cell { font-size: 13px; font-weight: 700; color: var(--text); direction: ltr; }
#totalTable td { font-size: 11px; padding: 4px 3px; }
#totalTable th { font-size: 10px; padding: 3px 2px; }

/* ====== CONSUMPTION TABLE ====== */
.consumption-table { min-width: 800px; }
.consumption-table th:first-child, .consumption-table th:nth-child(2) { min-width: 100px; text-align: right; }
.consumption-table th:nth-child(3) { min-width: 70px; }
.consumption-table th:not(:first-child):not(:nth-child(2)):not(:nth-child(3)) { min-width: 40px; }
.consumption-table th:last-child { min-width: 50px; }
.consumption-table tbody tr:hover { background: var(--danger-light); }

/* ====== STRATEGIC TABLE ====== */
.strategic-table { border-collapse: collapse; font-size: 11px; width: 100%; min-width: 900px; }
.strategic-table th, .strategic-table td { padding: 6px 8px; border: 1px solid var(--border); text-align: center; white-space: nowrap; }
.strategic-table thead th { background: #1b5e20; color: #fff; font-weight: 700; font-size: 11px; border-color: #145214; }
.strategic-table thead tr:first-child th { font-size: 12px; background: #2e7d32; }
.strategic-table thead tr:nth-child(2) th { font-size: 10px; background: #388e3c; }
.strategic-table .gov-cell { background: #e0e0e0; color: #000; font-weight: 700; font-size: 12px; vertical-align: middle; min-width: 55px; }
.strategic-table .row-light td { background: #fafafa; }
.strategic-table .row-dark td { background: #f0f0f0; }
.strategic-table .row-light td:first-child, .strategic-table .row-dark td:first-child { border-left: 2px solid #bbb; }
.strategic-table .label-cur { background: #eceff1; color: #37474f; text-align: center; font-weight: 600; font-size: 11px; }
.strategic-table .label-str { background: var(--success-light); color: #1b5e20; text-align: center; font-weight: 700; font-size: 11px; }
.strategic-table .label-avail { background: var(--warning-light); color: #555; text-align: center; font-weight: 600; font-size: 11px; }
.strategic-table .cell-cur { text-align: center; font-size: 11px; }
.strategic-table .cell-str { background: var(--success-light); text-align: center; font-weight: 600; color: #1b5e20; }
.strategic-table .cell-under { background: var(--warning-light); font-weight: 700; color: #e65100; text-align: center; font-size: 12px; vertical-align: middle; }
.strategic-table .totals-row td { background: #f5f5f5; font-weight: 600; }
.strategic-table .totals-row th { background: #f5f5f5; }
.strategic-table .totals-title { font-size: 13px; color: #333; font-weight: 700; text-align: right; }
.strategic-table .totals-val { font-weight: 700; }
.strategic-table .label-cur-tot { background: #e0e0e0; text-align: center; font-weight: 600; }
.strategic-table .label-str-tot { background: #c8e6c9; color: #1b5e20; text-align: center; font-weight: 700; }
.strategic-table .label-avail-tot { background: var(--warning-light); color: #555; text-align: center; font-weight: 600; }
.strategic-table .cell-str-tot { background: #c8e6c9; font-weight: 700; color: #1b5e20; }
.strategic-table .grand-row td { background: var(--success-light); font-weight: 600; }
.strategic-table .grand-row th { background: var(--success-light); }
.strategic-table .grand-title { font-size: 13px; color: #1b5e20; font-weight: 700; text-align: right; }
.strategic-table .grand-val { font-weight: 700; color: #1b5e20; }
.strategic-table .label-cur-grand { background: #c8e6c9; text-align: center; font-weight: 600; }
.strategic-table .label-str-grand { background: #a5d6a7; color: #1b5e20; text-align: center; font-weight: 700; }
.strategic-table .label-avail-grand { background: var(--warning-light); color: #555; text-align: center; font-weight: 600; }
.strategic-table .grand-str-val { background: #a5d6a7; font-weight: 700; color: #1b5e20; }

/* ====== MODAL WIDE ====== */
#modalOverlay .modal:has(.report-form-row) { max-width: 750px; }
#modalOverlay .modal:has(#euPerms) { max-width: 700px; }

/* ====== PERMISSION UI ====== */
.perm-cat { margin-bottom: 16px; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.perm-cat-header { padding: 10px 14px; font-size: 13px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.perm-cat-body { padding: 10px 12px; background: var(--off-white); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.perm-card { background: var(--white); border-radius: 8px; padding: 8px 10px; border: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.perm-card:hover { border-color: var(--border); }
.perm-card-label { font-size: 12px; font-weight: 600; color: var(--text); }
.perm-actions { display: flex; gap: 6px; }
.perm-toggle { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; font-size: 10px; color: #888; user-select: none; }
.perm-toggle input { display: none; }
.perm-toggle .toggle-track { width: 28px; height: 14px; background: #ddd; border-radius: 7px; position: relative; transition: 0.2s; }
.perm-toggle .toggle-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; background: #fff; border-radius: 50%; transition: 0.2s; }
.perm-toggle input:checked + .toggle-track { background: var(--success); }
.perm-toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.perm-toggle.active .toggle-label { color: var(--success); font-weight: 700; }
.perm-toggle.active-view .toggle-label { color: var(--info); font-weight: 700; }
.perm-toggle.active-add .toggle-label { color: var(--success); font-weight: 700; }
.perm-toggle.active-edit .toggle-label { color: var(--warning); font-weight: 700; }
.perm-toggle.active-delete .toggle-label { color: var(--danger); font-weight: 700; }
.perm-toggle.active-export .toggle-label { color: #6f42c1; font-weight: 700; }
.perm-card.perm-all { border-right: 4px solid var(--success); }
.perm-card.perm-none { border-right: 4px solid var(--danger); }

/* ====== INDICATORS TABLE ====== */
.ind-table { font-size: 12px; border-collapse: separate; border-spacing: 0; min-width: 1600px; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,0.04); }
.ind-table th, .ind-table td { border: 1px solid var(--border); padding: 5px 7px; text-align: center; white-space: nowrap; transition: background 0.15s; }
.ind-table thead { position: sticky; top: 0; z-index: 10; }
.ind-table .grp1 th { position: sticky; top: 0; z-index: 11; font-weight: 700; font-size: 9px; color: #fff; letter-spacing: 0.3px; }
.ind-table .grp2 th { position: sticky; top: 28px; z-index: 10; font-weight: 600; font-size: 9px; color: #fff; }
.ind-table .grp3 th { background: var(--thead-bg); font-size: 7px; color: var(--text-soft); font-weight: 600; padding: 3px 6px; }
.ind-table .grp-detail { font-size: 8px; font-weight: 600; color: var(--text-soft); }
.ind-table tbody tr { transition: background 0.15s; }
.ind-table tbody tr:hover { background: rgba(0,0,0,0.02); }
.ind-table tbody tr:nth-child(even) td { background: var(--off-white); }
.ind-table td { background: var(--white); }
.ind-table .gov-col { font-weight: 700; color: var(--text); min-width: 60px; text-align: right; font-size: 11px; }
.ind-table .hosp-col { font-weight: 600; min-width: 100px; text-align: right; }
.ind-table .editable-cell { position: relative; font-weight: 500; }
.ind-table .editable-cell:focus-within { z-index: 5; }
.ind-table tr td:first-child, .ind-table tr td:nth-child(2) { text-align: right; padding-right: 10px; }
.ind-table .grp1 th[data-group="التجميع"], .ind-table .grp2 th[data-sg="جمع"] { background: linear-gradient(135deg, #6A90B8, #8AB0D0); }
.ind-table .grp1 th[data-group="إجمالي الوارد"] { background: linear-gradient(135deg, #5A8A5A, #7AAA7A); }
.ind-table .grp1 th[data-group="إجمالي المنصرف"] { background: linear-gradient(135deg, #C8A050, #DCB870); }
.ind-table .grp1 th[data-group="نسب"] { background: linear-gradient(135deg, #5A9090, #7AB0B0); }
.ind-table .grp1 th[data-group="الفصائل والتوافق"], .ind-table .grp1 th[data-group="عينات غير مفحوصه"] { background: linear-gradient(135deg, #8A7AA8, #A494C0); }
.ind-table .grp1 th[data-group="فيروسات"] { background: linear-gradient(135deg, #B08080, #C89A9A); }
.ind-table .grp1 th[data-group="إنتهاء الصلاحيه"] { background: linear-gradient(135deg, #C89060, #D8A880); }
.ind-table .grp1 th[data-group="مرتجع"] { background: linear-gradient(135deg, #A07078, #B89098); }
.ind-table .grp1 th[data-group="تفاعل"] { background: linear-gradient(135deg, #9A7090, #B490A8); }
.ind-table .grp1 th[data-group="نظام مفتوح"] { background: linear-gradient(135deg, #7A8288, #949CA2); }
.ind-table .grp1 th[data-group="أخري"], .ind-table .grp1 th[data-group="أخرى"] { background: linear-gradient(135deg, #7A8288, #949CA2); }
.ind-table .grp1 th[data-group="تاريخ الإرسال"], .ind-table .grp1 th[data-group="تاريخ التحديث"] { background: linear-gradient(135deg, #7A8A94, #94A4AE); }
.ind-table .grp1 th[data-group="تحليل نسب المؤشرات"] { background: linear-gradient(135deg, #8A7AA8, #A494C0); }
.ind-table .grp2 th { background: linear-gradient(135deg, #8DB0D0, #A8C8E0); font-size: 8px; }
.ind-table .grp1 th[data-group*="الوارد"] { background: linear-gradient(135deg, #5A8A5A, #7AAA7A) !important; }
.ind-table .grp1 th[data-group*="المنصرف"] { background: linear-gradient(135deg, #C8A050, #DCB870) !important; }
.ind-table .grp1 th[data-group*="التجميع"] { background: linear-gradient(135deg, #6A90B8, #8AB0D0) !important; }
.ind-table .grp2 th[data-sg="جمع"] { background: linear-gradient(135deg, #6A90B8, #8AB0D0) !important; }
.ind-table .grp1 th[data-group*="فيروس"] { background: linear-gradient(135deg, #B08080, #C89A9A) !important; }
.ind-table .grp1 th[data-group*="الصلاحيه"] { background: linear-gradient(135deg, #C89060, #D8A880) !important; }
.ind-table .grp1 th[data-group*="مرتجع"] { background: linear-gradient(135deg, #A07078, #B89098) !important; }
.ind-table .grp1 th[data-group*="تفاعل"] { background: linear-gradient(135deg, #9A7090, #B490A8) !important; }
.ind-table .grp1 th[data-group*="مفتوح"] { background: linear-gradient(135deg, #7A8288, #949CA2) !important; }
.ind-table .grp1 th[data-group*="أخرى"], .ind-table .grp1 th[data-group*="أخري"] { background: linear-gradient(135deg, #7A8288, #949CA2) !important; }
.ind-table .grp1 th[data-group*="نسب"] { background: linear-gradient(135deg, #5A9090, #7AB0B0) !important; }
.ind-table .grp1 th[data-group*="عينات"] { background: linear-gradient(135deg, #8A7AA8, #A494C0) !important; }
.ind-table .grp2 th[data-sg="دم"] { background: linear-gradient(135deg, #5A8A5A, #7AAA7A) !important; }
.ind-table .grp2 th[data-sg="صفائح"] { background: linear-gradient(135deg, #C8A050, #DCB870) !important; }
.ind-table .grp2 th[data-sg="انتهاء الصلاحيه"] { background: linear-gradient(135deg, #C89060, #D8A880) !important; }
.ind-table .grp2 th[data-sg="وارد الدم"] { background: linear-gradient(135deg, #5A9090, #7AB0B0) !important; }
.ind-table .grp2 th[data-sg="اعدامات الدم"] { background: linear-gradient(135deg, #A07078, #B89098) !important; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-track { background: var(--bg); border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c0c8d0; border-radius: 3px; }
.agg-row td { outline: 2px solid var(--secondary); outline-offset: -1px; background: var(--bg) !important; }
.ind-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ind-form-grid .form-group { margin: 0; }
.ind-form-grid .form-group label { font-size: 11px; }

/* ====== INDICATOR FORM ====== */
.ind-form-wrap { display: flex; flex-wrap: wrap; gap: 12px; }
.ind-form-box { flex: 1; min-width: 220px; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.04); transition: box-shadow var(--transition); }
.ind-form-box:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.ind-form-box.input-box { border: 1px solid var(--border); background: var(--off-white); }
.ind-form-box.formula-box { border: 1px solid #b7e4c7; background: #f0fff4; }
.ind-form-header { padding: 6px 10px; font-size: 12px; font-weight: 700; color: #fff; text-align: center; letter-spacing: 0.2px; }
.ind-form-header.input-header { background: linear-gradient(135deg, var(--secondary), #4a6a8a); }
.ind-form-header.formula-header { background: linear-gradient(135deg, #1b7a3d, #28a745); }
.ind-form-body { padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.ind-form-sub { flex: 1; min-width: 110px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--white); }
.ind-form-sub.formula-sub { border-color: #c8e6c9; }
.ind-form-sub-header { padding: 3px 8px; font-size: 10px; font-weight: 600; color: var(--text-soft); text-align: center; background: var(--thead-bg); border-bottom: 1px solid var(--border); }
.ind-form-box.formula-box .ind-form-sub-header { background: #c8e6c9; color: #1b5e20; border-color: #a5d6a7; }
.ind-form-sub-body { padding: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.ind-form-field { flex: 1; min-width: 60px; text-align: center; background: var(--white); border: 1px solid var(--border-soft); border-radius: 4px; padding: 3px 4px; transition: border-color 0.15s; }
.ind-form-field.formula-field { border-color: #c8e6c9; background: #fafffa; }
.ind-form-field:hover { border-color: #bbb; }
.bg-success-light { background: var(--success-light) !important; }
.bg-danger-light { background: var(--danger-light) !important; }
.bg-missing { background: var(--warning-light) !important; }
.ind-form-label { font-size: 9px; color: var(--text-muted); margin-bottom: 2px; white-space: nowrap; }
.ind-form-label .target-badge { color: var(--success); font-weight: 600; font-size: 8px; }
.ind-form-input { width: 100%; height: 28px; font-size: 11px; text-align: center; border: 1px solid var(--border); border-radius: 4px; padding: 2px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; background: var(--white); }
.ind-form-input:focus { border-color: var(--secondary); box-shadow: 0 0 0 2px rgba(90,122,154,0.12); }
.ind-form-input.formula-val { background: var(--success-light); border-color: #a5d6a7; font-weight: 600; color: #1b5e20; cursor: default; }

/* ====== DONOR MANAGEMENT ====== */
.blood-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; color: #fff; font-weight: 700; font-size: 10px; }
.screening-badge { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.screening-badge.eligible { background: var(--success-light); color: #1e8449; }
.screening-badge.perm { background: var(--danger-light); color: #c62828; }
.screening-badge.temp { background: var(--warning-light); color: #e65100; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; vertical-align: middle; margin-left: 4px; }
.status-dot.completed { background: #1e8449; }
.status-dot.testing { background: #1565c0; }
.status-dot.deferred { background: #e65100; }
.status-dot.sample_pending { background: #888; }

/* ====== PRINT ====== */
@media print {
  .header, .app-footer, .btn, .page-actions, #dashboardBar, .modal-overlay,
  .filter-bar, .sub-nav, .dashboard-bar, [id^="rdnForm"], .btn-back,
  .card-header a, .card-header button, .page-actions button,
  .eq-pivot thead tr:last-child { display: none !important; }
  .card { box-shadow: none; border: none; margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .report-table { min-width: auto; font-size: 8px; }
  .report-table th, .report-table td { padding: 2px 3px; }
  #totalTable { min-width: auto; font-size: 9px; }
  #totalTable .avail-cell, #totalTable .total-cell, #totalTable .gov-cell,
  .report-table .avail-cell, .report-table .total-cell, .report-table .incoming-total,
  .report-table .outgoing-total, .report-table .disposal-total, .report-table .avail-total,
  .stmt-table .total-cell, .stmt-table .avail-row td,
  .data-table .avail-cell, .data-table .total-cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .eq-pivot, .ind-table, .data-table, .consumption-table, .strategic-table, .stock-table { font-size: 8px; min-width: auto !important; }
  .eq-pivot th, .ind-table th, .data-table th, .eq-pivot td, .ind-table td, .data-table td { padding: 2px 3px !important; }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .header { padding: 0 10px; }
  .header-left .date-display { display: none; }
  .content { padding: 12px; }
  .card-body { padding: 12px; }
  .sub-icons-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .main-icons-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 100%; margin: 20px auto; padding: 0 4px; }
  .main-icon-card { padding: 24px 8px 18px; }
  .main-icon-circle { width: 56px; height: 56px; }
  .main-icon-circle i { font-size: 26px; }
  .main-icon-label { font-size: 14px; }
  .page-actions { flex-direction: column; }
  .search-input { width: 100%; min-width: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card i { font-size: 22px; padding: 10px; }
  .stat-number { font-size: 20px; }
  .gov-grid { grid-template-columns: repeat(2, 1fr); }
  .hosp-grid { grid-template-columns: repeat(2, 1fr); }
  .blood-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .blood-item { padding: 8px 2px; }
  .blood-item .type { font-size: 12px; }
  .blood-item .qty { font-size: 15px; }
  .filter-bar { flex-direction: column; }
  .sub-nav { overflow-x: auto; flex-wrap: nowrap; padding: 4px; gap: 2px; }
  .sub-nav-item { padding: 7px 10px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
  .modal { width: 95%; margin: 10px; max-height: 95vh; }
  #dashboardBar { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .db-stat { padding: 10px 8px; gap: 8px; }
  .db-stat-icon { width: 32px; height: 32px; font-size: 14px; }
  .db-stat-number { font-size: 16px; }
  .db-stat-label { font-size: 9px; }
  .data-table { font-size: 9px; }
  .data-table th, .data-table td { padding: 3px 4px; }
  .ind-table { font-size: 9px; min-width: 1000px; }
  .ind-table th, .ind-table td { padding: 3px 4px; }
  .ind-table .grp1 th { font-size: 8px; }
  .ind-table .grp2 th { font-size: 7px; }
  .ind-table .gov-col { min-width: 40px; font-size: 9px; }
  .ind-table .hosp-col { min-width: 70px; font-size: 9px; }
  .btn { padding: 10px 16px; min-height: 44px; }
  .btn-sm { padding: 7px 10px; min-height: 36px; }
  .form-control { min-height: 44px; font-size: 14px; }
  .login-box { padding: 28px 20px; }
  .login-logo { width: 64px; height: 64px; }
  .stock-table { min-width: 3000px; font-size: 9px; }
  .stock-table th, .stock-table td { padding: 2px 3px; }
  .strategic-table { min-width: 550px; font-size: 9px; }
  .strategic-table th, .strategic-table td { padding: 3px 4px; }
  .card-header { padding: 10px 12px; flex-wrap: wrap; gap: 6px; }
  .card-header h3 { font-size: 12px; }
  .page-title { font-size: 15px; }
  #dailyStockTable { min-width: 2500px; }
  #totalTable { min-width: 1000px; font-size: 9px; }
  #totalTable .gov-cell { min-width: 30px; max-width: 50px; font-size: 10px; }
  #totalTable .hosp-name { font-size: 9px; min-width: 60px; max-width: 100px; }
  .perm-cat-body { grid-template-columns: 1fr; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); margin: 20px auto; gap: 10px; }
  .stmt-table { font-size: 8px; }
  .stmt-table td, .stmt-table th { padding: 2px 3px; }
  .stmt-table .stmt-label { min-width: 50px; font-size: 8px; }
  .stmt-title { font-size: 16px; }
  .report-table { font-size: 7px; }
  .report-table td, .report-table th { padding: 1px 2px; }
  .report-table .sticky-col { min-width: 50px; }
  .report-table .sticky-col2 { min-width: 40px; right: 50px; }
  .branch-stmt-report .stmt-table th, .branch-stmt-report .stmt-table td { font-size: 8px; padding: 3px 4px; }
  .consumption-table { min-width: 500px; }
  .empty-msg { padding: 20px; }
  .app-footer { padding: 10px; font-size: 11px; }
}

@media (max-width: 600px) {
  .header { padding: 0 6px; }
  .header-logo { width: 28px; height: 28px; margin-left: 4px; }
  .header-brand { font-size: 15px; }
  .credit-text { display: none; }
  .header-right { gap: 4px; }
  .header-left { gap: 4px; }
  .user-badge { font-size: 11px; padding: 2px 6px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .date-display { display: none; }
  .clock-display { font-size: 12px; padding: 2px 6px; }
  .header-icon-btn { font-size: 14px; width: 32px; height: 32px; }
  .content { padding: 8px; }
  .main-icons-grid { gap: 8px; margin: 12px auto; }
  .main-icon-card { padding: 16px 4px 12px; }
  .main-icon-circle { width: 46px; height: 46px; }
  .main-icon-circle i { font-size: 20px; }
  .main-icon-label { font-size: 12px; }
  .sub-icons-grid { gap: 8px; }
  .sub-icon-circle { width: 44px; height: 44px; }
  .sub-icon-card { padding: 14px 6px; }
  .sub-icon-label { font-size: 11px; }
  #dashboardBar { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .db-stat { padding: 8px 6px; gap: 6px; }
  .db-stat-icon { width: 28px; height: 28px; font-size: 12px; }
  .db-stat-number { font-size: 14px; }
  .db-stat-label { font-size: 8px; }
  .stats-grid { gap: 6px; }
  .stat-card { padding: 10px; }
  .stat-card i { font-size: 18px; padding: 8px; }
  .stat-number { font-size: 17px; }
  .stat-label { font-size: 10px; }
  .gov-grid { gap: 8px; }
  .gov-card { padding: 14px 8px; }
  .gov-icon { width: 48px; height: 48px; }
  .gov-icon i { font-size: 20px; }
  .hosp-grid { gap: 8px; }
  .hosp-card { padding: 12px 8px; }
  .modal { width: 98%; margin: 5px; }
  .modal-header { padding: 12px 14px; }
  .modal-body { padding: 14px; }
  .modal-footer { padding: 12px 14px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }
  .page-title { font-size: 14px; }
}

@media (max-width: 420px) {
  .header { padding: 0 4px; }
  .header-logo { width: 24px; height: 24px; margin-left: 2px; }
  .header-brand { font-size: 13px; }
  .user-badge { font-size: 10px; max-width: 80px; padding: 2px 4px; }
  .clock-display { display: none; }
  .main-icon-grid { gap: 6px; }
  .main-icon-card { padding: 12px 4px 10px; }
  .main-icon-circle { width: 38px; height: 38px; }
  .main-icon-circle i { font-size: 16px; }
  .main-icon-label { font-size: 11px; }
  .card-header { padding: 8px 10px; }
  .card-body { padding: 6px; }
  .btn { font-size: 12px; padding: 8px 12px; min-height: 36px; }
  .btn-sm { font-size: 10px; padding: 6px 8px; min-height: 30px; }
  .form-control { font-size: 13px; min-height: 38px; }
  .sub-nav-item { padding: 6px 8px; font-size: 10px; }
  .login-box { padding: 20px 14px; }
  .login-box h1 { font-size: 22px; }
  .login-logo { width: 56px; height: 56px; }
  .content { padding: 4px; }
  .page-title { font-size: 13px; padding: 4px 0 4px 8px; }
  .table-wrapper { margin: 0 -4px; }
  .empty-msg { padding: 12px; font-size: 11px; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .header { padding: 0 12px; }
  .main-icons-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 100%; }
  .sub-icons-grid { grid-template-columns: repeat(3, 1fr); width: 100%; }
  .gov-grid { grid-template-columns: repeat(3, 1fr); }
  .hosp-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .content { padding: 14px; }
}

@media (min-width: 1200px) {
  .main-icons-grid { grid-template-columns: repeat(4, 175px); justify-content: center; }
  .sub-icons-grid { grid-template-columns: repeat(4, 155px); justify-content: center; }
}

@media (min-width: 1400px) {
  .ind-table { font-size: 13px; }
  .ind-table th, .ind-table td { padding: 6px 10px; }
  .ind-table .grp1 th { font-size: 11px; }
  .ind-table .grp2 th { font-size: 10px; }
  .ind-table .gov-col { min-width: 80px; }
  .ind-table .hosp-col { min-width: 140px; }
}

/* ====== EQUIPMENT PIVOT TABLE ====== */
.eq-pivot { border-collapse: collapse; width: 100%; min-width: 1200px; }
.eq-pivot th, .eq-pivot td { border: 1px solid var(--border); padding: 4px 6px; text-align: center; white-space: nowrap; }
.eq-pivot thead th { background: var(--secondary); color: #fff; font-weight: 700; font-size: 10px; position: sticky; top: 0; z-index: 2; }
.eq-pivot .hosp-col { font-weight: 600; min-width: 100px; text-align: right; }
.eq-dev-row td { background: var(--off-white); }
body.dark-mode .eq-dev-row td { background: #0d1117; }
.eq-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 4px; }
.eq-dot.good { background: var(--success); }
.eq-dot.warn { background: var(--warning); }
.eq-dot.bad { background: var(--danger); }

/* ====== ALERTS ====== */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.alert-danger { background: var(--danger-light); border: 1px solid #f5c6cb; color: #721c24; }
body.dark-mode .alert-danger { background: #3d1a1a; border-color: #5a2a2a; color: #f0a0a0; }

/* ====== BUTTON VARIANTS ====== */
.btn-xs { padding: 4px 8px; font-size: 10px; border-radius: 6px; min-height: 28px; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { box-shadow: 0 4px 12px rgba(41,128,185,0.3); }
.btn-outline-danger { background: none; border: 1px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-light); }
.btn-outline-primary { background: none; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-light); }

/* ====== FORM VARIANTS ====== */
.form-input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; transition: all var(--transition); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }
.modal-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; transition: all var(--transition); }
.modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }

/* ====== INLINE EDITING ====== */
.editing { outline: 2px solid var(--primary); outline-offset: -1px; background: rgba(192,57,43,0.04); }
.plat-total { font-weight: 700; }

/* ====== PRINT UTILITY ====== */
.no-print { display: block; }
@media print { .no-print { display: none !important; } }

/* ====== TABLE UTILITIES ====== */
.agg-cell { font-weight: 700; background: var(--bg); }
.info-row td { font-size: 11px; color: var(--text-muted); font-style: italic; }
.gov-header { background: var(--secondary) !important; color: #fff !important; font-weight: 700; }
body.dark-mode .gov-header { background: #1c2128 !important; }

/* ====== GENERAL UTILITIES ====== */
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.signature { font-family: 'Brush Script MT', cursive; font-size: 18px; color: var(--text-soft); }
.subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer { text-align: center; padding: 14px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 20px; }
.badge-cat { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.role-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.bg-danger { background: var(--danger-light) !important; }
.bg-success { background: var(--success-light) !important; }

/* ====== MENU ====== */
.menu-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; cursor: pointer; transition: all var(--transition); }
.menu-item:hover { background: var(--hover-bg); }
.menu-label { font-size: 13px; font-weight: 600; }

/* ====== GROUP CHILDREN ====== */
.grp-parent { background: var(--bg); font-weight: 700; }
.grp-child td { padding-right: 24px !important; font-size: 12px; }
body.dark-mode .grp-parent { background: #1c2128; }

/* ====== DARK MODE FIXES FOR NEW CLASSES ====== */
body.dark-mode .eq-dot.good { background: #7ee787; }
body.dark-mode .eq-dot.warn { background: #d29922; }
body.dark-mode .eq-dot.bad { background: #f85149; }
body.dark-mode .modal-input { background: #0d1117; border-color: var(--border); color: #e6edf3; }
body.dark-mode .form-input { background: #0d1117; border-color: var(--border); color: #e6edf3; }
body.dark-mode .role-badge { background: #3d1a1a; color: #f0a0a0; }

/* ====== Enhanced Mobile Tables ====== */
@media (max-width: 768px) {
  .eq-pivot { min-width: 100%; font-size: 9px; }
  .eq-pivot th, .eq-pivot td { padding: 3px 4px; }
  .eq-pivot thead th { font-size: 9px; }
  .stats { gap: 8px; }
  .toolbar { gap: 6px; }
}
@media (max-width: 600px) {
  .eq-pivot { font-size: 8px; }
  .eq-pivot th, .eq-pivot td { padding: 2px 3px; }
}

/* ====== PAGE LOADING / ERROR / EMPTY STATES ====== */
.page-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 16px; color: var(--text-muted); text-align: center;
}
.page-loading i { font-size: 36px; color: var(--primary); opacity: 0.6; }
.page-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 12px; color: var(--danger); text-align: center;
}
.page-error i { font-size: 40px; opacity: 0.7; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 50px 20px; text-align: center; animation: fadeIn 0.4s ease;
}
.empty-state-icon {
  width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; margin-bottom: 16px; font-size: 30px;
  background: var(--bg); color: var(--text-muted); transition: all var(--transition);
}
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; color: var(--text-muted); max-width: 320px; line-height: 1.6; }
body.dark-mode .empty-state-icon { background: var(--bg-alt); }

/* ====== TOAST ENHANCEMENTS ====== */
#toastContainer { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast-msg {
  display: flex; align-items: center; gap: 8px; padding: 12px 20px;
  border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18); animation: toastIn 0.35s ease;
  max-width: 92%; text-align: center; pointer-events: auto;
  border: 1px solid rgba(255,255,255,0.1);
  background: #1f2937; color: #f3f4f6;
}
.toast-msg.out { opacity: 0; transform: translateY(8px) scale(0.96); transition: all 0.35s ease; }
.toast-msg.toast-success { background: #065f46; color: #d1fae5; border-color: #059669; }
.toast-msg.toast-error { background: #7f1d1d; color: #fee2e2; border-color: #dc2626; }
.toast-msg.toast-warning { background: #78350f; color: #fef3c7; border-color: #d97706; }
.toast-msg.toast-info { background: #1e3a5f; color: #dbeafe; border-color: #2563eb; }
body.dark-mode .toast-msg { border-color: rgba(255,255,255,0.05); }

/* ====== SKELETON LOADING ====== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--border-soft) 25%, var(--hover-bg) 50%, var(--border-soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px; height: 16px; margin-bottom: 8px;
}
.skeleton-table { width: 100%; }
.skeleton-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.skeleton-cell { height: 14px; background: linear-gradient(90deg, var(--border-soft) 25%, var(--hover-bg) 50%, var(--border-soft) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: 4px; }

/* ====== FOCUS RING ====== */
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.form-control:focus-visible, .search-input:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(192,57,43,0.12), 0 0 0 1px var(--primary); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ====== BUTTON ENHANCEMENTS ====== */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0);
  transition: background var(--transition);
}
.btn:active::after { background: rgba(255,255,255,0.15); }
.btn:active { transform: scale(0.97); }
body.dark-mode .btn:active::after { background: rgba(255,255,255,0.08); }

/* ====== ENHANCED CARD EFFECTS ====== */
.card { transition: box-shadow var(--transition), transform var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.stat-card { transition: box-shadow var(--transition), transform var(--transition); }
.stat-card:hover .stat-number { color: var(--primary); }
.db-stat { position: relative; overflow: hidden; }
.db-stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary-gradient); opacity: 0; transition: opacity var(--transition);
}
.db-stat:hover::before { opacity: 1; }

/* ====== RESPONSIVE STAT CARD ADAPTIVE ====== */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { flex-direction: column; text-align: center; padding: 14px !important; gap: 8px; }
  .stat-card i { font-size: 20px !important; padding: 10px !important; margin: 0; }
  .stat-value { font-size: 18px !important; }
  .stat-label { font-size: 10px !important; }
  .page-loading { padding: 40px 16px; }
  .empty-state { padding: 30px 16px; }
  .empty-state-icon { width: 56px; height: 56px; font-size: 24px; }
  .empty-state-title { font-size: 14px; }
  .empty-state-desc { font-size: 12px; }
}

/* ====== DASHBOARD KPIS NEW LAYOUT ====== */
.dashboard-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
  margin-bottom: 24px; animation: slideDown 0.3s ease;
}
.dashboard-bar .stat-card {
  background: var(--card-bg); border-radius: 14px; padding: 16px;
  align-items: center; gap: 14px; cursor: default;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft);
  transition: all var(--transition);
}
.dashboard-bar .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dashboard-bar .stat-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.dashboard-bar .stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ====== LOGIN PAGE ENHANCED ====== */
.login-page {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #0d7a72 0%, #1a9e8f 40%, #c0392b 100%);
  padding: 20px; position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.1) 0%, transparent 60%);
}
.login-page::after {
  content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%;
  background: rgba(13,122,114,0.07); bottom: -150px; left: -150px;
  animation: float 12s ease-in-out infinite;
}
.login-decoration-1, .login-decoration-2 {
  position: absolute; border-radius: 50%; pointer-events: none;
}
.login-decoration-1 {
  width: 300px; height: 300px; background: rgba(192,57,43,0.06);
  top: -80px; right: -80px; animation: float 15s ease-in-out infinite reverse;
}
.login-decoration-2 {
  width: 200px; height: 200px; background: rgba(255,255,255,0.04);
  bottom: 80px; right: 20%; animation: float 10s ease-in-out infinite 3s;
}
.login-box {
  background: rgba(255,255,255,0.93); padding: 40px 36px; border-radius: 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2); width: 100%; max-width: 400px;
  text-align: center; backdrop-filter: blur(24px); position: relative; z-index: 1;
  animation: fadeInUp 0.6s ease;
}
.login-box .form-control {
  width: 100%; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px;
  font-size: 15px; transition: all var(--transition); direction: ltr; text-align: left;
  background: var(--off-white);
}
.login-box .form-control:focus { border-color: #0d7a72; box-shadow: 0 0 0 4px rgba(13,122,114,0.12); outline: none; }
.login-box .btn-block {
  width: 100%; padding: 14px; background: var(--primary-gradient); color: #fff;
  border: none; border-radius: 12px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all var(--transition); margin-top: 8px; letter-spacing: 0.3px;
}
.login-box .btn-block:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(192,57,43,0.35); }
.login-box .btn-block:active { transform: translateY(0); }
.login-logo {
  width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: 8px;
  border: 3px solid #0d7a72; box-shadow: 0 4px 16px rgba(13,122,114,0.25);
}
.login-icon { font-size: 48px; color: var(--primary); margin-bottom: 8px; }
body.dark-mode .login-box { background: rgba(22,27,34,0.96); }
body.dark-mode .login-box .form-control { background: #0d1117; border-color: #30363d; color: #e6edf3; }
body.dark-mode .login-box .form-control:focus { border-color: #1a9e8f; box-shadow: 0 0 0 4px rgba(26,158,143,0.15); }
body.dark-mode .login-error { background: #3d1a1a; border-color: #5a2a2a; color: #f0a0a0; }

/* ====== LOGIN MISC ====== */
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.login-box h1 { font-size: 26px; font-weight: 800; margin-bottom: 2px; color: var(--text); }
.login-box label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-soft); }
.login-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 24px; background: var(--danger-light); border: 1px solid #f5c6cb; border-radius: 10px; padding: 10px 12px; }
.login-footer { margin-top: 20px; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
.header-logo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; margin-left: 10px; border: 2px solid var(--primary); }
.credit-text { font-size: 12px; color: var(--primary); font-weight: 600; margin-left: 8px; white-space: nowrap; }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }

/* ====== MODAL ENHANCED ====== */
.modal-overlay.active {
  display: flex; backdrop-filter: blur(4px);
  animation: overlayIn 0.2s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal { animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.modal-header { position: relative; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; background: transparent; border: none; font-size: 22px;
  cursor: pointer; color: var(--text-muted); transition: all var(--transition);
}
.modal-close:hover { background: var(--hover-bg); color: var(--text); }
body.dark-mode .modal-close:hover { background: var(--bg-alt); }

/* ====== CONFIRM MODAL ====== */
.confirm-msg { font-size: 15px; text-align: center; padding: 24px 10px; color: var(--text); line-height: 1.7; }
.confirm-msg i { font-size: 36px; display: block; margin-bottom: 16px; color: var(--warning); }

/* ====== PAGE TITLE ENHANCED ====== */
.page-title {
  font-size: 18px; font-weight: 800; padding: 8px 0 8px 12px; margin-bottom: 12px;
  border-right: 4px solid var(--primary);
  background: linear-gradient(to left, transparent, var(--primary-light));
  color: var(--text); display: flex; align-items: center; gap: 8px;
  border-radius: 0 8px 8px 0;
}

/* ====== SUB NAV ENHANCED ====== */
.sub-nav {
  display: flex; gap: 4px; margin-bottom: 16px; background: var(--card-bg);
  padding: 6px; border-radius: 12px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft); overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ====== PRINT POLISH ====== */
@media print {
  body { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 10mm 8mm; }
  .header, .app-footer, .btn, .page-actions, #dashboardBar, .modal-overlay,
  .filter-bar, .sub-nav, .dashboard-bar, [id^="rdnForm"], .btn-back,
  .card-header a, .card-header button, .page-actions button,
  .eq-pivot thead tr:last-child { display: none !important; }
  .card { box-shadow: none !important; border: none !important; margin: 0 !important; break-inside: avoid; }
  .content { padding: 0 !important; }
  .report-table { min-width: auto; font-size: 7px; }
  .report-table th, .report-table td { padding: 2px 3px; }
  #totalTable { min-width: auto; font-size: 8px; }
  .data-table { font-size: 8px; }
  .data-table th, .data-table td { padding: 2px 3px; }
  .ind-table { font-size: 8px; min-width: auto !important; }
  .ind-table th, .ind-table td { padding: 2px 3px; }
  .stock-table { font-size: 7px; min-width: auto !important; }
  .stock-table th, .stock-table td { padding: 1px 2px; }
  .strategic-table { font-size: 8px; min-width: auto !important; }
  .strategic-table th, .strategic-table td { padding: 2px 3px; }
  .consumption-table { min-width: auto; }
  .eq-pivot { font-size: 7px; min-width: auto !important; }
  .eq-pivot th, .eq-pivot td { padding: 1px 2px; }
  .stmt-table { font-size: 7px; }
  .stmt-table td, .stmt-table th { padding: 2px 3px; }
  .branch-stmt-report .stmt-table th, .branch-stmt-report .stmt-table td { font-size: 7px; padding: 2px 3px; }
  .card-header { background: #f5f5f5 !important; border: 1px solid #ddd !important; }
  .report-table .avail-cell, .report-table .total-cell,
  .report-table .incoming-total, .report-table .outgoing-total,
  .report-table .disposal-total, .report-table .avail-total,
  .data-table .avail-cell, .data-table .total-cell,
  .stmt-table .total-cell, .stmt-table .avail-row td,
  .stock-table .avail-cell, .stock-table .total-cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-wrap { overflow: visible !important; }
  .table-scroll { overflow: visible !important; }
}
