/* ==========================================================================
   Pardis HMS Hotel Services Dashboard - Design System
   Corporate Identity: Red #C8102E, White, Light Gray, Charcoal, Silver
   ========================================================================== */

/* --- CSS Custom Properties (Light Theme) --- */
:root {
  --primary: #C8102E;
  --primary-dark: #9B0D23;
  --primary-light: #FDF2F3;
  --primary-hover: #A80D25;
  --primary-glow: rgba(200, 16, 46, 0.15);
  --success: #1B8A4B;
  --success-light: #E8F5E9;
  --warning: #D4880F;
  --warning-light: #FFF8E1;
  --danger: #C8102E;
  --info: #1976D2;
  --bg: #FFFFFF;
  --bg-secondary: #F7F8FA;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1E1E2D;
  --text: #2D3436;
  --text-secondary: #636E72;
  --text-muted: #B2BEC3;
  --text-sidebar: #A0A8B4;
  --text-sidebar-active: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F3F5;
  --silver: #C0C0C0;
  --charcoal: #36454F;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 0.2s ease;
  --font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  --sidebar-width: 240px;
}

/* --- Dark Theme: Warm dark palette harmonious with red --- */
[data-theme="dark"] {
  --primary: #E53E56;
  --primary-dark: #FF6B7A;
  --primary-light: #3D1F25;
  --primary-hover: #FF6B7A;
  --primary-glow: rgba(229, 62, 86, 0.2);
  --success: #4CAF50;
  --success-light: #1B2E1D;
  --warning: #FFA726;
  --warning-light: #2E2517;
  --danger: #E53E56;
  --info: #64B5F6;
  --bg: #141118;
  --bg-secondary: #1C1825;
  --bg-card: #221E2D;
  --bg-sidebar: #0F0D14;
  --text: #F0ECF5;
  --text-secondary: #B8B0C4;
  --text-muted: #6B6480;
  --text-sidebar: #8A8098;
  --text-sidebar-active: #FFFFFF;
  --border: #332E40;
  --border-light: #2A2535;
  --silver: #5A5370;
  --charcoal: #E0DCE8;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.3);
}

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-secondary);
  color: var(--text);
  direction: rtl;
  line-height: 1.7;
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* --- Utility Classes --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* --- Login Page --- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(160deg, var(--bg-secondary) 0%, var(--bg) 50%, var(--primary-light) 100%);
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-hover);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  border-top: 4px solid var(--primary);
  transition: background-color var(--transition), box-shadow var(--transition);
}

.login-card__logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card__logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.login-card__logo p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:active { transform: scale(0.97); }

.btn-block { width: 100%; padding: 0.85rem; font-size: 1rem; }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover { background: var(--border-light); border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }

.btn-icon {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.btn-icon--danger:hover { background: #FDE8EB; border-color: var(--danger); color: var(--danger); }

[data-theme="dark"] .btn-icon--danger:hover { background: #3D1F25; }

.login-error {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid var(--primary-glow);
}

/* --- App Layout (Sidebar + Main) --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar__brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1rem;
}

.sidebar__title {
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 700;
}

.sidebar__nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.3);
}

.nav-item__icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.nav-item--admin { display: none; }
.nav-item--admin.visible { display: flex; }

.sidebar__footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar__user {
  display: flex;
  flex-direction: column;
}

.sidebar__user-name {
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 600;
}

.sidebar__user-role {
  color: var(--text-sidebar);
  font-size: 0.7rem;
}

.sidebar__actions {
  display: flex;
  gap: 0.5rem;
}

.sidebar__actions .btn-icon {
  border-color: rgba(255,255,255,0.15);
  color: var(--text-sidebar);
}

.sidebar__actions .btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(200, 16, 46, 0.1);
}

/* --- Main Area --- */
.main-area {
  flex: 1;
  margin-right: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Bar --- */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-card);
  transition: background-color var(--transition);
}

.topbar__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Help button in topbar (next to page title) */
.help-container-topbar {
  display: inline-flex;
  align-items: center;
}

.help-container-topbar .help-toggle-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
}

.help-container-topbar .help-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 1rem;
  left: 1rem;
  z-index: 300;
  max-width: 520px;
  margin: 0;
}

