/* BMC HUB - Professional Light Theme */
:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --secondary: #06b6d4;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #6366f1;

  --bg: #f8fafc;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #0ea5e9;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.04);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.18s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: var(--font); }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── LOGIN ─── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0ea5e9 100%);
}
.login-card {
  background: var(--bg-white);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-logo img { height: 54px; margin-bottom: 0.5rem; }
.login-logo-text { font-size: 1.1rem; font-weight: 700; color: var(--primary); letter-spacing: 0.03em; }
.login-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1.8rem; }
.login-card h2 { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; text-align: left; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; letter-spacing: 0.03em; }
.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
  background: #fff;
}
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 2.5rem; }
.pw-toggle {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(14,165,233,0.3); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #4f46e5; }
.btn-cyan { background: #06b6d4; color: #fff; }
.btn-cyan:hover { background: #0891b2; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.8rem; font-size: 0.95rem; }
.btn-block { width: 100%; }
.demo-creds {
  margin-top: 1.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  text-align: left;
  font-size: 0.76rem;
}
.demo-creds summary { cursor: pointer; color: var(--text-muted); font-weight: 600; font-size: 0.78rem; }
.demo-creds table { width: 100%; margin-top: 0.5rem; border-collapse: collapse; }
.demo-creds th { padding: 0.2rem 0.4rem; font-size: 0.7rem; color: var(--text-light); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.demo-creds td { padding: 0.18rem 0.4rem; color: var(--text); font-size: 0.74rem; }
.demo-creds td:first-child { color: var(--text-muted); font-weight: 600; }
.login-error { color: var(--danger); font-size: 0.8rem; margin-top: 0.5rem; display: none; }

/* ─── APP LAYOUT ─── */
#app { display: none; height: 100vh; flex-direction: row; overflow: hidden; }
#app.visible { display: flex; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}
.sidebar-brand {
  padding: 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.sidebar-brand img { height: 34px; border-radius: 4px; }
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-name { font-size: 0.82rem; font-weight: 700; color: #fff; }
.sidebar-brand-sub { font-size: 0.68rem; color: #64748b; }
.sidebar-user {
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: 0.8rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.68rem; color: #64748b; }
.sidebar-nav { flex: 1; padding: 0.5rem 0; }
.nav-section { padding: 0.6rem 1rem 0.2rem; font-size: 0.65rem; font-weight: 700; color: #475569; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 1rem;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.82rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: #e2e8f0; }
.nav-item.active {
  background: rgba(14,165,233,0.12);
  color: var(--primary);
  border-left-color: var(--primary);
}
.nav-item i { width: 16px; text-align: center; font-size: 0.85rem; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}
.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer .nav-item { border-radius: var(--radius-sm); border-left: none; padding: 0.5rem 0.6rem; }

/* ─── MAIN CONTENT ─── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.topbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.notif-btn {
  position: relative;
  width: 34px; height: 34px;
  border: none; background: var(--bg); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.notif-btn:hover { background: var(--primary-light); color: var(--primary); }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* ─── PAGE SECTIONS ─── */
.page-header { margin-bottom: 1.2rem; }
.page-header h1 { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.page-header p { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ─── CARDS ─── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.2rem 0.6rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-title { font-size: 0.9rem; font-weight: 700; color: var(--text); flex: 1; }
.card-body { padding: 1.2rem; }
.card-body.p0 { padding: 0; }

/* ─── STAT CARDS ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.2rem;
}
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--primary));
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover { border-color: var(--card-color, var(--primary)); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card:hover::before { opacity: 1; }
.stat-card.active {
  border-color: var(--card-color, var(--primary));
  background: var(--card-bg, var(--primary-light));
  box-shadow: var(--shadow);
}
.stat-card.active::before { opacity: 1; }
.stat-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-icon { position: absolute; top: 0.85rem; right: 0.85rem; font-size: 1.4rem; opacity: 0.12; color: var(--card-color, var(--primary)); }

/* ─── TABLE ─── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 2px solid var(--border); background: var(--bg); }
thead th {
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
tbody tr:hover { background: var(--bg); }
tbody tr:last-child { border-bottom: none; }
td {
  padding: 0.75rem 0.9rem;
  font-size: 0.83rem;
  color: var(--text);
  vertical-align: middle;
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.22rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #ede9fe; color: #4c1d95; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-cyan { background: #cffafe; color: #164e63; }
.badge-orange { background: #ffedd5; color: #9a3412; }

/* ─── FILTER BAR ─── */
.filter-bar {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  background: var(--bg-white);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.filter-bar .form-control { padding: 0.45rem 0.7rem; font-size: 0.8rem; }
.filter-indicator {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.filter-indicator .clear-btn { background: none; border: none; cursor: pointer; color: var(--primary); font-size: 0.8rem; padding: 0; line-height: 1; }

/* ─── FORM STYLES ─── */
.form-section { margin-bottom: 1.5rem; }
.form-section-title {
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 0.4rem;
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.form-group label .req { color: var(--danger); margin-left: 2px; }
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 80px; resize: vertical; }
.form-hint { font-size: 0.72rem; color: var(--text-light); }
.notice-box {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  display: flex; align-items: flex-start; gap: 0.5rem;
  margin-top: 0.5rem;
}
.notice-box.warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.notice-box.info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ─── ITEMS TABLE ─── */
.items-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { background: var(--bg); padding: 0.5rem 0.7rem; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.items-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border-light); }
.items-table tbody tr:last-child td { border-bottom: none; }
.items-table .form-control { padding: 0.35rem 0.5rem; font-size: 0.8rem; border-radius: 4px; }
.add-row-btn { margin-top: 0.5rem; }

/* ─── APPROVAL STEPS ─── */
.approval-steps {
  display: flex; align-items: center; gap: 0; flex-wrap: nowrap;
  overflow-x: auto; padding-bottom: 0.4rem;
}
.approval-step {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  min-width: 80px; flex: 1;
  position: relative;
}
.approval-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 17px; left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.approval-step.done:not(:last-child)::after { background: var(--success); }
.step-circle {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  border: 2px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  position: relative; z-index: 1;
  transition: all var(--transition);
}
.approval-step.active .step-circle { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.approval-step.done .step-circle { border-color: var(--success); background: var(--success); color: #fff; }
.step-label { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); text-align: center; white-space: nowrap; }
.approval-step.active .step-label { color: var(--primary); }
.approval-step.done .step-label { color: var(--success); }

/* ─── ATTACHMENT ZONE ─── */
.attach-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}
.attach-zone:hover, .attach-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.attach-zone i { font-size: 1.4rem; color: var(--text-light); margin-bottom: 0.4rem; }
.attach-zone p { font-size: 0.8rem; color: var(--text-muted); }
.attach-zone span { font-size: 0.72rem; color: var(--text-light); }
.file-list { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }
.file-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}
.file-item i { color: var(--primary); }
.file-item .file-name { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .file-size { color: var(--text-light); font-size: 0.7rem; }
.file-item .remove-file { background: none; border: none; cursor: pointer; color: var(--danger); padding: 0; font-size: 0.9rem; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  transform: translateY(12px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal.modal-sm { max-width: 440px; }
.modal.modal-lg { max-width: 900px; }
.modal-header {
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.6rem;
}
.modal-title { font-size: 0.95rem; font-weight: 700; color: var(--text); flex: 1; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.1rem; padding: 0.2rem; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.3rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 0.9rem 1.3rem; border-top: 1px solid var(--border); display: flex; gap: 0.6rem; justify-content: flex-end; }

/* ─── TABS ─── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.2rem; }
.tab {
  padding: 0.6rem 1rem;
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── EMPTY STATE ─── */
.empty-state {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; color: var(--border); margin-bottom: 0.8rem; }
.empty-state h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.8rem; }

/* ─── REQUEST TYPE CARDS ─── */
.req-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.req-type-card {
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.req-type-card:hover {
  border-color: var(--card-color, var(--primary));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.req-type-card .icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--card-bg, var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--card-color, var(--primary));
  margin: 0 auto 0.65rem;
}
.req-type-card h4 { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.req-type-card p { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ─── NOTIFICATION ─── */
.notif-panel {
  position: fixed; top: 56px; right: 0;
  width: 340px; max-height: calc(100vh - 56px);
  background: var(--bg-white);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 200;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition);
  overflow: hidden;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel-header {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.notif-panel-header h3 { font-size: 0.88rem; font-weight: 700; flex: 1; }
.notif-tabs { display: flex; gap: 0.2rem; padding: 0.5rem; border-bottom: 1px solid var(--border); }
.notif-tab {
  flex: 1; text-align: center; padding: 0.35rem;
  font-size: 0.72rem; font-weight: 600; color: var(--text-muted);
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
}
.notif-tab.active { background: var(--primary-light); color: var(--primary); }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
  display: flex; gap: 0.6rem; align-items: flex-start;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #f0f9ff; }
.notif-dot-sm { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.notif-item-title { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.notif-item-msg { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }
.notif-item-time { font-size: 0.68rem; color: var(--text-light); margin-top: 0.2rem; }

/* ─── REPORTS ─── */
.report-filter-card { margin-bottom: 1.2rem; }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.chart-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.chart-card .chart-title { font-size: 0.82rem; font-weight: 700; color: var(--text); margin-bottom: 0.8rem; }
.chart-container { height: 220px; position: relative; }

/* ─── ADMIN PANEL ─── */
.admin-tabs-wrap { margin-bottom: 1.2rem; }
.admin-section { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.admin-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.admin-section-title { font-size: 0.9rem; font-weight: 700; }
.config-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
}
.config-row:last-child { border-bottom: none; }
.config-row-label { flex: 1; font-size: 0.83rem; font-weight: 500; }
.config-row-sub { font-size: 0.72rem; color: var(--text-muted); }
.toggle {
  position: relative; display: inline-block;
  width: 38px; height: 20px; cursor: pointer; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 20px;
  transition: background var(--transition);
}
.toggle-slider::after {
  content: ''; position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::after { transform: translateX(18px); }

/* ─── DETAIL PANEL ─── */
.detail-row { display: flex; gap: 0.8rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border-light); }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 160px; flex-shrink: 0; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.detail-value { font-size: 0.82rem; color: var(--text); }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 0.75rem; padding-bottom: 1rem; position: relative; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute;
  left: 15px; top: 32px;
  width: 2px; height: calc(100% - 10px);
  background: var(--border);
}
.timeline-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; flex-shrink: 0; z-index: 1;
}
.timeline-icon.blue { background: var(--primary-light); color: var(--primary); }
.timeline-icon.green { background: #d1fae5; color: var(--success); }
.timeline-icon.red { background: #fee2e2; color: var(--danger); }
.timeline-icon.yellow { background: #fef3c7; color: var(--warning); }
.timeline-icon.gray { background: var(--bg); color: var(--text-muted); }
.timeline-content { flex: 1; }
.timeline-action { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.timeline-actor { font-size: 0.75rem; color: var(--text-muted); }
.timeline-time { font-size: 0.7rem; color: var(--text-light); margin-top: 0.15rem; }
.timeline-remark { font-size: 0.78rem; color: var(--text-muted); background: var(--bg); padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); margin-top: 0.3rem; border-left: 3px solid var(--border); }

/* ─── MISC ─── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

/* ─── TOAST ─── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 0.83rem; font-weight: 600;
  min-width: 240px; max-width: 340px;
  animation: slideIn 0.2s ease;
  border-left: 4px solid transparent;
}
.toast.success { background: #fff; color: var(--success); border-left-color: var(--success); }
.toast.error { background: #fff; color: var(--danger); border-left-color: var(--danger); }
.toast.info { background: #fff; color: var(--primary); border-left-color: var(--primary); }
.toast i { font-size: 1rem; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── NEW v6 COMPONENTS ─── */

/* Priority badges */
.badge-level1 { background: #f1f5f9; color: #475569; }
.badge-level2 { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }

/* Workflow steps — extended 6-step */
.workflow-bar {
  display: flex; align-items: flex-start; gap: 0;
  overflow-x: auto; padding: 0.8rem 0 0.5rem;
  position: relative;
}
.wf-step {
  display: flex; flex-direction: column; align-items: center;
  min-width: 72px; flex: 1; position: relative;
}
.wf-step:not(:last-child)::after {
  content: ''; position: absolute;
  top: 16px; left: calc(50% + 16px);
  width: calc(100% - 32px); height: 2px;
  background: var(--border); z-index: 0; transition: background 0.3s;
}
.wf-step.done:not(:last-child)::after { background: var(--success); }
.wf-step.active:not(:last-child)::after { background: var(--primary); }
.wf-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  border: 2px solid var(--border);
  background: var(--bg-white); color: var(--text-muted);
  position: relative; z-index: 1; transition: all 0.2s;
}
.wf-step.done .wf-circle  { border-color: var(--success); background: var(--success); color: #fff; }
.wf-step.active .wf-circle { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.wf-label { font-size: 0.62rem; font-weight: 600; color: var(--text-muted); text-align: center; margin-top: 0.3rem; line-height: 1.2; max-width: 64px; }
.wf-step.done .wf-label  { color: var(--success); }
.wf-step.active .wf-label { color: var(--primary); }

/* Non-MTV 5-step workflow bar */
.workflow-bar.non-mtv-wf .wf-step { min-width: 60px; flex: 1; }
.workflow-bar.non-mtv-wf .wf-circle { width: 28px; height: 28px; font-size: 0.6rem; }
.workflow-bar.non-mtv-wf .wf-step:not(:last-child)::after {
  top: 13px; left: calc(50% + 14px); width: calc(100% - 28px);
}
.workflow-bar.non-mtv-wf .wf-label { font-size: 0.58rem; max-width: 58px; }

/* Rejected step state */
.wf-step.rejected .wf-circle { border-color: var(--danger); background: var(--danger); color: #fff; }
.wf-step.rejected .wf-label  { color: var(--danger); }
.wf-step.rejected:not(:last-child)::after { background: var(--danger); }

/* Pending pulse animation on active step icon */
@keyframes wf-pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(14,165,233,0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(14,165,233,0); }
  100% { box-shadow: 0 0 0 0 rgba(14,165,233,0); }
}
.wf-step.active .wf-circle { animation: wf-pulse-ring 1.8s ease-out infinite; }

/* Pending dot under active label */
.wf-pending-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); margin: 3px auto 0;
  animation: wf-blink 1.2s ease-in-out infinite;
}
@keyframes wf-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.7); }
}

/* Workflow status banner (pending label below stepper) */
.wf-status-banner {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.75rem; color: var(--primary);
  background: var(--primary-light); border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem; margin-top: 0.5rem;
  border: 1px solid rgba(14,165,233,0.25);
}
.wf-status-banner i { font-size: 0.72rem; }

/* Slow spin for hourglass icon */
@keyframes wf-spin-slow {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.wf-spin-slow { animation: wf-spin-slow 3s linear infinite; }

/* btn-cyan utility */
.btn-cyan {
  background: var(--secondary);
  color: #fff;
  border: none;
}
.btn-cyan:hover { background: #0891b2; }

/* Demo timer banner */
.demo-timer-banner {
  background: linear-gradient(90deg, #fef3c7, #fffbeb);
  border: 1.5px solid #fde68a;
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem;
}
.demo-timer-banner.overdue { background: #fee2e2; border-color: #fca5a5; }
.demo-timer-banner .timer-icon { font-size: 1.4rem; }
.demo-timer-banner .timer-text h4 { font-size: 0.85rem; font-weight: 700; color: #92400e; margin-bottom: 0.15rem; }
.demo-timer-banner .timer-text p { font-size: 0.78rem; color: #b45309; }
.demo-timer-banner.overdue .timer-text h4 { color: #991b1b; }
.demo-timer-banner.overdue .timer-text p { color: #b91c1c; }
.demo-countdown { font-size: 1.1rem; font-weight: 800; color: #d97706; margin-left: auto; white-space: nowrap; }
.demo-timer-banner.overdue .demo-countdown { color: #dc2626; }

/* Inventory check row */
.inv-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.inv-row .inv-code { font-weight: 700; color: var(--primary); min-width: 90px; }
.inv-row .inv-avail { margin-left: auto; font-size: 0.75rem; }
.inv-row.ok  .inv-avail { color: var(--success); font-weight: 600; }
.inv-row.warn .inv-avail { color: var(--danger); font-weight: 600; }

/* Delivery checklist */
.delivery-check-table { width: 100%; border-collapse: collapse; }
.delivery-check-table th { background: var(--bg); padding: 0.45rem 0.6rem; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.delivery-check-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-light); font-size: 0.82rem; vertical-align: middle; }
.delivery-check-table input[type=number] { width: 70px; }
.del-check { width: 18px; height: 18px; cursor: pointer; accent-color: var(--success); }

/* Signature pad */
.sig-pad-wrap { border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: #fff; position: relative; }
.sig-pad-wrap canvas { display: block; border-radius: var(--radius-sm); cursor: crosshair; touch-action: none; }
.sig-pad-label { position: absolute; bottom: 0.5rem; left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: var(--text-light); pointer-events: none; white-space: nowrap; }
.sig-clear-btn { margin-top: 0.4rem; }

/* Maps link field */
.maps-link-wrap { display: flex; gap: 0.4rem; align-items: center; }
.maps-link-wrap .form-control { flex: 1; }
.maps-link-preview { font-size: 0.75rem; color: var(--primary); cursor: pointer; white-space: nowrap; }
.maps-link-preview:hover { text-decoration: underline; }

/* Payment status comment box */
.payment-status-box {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.5rem;
}
.payment-status-box label { font-size: 0.75rem; font-weight: 700; color: #15803d; display: block; margin-bottom: 0.4rem; }

/* Photo upload zone (Mandate) */
.photo-zone {
  border: 2px dashed #fca5a5;
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  background: #fff5f5;
  transition: all 0.18s;
}
.photo-zone:hover { border-color: var(--danger); background: #fee2e2; }
.photo-zone i { font-size: 1.4rem; color: #fca5a5; margin-bottom: 0.3rem; }
.photo-zone p { font-size: 0.8rem; color: #ef4444; font-weight: 600; }
.photo-zone.has-file { border-color: var(--success); background: #f0fdf4; }
.photo-zone.has-file i { color: var(--success); }
.photo-zone.has-file p { color: var(--success); }

/* Location section */
.location-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.location-block-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.6rem; }

/* Kuwait area flag */
.kuwait-flag { font-size: 0.8rem; margin-right: 0.2rem; }

/* Status pill with icon */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.28rem 0.7rem; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700;
}

/* ─── PHONE FIELD ─── */
.phone-field-wrap { display: flex; align-items: center; gap: 0; }
.phone-code {
  background: #f1f5f9;
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: 0.65rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  height: 38px;
  display: flex;
  align-items: center;
}
.phone-field-wrap .form-control {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  flex: 1;
}

/* ─── MULTI-PHOTO UPLOAD ─── */
.photo-zone.multi-photo {
  border-color: #93c5fd;
  background: #eff6ff;
}
.photo-zone.multi-photo:hover { border-color: var(--primary); background: #dbeafe; }
.photo-zone.multi-photo i { color: #60a5fa; }
.photo-zone.multi-photo p { color: var(--primary); }
.photo-zone.multi-photo.has-file { border-color: var(--success); background: #f0fdf4; }

/* ─── DELIVERY / WAREHOUSE CHECK TABLE ─── */
.delivery-check-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.delivery-check-table th { background: #f8fafc; padding: 0.55rem 0.7rem; text-align: left; font-weight: 700; color: var(--text-muted); font-size: 0.72rem; letter-spacing: 0.04em; border-bottom: 1.5px solid var(--border); }
.delivery-check-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.delivery-check-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.delivery-check-table tr:last-child td { border-bottom: none; }

/* ─── SHIPMENT TYPE BADGE ─── */
#wh-ship-type-badge { display: inline-block; margin-top: 0.4rem; }

/* ─── PARTIAL DELIVERY SLICER ─── */
.partial-slicer-bar {
  background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%);
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: #92400e;
  font-weight: 600;
}
.partial-slicer-bar i { font-size: 1rem; color: #d97706; }

/* ─── DEMO RETURN WORKFLOW ─── */
.demo-return-card {
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}
.demo-return-card label { font-size: 0.75rem; font-weight: 700; color: #c2410c; display: block; margin-bottom: 0.4rem; }

/* ─── FINANCE PAYMENT DROPDOWN ─── */
.payment-status-box select { margin-bottom: 0.5rem; }

/* ─── TOP MGMT REJECTION DROPDOWN ─── */
.mgmt-reject-reason { 
  background: #fff5f5;
  border: 1.5px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

/* ─── QTY MISMATCH NOTICE ─── */
.qty-mismatch-alert {
  background: #fffbeb;
  border-left: 4px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #92400e;
  margin-top: 0.5rem;
}

/* ─── WAREHOUSE DISPATCH CHECKLIST ─── */
.wh-checklist-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-light); }
.wh-checklist-row:last-child { border-bottom: none; }
.wh-checklist-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--success); }

/* ─── REIMBURSEMENT TABLE ─── */
.reimb-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; min-width: 900px; }
.reimb-table th {
  background: #f8fafc;
  padding: 0.45rem 0.55rem;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.reimb-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.reimb-table tfoot td {
  background: #f8fafc;
  border-top: 1.5px solid var(--border);
  border-bottom: none;
}
.reimb-table tr:hover td { background: #f8fafc; }
.reimb-table .reimb-input { font-size: 0.77rem; padding: 0.3rem 0.45rem; }
.reimb-table .form-control { border-radius: 4px; }
.reimb-table textarea.form-control { min-height: 40px; }

/* Reimbursement detail view table */
.reimb-detail-table { font-size: 0.76rem; }
.reimb-detail-table th { white-space: nowrap; }
.reimb-detail-table td { white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* Finance Release status badge */
.badge-released { background: #d1fae5; color: #065f46; }

/* Petty cash deadline countdown */
.pct-deadline-badge { display: inline-flex; align-items: center; gap: 0.3rem; }

/* ══════════════════════════════════════════════════════
   LANGUAGE SWITCHER BUTTON
══════════════════════════════════════════════════════ */
.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  letter-spacing: 0.02em;
}
.lang-toggle-btn:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.5);
}
/* On login screen — darker style */
.login-lang-wrap {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  z-index: 10;
}
.login-lang-wrap .lang-toggle-btn {
  background: rgba(14,165,233,0.18);
  border-color: rgba(14,165,233,0.4);
  color: #e0f2fe;
}
.login-lang-wrap .lang-toggle-btn:hover {
  background: rgba(14,165,233,0.35);
  border-color: #0ea5e9;
  color: #fff;
}
/* In the topbar */
.topbar-actions .lang-toggle-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.7rem;
}
.topbar-actions .lang-toggle-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════
   ARABIC / RTL SUPPORT
   Applied when <html dir="rtl"> is set by Lang.apply()
══════════════════════════════════════════════════════ */

/* ── Arabic font stack ────────────────────────────── */
html[dir="rtl"] body {
  font-family: 'Segoe UI', 'Tahoma', 'Cairo', 'Noto Sans Arabic',
               -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

/* ── Global flip helpers ──────────────────────────── */
html[dir="rtl"] .sidebar        { right: 0; left: auto; border-left: 1px solid rgba(255,255,255,0.06); border-right: none; }
html[dir="rtl"] .main            { margin-right: var(--sidebar-width, 240px); margin-left: 0; }
html[dir="rtl"] .topbar          { flex-direction: row-reverse; }
html[dir="rtl"] .topbar-actions  { flex-direction: row-reverse; }
html[dir="rtl"] .sidebar-brand   { flex-direction: row-reverse; }
html[dir="rtl"] .sidebar-user    { flex-direction: row-reverse; }
html[dir="rtl"] .sidebar-user-info { text-align: right; }
html[dir="rtl"] .nav-item        { flex-direction: row-reverse; justify-content: flex-end; padding-right: 1.2rem; padding-left: 0.8rem; }
html[dir="rtl"] .nav-item i      { margin-left: 0.7rem; margin-right: 0; }
html[dir="rtl"] .nav-badge       { margin-right: auto; margin-left: 0; }
html[dir="rtl"] .sidebar-footer  { border-top: 1px solid rgba(255,255,255,0.06); }

/* ── Sidebar section labels ───────────────────────── */
html[dir="rtl"] .nav-section { text-align: right; padding-right: 1.2rem; }

/* ── Page header ──────────────────────────────────── */
html[dir="rtl"] .page-header { direction: rtl; text-align: right; }
html[dir="rtl"] .page-header.flex { flex-direction: row-reverse; }

/* ── Cards ────────────────────────────────────────── */
html[dir="rtl"] .card-header    { flex-direction: row-reverse; }
html[dir="rtl"] .card-title     { text-align: right; }

/* ── Tables ───────────────────────────────────────── */
html[dir="rtl"] table           { direction: rtl; }
html[dir="rtl"] th,
html[dir="rtl"] td              { text-align: right; }
html[dir="rtl"] .delivery-check-table th,
html[dir="rtl"] .delivery-check-table td { text-align: right; }
html[dir="rtl"] .text-center    { text-align: center !important; }
html[dir="rtl"] .text-sm        { text-align: right; }

/* ── Flex row reversal ────────────────────────────── */
html[dir="rtl"] .flex           { direction: rtl; }
html[dir="rtl"] .flex.gap-1     { gap: 0.25rem; }
html[dir="rtl"] .filter-bar     { flex-direction: row-reverse; flex-wrap: wrap; }

/* ── Stats grid ───────────────────────────────────── */
html[dir="rtl"] .stats-grid     { direction: rtl; }
html[dir="rtl"] .stat-card      { text-align: right; }

/* ── Forms ────────────────────────────────────────── */
html[dir="rtl"] .form-group label     { text-align: right; display: block; }
html[dir="rtl"] .form-control         { text-align: right; direction: rtl; }
html[dir="rtl"] select.form-control   { direction: rtl; }
html[dir="rtl"] textarea.form-control { direction: rtl; text-align: right; }
html[dir="rtl"] .form-grid            { direction: rtl; }
html[dir="rtl"] .form-section-title   { text-align: right; direction: rtl; }

/* ── Notices / banners ────────────────────────────── */
html[dir="rtl"] .notice-box           { flex-direction: row-reverse; text-align: right; }
html[dir="rtl"] .notice-box i         { margin-left: 0.6rem; margin-right: 0; }
html[dir="rtl"] .qty-mismatch-alert   { border-right: 4px solid var(--warning); border-left: none; }

/* ── Topbar title ─────────────────────────────────── */
html[dir="rtl"] .topbar-title { text-align: right; }

/* ── Modal ────────────────────────────────────────── */
html[dir="rtl"] .modal-header  { flex-direction: row-reverse; }
html[dir="rtl"] .modal-title   { text-align: right; }
html[dir="rtl"] .modal-footer  { flex-direction: row-reverse; justify-content: flex-start; }
html[dir="rtl"] .modal-body    { text-align: right; direction: rtl; }

/* ── Detail rows (request modal) ─────────────────── */
html[dir="rtl"] .detail-row      { flex-direction: row-reverse; }
html[dir="rtl"] .detail-label    { text-align: right; }
html[dir="rtl"] .detail-value    { text-align: right; }

/* ── Workflow bar ─────────────────────────────────── */
html[dir="rtl"] .workflow-bar     { flex-direction: row-reverse; direction: rtl; }
html[dir="rtl"] .wf-step          { text-align: center; }
html[dir="rtl"] .wf-step:not(:last-child)::after {
  right: auto;
  left: 0;
  transform: scaleX(-1);
}

/* ── Tabs ─────────────────────────────────────────── */
html[dir="rtl"] .tabs { flex-direction: row-reverse; }

/* ── Timeline ─────────────────────────────────────── */
html[dir="rtl"] .timeline-item    { flex-direction: row-reverse; }
html[dir="rtl"] .timeline-content { text-align: right; }

/* ── Notification panel ───────────────────────────── */
html[dir="rtl"] .notif-panel      { left: 0; right: auto; border-right: none; border-left: 1px solid var(--border); }
html[dir="rtl"] .notif-panel-header { flex-direction: row-reverse; }
html[dir="rtl"] .notif-tabs       { flex-direction: row-reverse; }
html[dir="rtl"] .notif-item       { flex-direction: row-reverse; text-align: right; }
html[dir="rtl"] .notif-item-title,
html[dir="rtl"] .notif-item-msg,
html[dir="rtl"] .notif-item-time  { text-align: right; }

/* ── Badges ───────────────────────────────────────── */
html[dir="rtl"] .badge { direction: rtl; }

/* ── Buttons in action rows ───────────────────────── */
html[dir="rtl"] .flex.gap-1.flex-wrap { flex-direction: row-reverse; }

/* ── Phone field ──────────────────────────────────── */
html[dir="rtl"] .phone-field-wrap      { flex-direction: row-reverse; }
html[dir="rtl"] .phone-code {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: 1.5px solid var(--border);
  border-right: none;
}
html[dir="rtl"] .phone-field-wrap .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ── Login card RTL ───────────────────────────────── */
html[dir="rtl"] .login-card       { text-align: right; }
html[dir="rtl"] .login-card h2    { text-align: center; }
html[dir="rtl"] .login-logo       { text-align: center; }
html[dir="rtl"] .form-group       { text-align: right; }
html[dir="rtl"] .pw-wrap          { flex-direction: row-reverse; }
html[dir="rtl"] .pw-toggle        { left: 0.6rem; right: auto; }
html[dir="rtl"] #login-screen .login-lang-wrap { right: auto; left: 1.5rem; }

/* ── Sidebar brand RTL ────────────────────────────── */
html[dir="rtl"] .sidebar-brand-text { text-align: right; }
html[dir="rtl"] .sidebar-brand img  { margin-left: 0.7rem; margin-right: 0; }

/* ── Toast RTL ────────────────────────────────────── */
html[dir="rtl"] #toast-container { right: auto; left: 1.5rem; }
html[dir="rtl"] .toast            { flex-direction: row-reverse; text-align: right; }

/* ── Req num link ─────────────────────────────────── */
html[dir="rtl"] .req-num-link { direction: ltr; unicode-bidi: embed; }

/* ── File item ────────────────────────────────────── */
html[dir="rtl"] .file-item { flex-direction: row-reverse; }

/* ── Items table ──────────────────────────────────── */
html[dir="rtl"] .items-table th,
html[dir="rtl"] .items-table td { text-align: right; }

/* ── Reimb table ──────────────────────────────────── */
html[dir="rtl"] .reimb-table th,
html[dir="rtl"] .reimb-table td { text-align: right; }
html[dir="rtl"] .reimb-table { direction: rtl; }

/* ── Print layout RTL ─────────────────────────────── */
html[dir="rtl"] .print-header { flex-direction: row-reverse; }

/* ── Responsive 900px — RTL sidebar collapse ─────── */
@media (max-width: 900px) {
  html[dir="rtl"] .main { margin-right: 56px; margin-left: 0; }
}

/* ── Responsive 640px — RTL modal ────────────────── */
@media (max-width: 640px) {
  html[dir="rtl"] .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* ── Arabic number formatting override ───────────── */
html[dir="rtl"] .fw-600,
html[dir="rtl"] .text-sm { direction: inherit; }

/* ── Progress / utilization bars: keep LTR ───────── */
html[dir="rtl"] .progress-bar-inner { direction: ltr; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .sidebar { width: 56px; min-width: 56px; }
  .sidebar-brand-text, .sidebar-user-info, .nav-item span, .nav-section, .nav-badge { display: none; }
  .sidebar-brand { padding: 1rem 0.7rem; }
  .sidebar-user { padding: 0.7rem; justify-content: center; }
  .nav-item { justify-content: center; padding: 0.7rem; }
  .content-area { padding: 1rem; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; }
}