.sidebar-toggle {
  display: none;
  font-size: 1.3rem;
  padding: 0.4rem;
  min-width: 40px;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.refresh-indicator {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Pages --- */
.page {
  display: none;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.page.active { display: block; }

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* --- Filter Bar --- */
.filter-bar {
  background: var(--bg-card);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  transition: background-color var(--transition);
}

.filter-bar label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Jalali Date Picker --- */
.jalali-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  direction: rtl;
}

.jalali-picker select {
  padding: 0.4rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.82rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23636E72'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.5rem center;
  padding-left: 1.4rem;
}

.jalali-picker select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.jalali-picker__year {
  min-width: 70px;
}

.jalali-picker__month {
  min-width: 80px;
}

.jalali-picker__day {
  min-width: 50px;
}

/* --- Date Range Toggle --- */
.date-range-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.range-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-family: var(--font-family);
  background: var(--bg-card);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-weight: 500;
}

.range-btn + .range-btn {
  border-right: 1px solid var(--border);
}

.range-btn.active {
  background: var(--primary);
  color: #fff;
}

.range-btn:hover:not(.active) {
  background: var(--bg-secondary);
  color: var(--text);
}

/* --- KPI Cards Grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.kpi-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.kpi-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.kpi-card__icon {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.kpi-card__label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.kpi-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.kpi-card__subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Section Headers --- */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  margin-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

/* --- Charts Section --- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  transition: background-color var(--transition);
}

.chart-container__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

.chart-container canvas {
  width: 100% !important;
  height: 250px !important;
}

/* --- Tables --- */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  overflow: hidden;
  margin-bottom: 1.25rem;
  transition: background-color var(--transition);
}

.table-container__title {
  padding: 1rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table thead {
  background: var(--bg-secondary);
}

.data-table th {
  padding: 0.7rem 1rem;
  text-align: right;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.data-table tbody tr:hover { background: var(--primary-light); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* --- Status Badges --- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--ready { background: var(--success-light); color: var(--success); }
.badge--occupied { background: #E3F2FD; color: #1565C0; }
.badge--ooo { background: #FDE8EB; color: var(--danger); }
.badge--dirty { background: var(--warning-light); color: var(--warning); }
.badge--new { background: #E8EAF6; color: #3949AB; }
.badge--assigned { background: #E3F2FD; color: #1565C0; }
.badge--in_progress { background: #FFF3E0; color: #E65100; }
.badge--completed { background: var(--success-light); color: var(--success); }
.badge--closed { background: var(--bg-secondary); color: var(--text-muted); }
.badge--pending_part { background: var(--warning-light); color: var(--warning); }
.badge--critical { background: #FDE8EB; color: var(--danger); }
.badge--high { background: #FFF3E0; color: #E65100; }
.badge--medium { background: #FFF8E1; color: #F9A825; }
.badge--low { background: var(--success-light); color: var(--success); }

[data-theme="dark"] .badge--ready { background: #1B2E1D; color: #81C784; }
[data-theme="dark"] .badge--occupied { background: #1A2A3A; color: #64B5F6; }
[data-theme="dark"] .badge--ooo { background: #3D1F25; color: #FF6B7A; }
[data-theme="dark"] .badge--dirty { background: #2E2517; color: #FFA726; }
[data-theme="dark"] .badge--new { background: #1A1E3A; color: #9FA8DA; }
[data-theme="dark"] .badge--assigned { background: #1A2A3A; color: #64B5F6; }
[data-theme="dark"] .badge--in_progress { background: #2A1F14; color: #FFB74D; }
[data-theme="dark"] .badge--completed { background: #1B2E1D; color: #81C784; }
[data-theme="dark"] .badge--closed { background: #252030; color: #8A8098; }
[data-theme="dark"] .badge--pending_part { background: #2E2517; color: #FFA726; }
[data-theme="dark"] .badge--critical { background: #3D1F25; color: #FF6B7A; }
[data-theme="dark"] .badge--high { background: #2A1F14; color: #FFB74D; }
[data-theme="dark"] .badge--medium { background: #2E2517; color: #FFCA28; }
[data-theme="dark"] .badge--low { background: #1B2E1D; color: #81C784; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
}

.modal-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: flex-start;
}

/* --- Loading & Empty States --- */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 0.5rem;
}

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

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* --- Page Subtitle --- */
.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-weight: 400;
}

/* --- App Footer --- */
.app-footer {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.8;
  transition: background-color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-version {
  font-weight: 600;
  color: var(--text-secondary);
}

.footer-divider {
  color: var(--text-muted);
}

.footer-copyright {
  color: var(--text-muted);
}

.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* --- About Page --- */
.about-page {
  max-width: 600px;
}

.about-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
}

.about-card__row {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  color: var(--text);
}

.about-card__row:last-child { border-bottom: none; }

.about-card__row strong {
  color: var(--text-secondary);
  display: inline-block;
  min-width: 140px;
}

.about-card__row--support {
  margin-top: 0.5rem;
  padding-top: 1rem;
}

.about-card__row--support p {
  margin: 0.3rem 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* --- Help Panel --- */
.help-container {
  margin-bottom: 1rem;
}

.help-toggle-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 1rem;
  font-family: var(--font-family);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.help-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.help-panel {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 0.75rem;
  overflow: hidden;
  transition: background-color var(--transition);
  box-shadow: var(--shadow-card);
}

.help-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--primary-light);
  border-bottom: 1px solid var(--border-light);
}

.help-panel__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.help-panel__close {
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.help-panel__close:hover {
  background: var(--danger);
  color: #fff;
}

.help-panel__body {
  padding: 1rem 1.25rem;
}

.help-panel__section {
  margin-bottom: 1rem;
}

.help-panel__section:last-child {
  margin-bottom: 0;
}

.help-panel__section h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.help-panel__section p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.help-panel__section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-panel__section ul li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.2rem 0;
  padding-right: 1rem;
  position: relative;
  line-height: 1.6;
}

.help-panel__section ul li::before {
  content: '\2022';
  position: absolute;
  right: 0;
  color: var(--primary);
  font-weight: bold;
}

/* --- Tooltip --- */
.tooltip-anchor {
  position: relative;
  cursor: help;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-right: 0.2rem;
  vertical-align: middle;
  display: inline-block;
}

.tooltip-anchor::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  white-space: normal;
  max-width: 240px;
  min-width: 160px;
  box-shadow: var(--shadow-hover);
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 500;
  line-height: 1.5;
  text-align: right;
}

.tooltip-anchor:hover::after,
.tooltip-anchor:focus::after {
  opacity: 1;
}

/* --- Welcome Banner (Admin Only) --- */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-family: var(--font-family);
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.sync-badge--ok { border-color: var(--success); color: var(--success); }
.sync-badge--warn { border-color: var(--warning); color: var(--warning); }
.sync-badge--error { border-color: var(--danger); color: var(--danger); }
.sync-badge:hover { background: var(--bg-secondary); box-shadow: var(--shadow); }

.welcome-banner {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-card) 100%);
  border-radius: var(--radius-lg);
  border-right: 4px solid var(--primary);
  box-shadow: var(--shadow-hover);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  transition: background-color var(--transition);
}

.welcome-banner--collapsed {
  background: var(--bg-card);
  border-radius: var(--radius);
  border-right: 4px solid var(--primary);
  box-shadow: var(--shadow-card);
  padding: 0.7rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-banner__headline-collapsed {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.welcome-banner__expand-btn {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.3rem 0.8rem;
  font-family: var(--font-family);
  font-size: 0.75rem;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
}

.welcome-banner__expand-btn:hover {
  background: var(--primary);
  color: #fff;
}

.welcome-banner__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.welcome-banner__headline {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.welcome-banner__close-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  font-family: var(--font-family);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.welcome-banner__close-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.welcome-banner__intro {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.welcome-banner__table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.welcome-banner__table-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.welcome-banner__table-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-light);
}

.welcome-banner__table-row:last-child {
  border-bottom: none;
}

.welcome-banner__col {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.welcome-banner__col--harris {
  color: var(--text-muted);
}

.welcome-banner__col--ours {
  color: var(--text);
  font-weight: 600;
  background: rgba(27, 138, 75, 0.04);
}

.welcome-banner__closing {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  padding: 1rem 0;
  border-top: 2px solid var(--border);
  margin-top: 0.5rem;
  line-height: 1.6;
}

.welcome-banner__actions {
  text-align: left;
  margin-top: 0.75rem;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(100%); /* In RTL with right:0, positive X moves off-screen to the right */
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-area { margin-right: 0; }
  .sidebar-toggle { display: flex; }
  .charts-grid { grid-template-columns: 1fr; }

  /* Backdrop overlay when sidebar is open */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    -webkit-tap-highlight-color: transparent;
  }
  .sidebar-backdrop.active {
    display: block;
  }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .kpi-card__value { font-size: 1.3rem; }
  .page { padding: 1rem; }
  .topbar { padding: 0.6rem 1rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .jalali-picker { width: 100%; justify-content: space-between; }
  .jalali-picker select { flex: 1; min-width: 0; }
  .modal-content { padding: 1.25rem; max-height: 85vh; }
  .app-footer { padding: 1rem; font-size: 0.7rem; }
  .help-panel__body { padding: 0.75rem; }
  .about-card__row strong { display: block; min-width: auto; margin-bottom: 0.2rem; }
  .tooltip-anchor::after { right: auto; left: 0; }
  .help-container-topbar .help-panel { right: 0.5rem; left: 0.5rem; }

  /* Banner responsive - stacked cards */
  .welcome-banner { padding: 1rem; }
  .welcome-banner__headline { font-size: 0.92rem; }
  .welcome-banner__table-header,
  .welcome-banner__table-row {
    grid-template-columns: 1fr;
  }
  .welcome-banner__table-header .welcome-banner__col--ours {
    border-top: 1px solid var(--border-light);
  }
  .welcome-banner__table-row .welcome-banner__col--ours {
    border-top: 1px dashed var(--border-light);
    padding-top: 0.4rem;
  }
  .welcome-banner__table-row .welcome-banner__col--harris {
    padding-bottom: 0.2rem;
  }
  .welcome-banner__closing { font-size: 0.88rem; }
}

/* --- Inventory Module --- */
.inv-banner {
  margin-bottom: 1rem;
}

.inv-banner__toggle {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 1rem;
  font-family: var(--font-family);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.inv-banner__toggle:hover { border-color: var(--primary); color: var(--primary); }

.inv-banner__body {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.inv-banner__body p { margin: 0.3rem 0; }

.inv-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}

.inv-tab {
  padding: 0.6rem 1.25rem;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}

.inv-tab:hover { color: var(--text); }

.inv-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.inv-sub-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inv-sub-tab {
  padding: 0.4rem 0.9rem;
  font-family: var(--font-family);
  font-size: 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.inv-sub-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.inv-alerts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.inv-alert-card {
  background: #FDE8EB;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

[data-theme="dark"] .inv-alert-card {
  background: #3D1F25;
}

.inv-alert-card__name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
}

.inv-alert-card__qty {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.inv-form {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  max-width: 600px;
}

.inv-radio-group {
  display: flex;
  gap: 1.5rem;
  font-size: 0.88rem;
}

.inv-radio-group label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  color: var(--text);
}

.inv-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  max-height: 220px;
  overflow-y: auto;
}

.inv-dropdown__item {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 120ms;
  direction: rtl;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inv-dropdown__item:hover,
.inv-dropdown__item--active {
  background: var(--primary-light);
}

.inv-dropdown__item--active {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.inv-dropdown__code {
  font-family: monospace;
  direction: ltr;
  min-width: 5rem;
  display: inline-block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.inv-dropdown__name {
  flex: 1;
  font-weight: 500;
}

.inv-dropdown__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.inv-dropdown__empty {
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.inv-dropdown mark {
  background: var(--warning-light, #fff3cd);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Inline min_stock editor */
.inv-min-stock-cell {
  white-space: nowrap;
}

.inv-edit-min-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--text-muted);
  transition: color 120ms, background 120ms;
  vertical-align: middle;
}

.inv-edit-min-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.inv-min-stock-editor {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.inv-min-stock-input {
  width: 60px;
  padding: 2px 6px;
  font-size: 0.82rem;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  text-align: center;
  direction: ltr;
}

.inv-min-stock-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 67, 97, 238), 0.2);
}

.inv-min-stock-save,
.inv-min-stock-cancel {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1;
}

.inv-min-stock-save {
  color: var(--success);
}

.inv-min-stock-save:hover {
  background: var(--success-light, #d4edda);
}

.inv-min-stock-cancel {
  color: var(--danger);
}

.inv-min-stock-cancel:hover {
  background: var(--danger-light, #f8d7da);
}

/* Inventory deduction dialog */
.inv-deduct-dialog {
  background: var(--warning-light);
  border: 1.5px solid var(--warning);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
}

.inv-deduct-dialog__title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--warning);
  margin-bottom: 0.5rem;
}

.inv-deduct-dialog__info {
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.inv-deduct-dialog__actions {
  display: flex;
  gap: 0.75rem;
}

/* --- Room Selector Component --- */
.room-selector-wrap {
  margin-bottom: 1.25rem;
}

.room-selector-wrap .form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.room-selector {
  position: relative;
}

.room-search-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.95rem;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.room-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.room-search-input.rs-confirmed {
  border-color: var(--success);
  background: var(--success-light);
}

[data-theme="dark"] .room-search-input.rs-confirmed {
  background: #1B2E1D;
}

.room-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: 260px;
  overflow-y: auto;
}

.room-dropdown li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  direction: rtl;
  transition: background 120ms;
}

.room-dropdown li:hover,
.room-dropdown li.rs-active {
  background: var(--primary-light);
}

[data-theme="dark"] .room-dropdown li:hover,
[data-theme="dark"] .room-dropdown li.rs-active {
  background: var(--bg-secondary);
}

.rs-room-num {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 2.5rem;
  color: var(--text);
}

.rs-room-type {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}

.rs-room-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  white-space: nowrap;
}

.rs-room-status--ok { background: var(--success-light); color: var(--success); }
.rs-room-status--warn { background: var(--warning-light); color: var(--warning); }
.rs-room-status--bad { background: #FDE8EB; color: var(--danger); }

[data-theme="dark"] .rs-room-status--ok { background: #1B2E1D; color: #81C784; }
[data-theme="dark"] .rs-room-status--warn { background: #2E2517; color: #FFA726; }
[data-theme="dark"] .rs-room-status--bad { background: #3D1F25; color: #FF6B7A; }

/* --- Bale Settings Page --- */
.bale-settings-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  max-width: 600px;
}

.bale-settings-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
}

.bale-settings-row:last-child { border-bottom: none; }

.bale-settings-row--actions {
  padding-top: 1rem;
  border-bottom: none;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.bale-settings-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 130px;
  flex-shrink: 0;
}

.bale-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
  direction: ltr;
}

.bale-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.bale-input:disabled {
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
}

.bale-input-group {
  display: flex;
  gap: 0.4rem;
  flex: 1;
}

.bale-input-group .bale-input { flex: 1; }

.bale-settings-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.bale-settings-info {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border: 1px solid var(--border-light);
}

.bale-test-result {
  font-size: 0.8rem;
  margin-right: 0.75rem;
}

.bale-test-result--ok { color: var(--success); }
.bale-test-result--error { color: var(--danger); }

/* Toggle switch */
.bale-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.bale-toggle input { display: none; }

.bale-toggle__slider {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background var(--transition);
}

.bale-toggle__slider::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.bale-toggle input:checked + .bale-toggle__slider {
  background: var(--success);
}

.bale-toggle input:checked + .bale-toggle__slider::after {
  transform: translateX(-18px);
}

.bale-toggle__text {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

/* --- Connection Page Cards --- */
.connection-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: background-color var(--transition);
}

.connection-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.connection-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.connection-card__body {
  padding: 1rem 1.25rem;
}

.connection-card__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: var(--text);
}

.connection-card__row--error {
  color: var(--danger);
}

.connection-card__label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 100px;
}

.connection-card__mono {
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  direction: ltr;
}

.connection-card__sync-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

/* --- Print Styles --- */
@media print {
  * { box-shadow: none !important; text-shadow: none !important; }
  body { background: white !important; color: #000 !important; font-size: 11pt; direction: rtl; }

  .sidebar, .topbar, .filter-bar .btn, .btn-icon, .modal-overlay,
  #theme-toggle, #logout-btn, .refresh-indicator, .sidebar-toggle,
  .page-header .btn, .app-footer, .help-container, .tooltip-anchor { display: none !important; }

  .app-layout { display: block; }
  .main-area { margin-right: 0; }
  .topbar { display: none !important; }

  .page { display: block !important; padding: 0; }
  .page:not(.active) { display: none !important; }

  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
  .kpi-card { border: 1px solid #ddd; padding: 0.6rem; page-break-inside: avoid; }
  .kpi-card::before { background: #C8102E !important; }
  .kpi-card__value { color: #C8102E !important; font-size: 1.3rem; }
  .charts-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .chart-container, .table-container { border: 1px solid #ddd; page-break-inside: avoid; }
  .data-table th { background: #f5f5f5 !important; }
  .login-container { display: none !important; }
}


/* Guest name in rooms table */
.room-guest-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

.room-guest-empty {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ============================================================
   DASHBOARD ENHANCEMENTS — KPI status colors + sparklines
   ============================================================ */

/* KPI status color modifiers — override the left border */
.kpi-card--good::before  { background: var(--success) !important; }
.kpi-card--warn::before  { background: var(--warning) !important; }
.kpi-card--bad::before   { background: var(--danger)  !important; }
.kpi-card--neutral::before { background: var(--text-muted) !important; }

/* Status icon background tint */
.kpi-card--good  .kpi-card__icon { background: var(--success-light); }
.kpi-card--warn  .kpi-card__icon { background: var(--warning-light); }
.kpi-card--bad   .kpi-card__icon { background: #FDE8EB; }

/* Status indicator dot */
.kpi-card__status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.kpi-card--good  .kpi-card__status-dot { background: var(--success); }
.kpi-card--warn  .kpi-card__status-dot { background: var(--warning); }
.kpi-card--bad   .kpi-card__status-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(200,16,46,.15); }
.kpi-card--neutral .kpi-card__status-dot { background: var(--text-muted); }

/* KPI card footer row (sparkline + subtitle) */
.kpi-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.5rem;
}

/* Trend arrow badge */
.kpi-trend {
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 20px;
  margin-bottom: 0.15rem;
}
.kpi-trend--up   { background: var(--success-light); color: var(--success); }
.kpi-trend--down { background: #FDE8EB; color: var(--danger); }
.kpi-trend--flat { background: var(--bg-secondary); color: var(--text-muted); }

/* Sparkline SVG container */
.kpi-sparkline {
  flex-shrink: 0;
  opacity: 0.75;
  line-height: 0;
}

/* KPI value count-up animation */
.kpi-card__value {
  transition: color 0.3s ease;
}
.kpi-card__value.counting {
  color: var(--primary);
}

/* Dashboard status header strip */
.dash-status-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0.6rem 1.25rem;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.dash-status-header__pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dash-status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dash-status-pill--good    { background: var(--success-light); color: var(--success); }
.dash-status-pill--warn    { background: var(--warning-light); color: var(--warning); }
.dash-status-pill--bad     { background: #FDE8EB; color: var(--danger); }
.dash-status-pill--neutral { background: var(--bg-secondary); color: var(--text-secondary); }

[data-theme="dark"] .dash-status-header { box-shadow: none; }

/* ============================================================
   INVENTORY ENHANCEMENTS
   ============================================================ */

/* Filter toolbar in inventory dashboard tab */
.inv-filter-bar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.inv-filter-bar input[type="text"] {
  flex: 1;
  min-width: 140px;
  max-width: 260px;
  padding: 0.45rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.83rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}
.inv-filter-bar input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}
.inv-filter-bar select {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.83rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.inv-filter-bar .inv-filter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Inventory confirm box (before submit) */
.inv-confirm-box {
  background: var(--warning-light);
  border: 1.5px solid var(--warning);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}
.inv-confirm-box__title {
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}
.inv-confirm-box__summary {
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}
.inv-confirm-box__actions {
  display: flex;
  gap: 0.6rem;
}

/* Transaction type radio — styled pills */
.inv-type-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.inv-type-pill {
  display: none;
}
.inv-type-pill + label {
  padding: 0.35rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  user-select: none;
}
.inv-type-pill:checked + label {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.inv-type-pill[value="in"]:checked + label   { background: var(--success); border-color: var(--success); }
.inv-type-pill[value="out"]:checked + label  { background: var(--danger);  border-color: var(--danger); }
.inv-type-pill[value="reversal"]:checked + label { background: var(--warning); border-color: var(--warning); }

/* Report date range toolbar */
.inv-report-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.inv-report-toolbar label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.inv-report-toolbar input[type="date"] {
  padding: 0.35rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.8rem;
  background: var(--bg);
  color: var(--text);
  direction: ltr;
}
.inv-report-toolbar input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
}
.inv-export-btn {
  margin-right: auto;
  padding: 0.35rem 0.9rem;
  background: var(--success-light);
  color: var(--success);
  border: 1.5px solid var(--success);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.inv-export-btn:hover {
  background: var(--success);
  color: #fff;
}

/* Pagination */
.inv-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  margin-top: 0.5rem;
}
.inv-pagination__btn {
  padding: 0.3rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-family: var(--font-family);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
}
.inv-pagination__btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.inv-pagination__btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.inv-pagination__info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Alert card resolve button */
.inv-alert-card {
  position: relative;
}
.inv-alert-resolve-btn {
  margin-top: 0.4rem;
  padding: 0.2rem 0.6rem;
  background: none;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.72rem;
  color: var(--danger);
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}
.inv-alert-resolve-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* Stock table row highlight for low stock */
tr.inv-row--low td { background: rgba(200,16,46,0.04); }
[data-theme="dark"] tr.inv-row--low td { background: rgba(200,16,46,0.08); }

/* Ledger running balance column */
.inv-ledger-balance { font-weight: 700; }
.inv-ledger-balance--low { color: var(--danger); }


/* ============================================================
   Tickets & Events — Filter bars, detail modals, SLA, checklist
   ============================================================ */

/* Page-level filter bar (tickets + events) */
.page-filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.filter-select {
  height: 34px;
  padding: 0 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  font-size: 0.82rem;
  cursor: pointer;
  min-width: 130px;
  transition: border-color var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--primary); }

.filter-search {
  height: 34px;
  padding: 0 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  font-size: 0.82rem;
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  transition: border-color var(--transition);
}
.filter-search:focus { outline: none; border-color: var(--primary); }

/* Clickable table rows */
.data-table--clickable tbody tr { cursor: pointer; transition: background 120ms; }
.data-table--clickable tbody tr:hover td { background: var(--primary-light); }

/* Row highlights */
tr.row--critical td { background: rgba(200,16,46,0.04); }
[data-theme="dark"] tr.row--critical td { background: rgba(200,16,46,0.08); }
tr.row--sla-expired td { background: rgba(200,16,46,0.06); }
tr.row--blocking td { background: rgba(255,165,0,0.05); }

/* SLA badge in table */
.sla-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.sla-badge--sla-expired { background: rgba(200,16,46,0.12); color: var(--danger); }
.sla-badge--sla-critical { background: rgba(200,16,46,0.08); color: var(--danger); }
.sla-badge--sla-warn { background: rgba(255,165,0,0.12); color: var(--warning); }
.sla-badge--sla-ok { background: rgba(27,138,75,0.08); color: var(--success); }
.sla-badge--none { color: var(--text-muted); }

/* SLA bar at top of ticket detail modal */
.sla-bar {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sla-bar--sla-expired  { background: rgba(200,16,46,0.1); color: var(--danger); border: 1px solid rgba(200,16,46,0.2); }
.sla-bar--sla-critical { background: rgba(200,16,46,0.06); color: var(--danger); border: 1px solid rgba(200,16,46,0.15); }
.sla-bar--sla-warn     { background: rgba(255,165,0,0.08); color: var(--warning); border: 1px solid rgba(255,165,0,0.2); }
.sla-bar--sla-ok       { background: rgba(27,138,75,0.06); color: var(--success); border: 1px solid rgba(27,138,75,0.15); }

/* Detail modal wrapper */
.detail-modal { padding: 0.1rem; }

.detail-modal__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}
.detail-modal__header h3 { margin: 0; flex: 1; font-size: 1rem; }

/* Info grid (2-3 columns auto) */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  background: var(--bg-secondary);
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
}
.detail-grid__item label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
  font-weight: 500;
}
.detail-grid__item span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

/* Detail section (titled block) */
.detail-section { margin-bottom: 1.25rem; }
.detail-section__title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: 0.01em;
}

.detail-description {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}
.detail-description--secondary {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Actions timeline */
.actions-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.action-item {
  padding: 0.65rem 0.85rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border-right: 3px solid var(--primary);
}
.action-item__type {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.action-item__note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.2rem;
}
.action-item__next {
  font-size: 0.78rem;
  color: var(--primary);
  font-style: italic;
  margin-bottom: 0.2rem;
}
.action-item__meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Empty state small */
.empty-state--small {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  text-align: center;
  font-style: italic;
}

/* Inline modal actions row */
.modal-actions--inline {
  justify-content: flex-start;
  margin-top: 0.5rem;
  margin-bottom: 0;
  padding-top: 0;
  border-top: none;
}

/* Warning about blocking tickets */
.blocking-tickets-warning {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--warning);
  background: rgba(255,165,0,0.08);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,165,0,0.2);
}

/* Small table variant for modal */
.data-table--sm td,
.data-table--sm th {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
}

/* Checklist items display */
.checklist-group { margin-bottom: 0.75rem; }
.checklist-group__title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
.checklist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}
.checklist-item__label { color: var(--text); flex: 1; }
.checklist-item__result { font-weight: 600; font-size: 0.75rem; margin-right: 0.5rem; }

.result--ok         { background: rgba(27,138,75,0.06); }
.result--ok .checklist-item__result { color: var(--success); }
.result--fail       { background: rgba(200,16,46,0.06); }
.result--fail .checklist-item__result { color: var(--danger); }
.result--missing    { background: rgba(255,165,0,0.06); }
.result--missing .checklist-item__result { color: var(--warning); }
.result--consumed   { background: rgba(67,97,238,0.06); }
.result--consumed .checklist-item__result { color: var(--primary); }
.result--not_applicable { background: var(--bg-secondary); }
.result--not_applicable .checklist-item__result { color: var(--text-muted); }
