/* Styling for Red Aborta Libre Chiapas System - PROFESSIONAL ENTERPRISE DESIGN */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #8e2f89;
  --primary-hover: #73256e;
  --bg-color: #f8fafc;
  --panel-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --accent-purple: #8e2f89; /* Morado Principal */
  --accent-purple-light: rgba(142, 47, 137, 0.08);
  --accent-pink: #d72b68; /* Rosa Mexicano */
  --accent-green: #059443; /* Verde Principal */
  --accent-light-green: #8fc044; /* Verde Limón */
  
  --success: #059443;
  --warning: #d97706;
  --danger: #d72b68;
  
  --font-title: 'Montserrat', sans-serif;
  --font-body: 'Montserrat', sans-serif;

  --radius-card: 12px;
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  box-sizing: border-box;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(142, 47, 137, 0.2) transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Panel utility */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
}

.glass-panel:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-hover);
}

/* Hide legacy header */
header:not(.top-header) { display: none !important; }

/* Dashboard Top Header Bar */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
}

.top-header-title h2 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-purple);
  letter-spacing: -0.01em;
}

.top-header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* PWA Connection Status Badge */
.pwa-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: #ffffff;
  box-shadow: var(--shadow-card);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pwa-badge.online {
  background: #f0fdf4;
  color: var(--accent-green);
  border-color: #bbf7d0;
}

.pwa-badge.online .status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(5, 148, 67, 0.6);
}

.pwa-badge.offline {
  background: #fff1f2;
  color: var(--danger);
  border-color: #fecdd3;
}

.pwa-badge.offline .status-dot {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(215, 43, 104, 0.6);
}

/* Button System */
.btn {
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-purple);
  color: #ffffff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
  background: #73256e;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(142, 47, 137, 0.2);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--accent-purple);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #b52256;
  transform: translateY(-1px);
}

.btn-danger-soft {
  background: rgba(215, 43, 104, 0.08);
  color: var(--danger);
  border: 1px solid rgba(215, 43, 104, 0.25);
}

.btn-danger-soft:hover {
  background: rgba(215, 43, 104, 0.16);
  color: #b52256;
  border-color: rgba(215, 43, 104, 0.4);
}

/* Login Screen Layout */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  width: 100%;
}

.login-card {
  width: 100%;
  max-width: 410px;
  padding: 2.75rem 2.25rem;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

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

.login-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.login-header h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  color: var(--accent-purple);
  letter-spacing: -0.01em;
}

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

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

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.form-control, .form-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

select.form-control, select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e2f89' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
  padding-right: 2.5rem;
}

.form-control:focus, .form-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(142, 47, 137, 0.12);
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.75rem;
}

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

/* Bitácora Timeline Column (Sticky & Full-Height Expansion) */
.bitacora-timeline-panel {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
}

@media (max-width: 900px) {
  .bitacora-timeline-panel {
    position: static;
    max-height: none;
  }
  #case-events-timeline {
    max-height: 520px !important;
    min-height: auto !important;
  }
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.section-title i, .section-title svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 2.25px;
  color: var(--accent-purple);
}

.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.panel-body {
  padding: 1.5rem;
}

/* Cases Directory & Lists */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.list-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateX(3px);
}

.item-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.item-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--accent-purple);
}

.item-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Badges */
.badge {
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge-active {
  background: #f0fdf4;
  color: var(--accent-green);
  border: 1px solid #bbf7d0;
}

.badge-concluded {
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid #e2e8f0;
}

/* Detail Cards */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-card {
  padding: 1rem 1.15rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.detail-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Bitacora Timeline */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border-color);
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.timeline-event {
  position: relative;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--accent-purple);
}

.event-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.event-type {
  font-weight: 700;
  color: var(--accent-purple);
  background: #f1f5f9;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.event-notes {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Exception Panel Cards - Enterprise Financial Theme */
.exception-card {
  padding: 1.15rem 1.35rem;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--text-secondary);
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.exception-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.06);
}

.exception-card.severity-high {
  border-left-color: #be123c; /* Coral sobrio */
}

.exception-card.severity-medium {
  border-left-color: #d97706; /* Ámbar cálido */
}

.exception-card.severity-low {
  border-left-color: #2563eb; /* Azul cobalto sutil */
}

.ex-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  align-items: center;
}

.ex-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ex-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.75rem;
}

.ex-severity {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.ex-high { background: #ffe4e6; color: #be123c; border: 1px solid #fecdd3; }
.ex-medium { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.ex-low { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* QR Scanner Container */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.qr-code-display {
  background: white;
  padding: 0.75rem;
  border-radius: 8px;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.35rem;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent-purple); }

/* Table Component */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

th {
  background: #f8fafc;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #f8fafc;
}

.stock-num {
  font-family: var(--font-title);
  font-weight: 700;
}

/* SIDEBAR LAYOUT */
.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  background-color: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0.85rem;
  z-index: 50;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.25s cubic-bezier(0.16, 1, 0.3, 1), padding 0.25s ease;
  position: relative;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.02);
}

.sidebar.collapsed {
  width: 74px;
  min-width: 74px;
  padding: 1.25rem 0.45rem;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  padding: 0.25rem 0 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  transition: all 0.25s ease;
}

.sidebar-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.25rem 0;
  overflow: hidden;
}

/* El logo de la red más abierto y espacioso cuando el menú está abierto */
.sidebar-logo-img {
  height: 80px;
  max-height: 90px;
  width: auto;
  max-width: 88%;
  object-fit: contain;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.collapsed .sidebar-logo-img {
  height: 38px;
  max-height: 38px;
  max-width: 38px;
}

.sidebar.collapsed .sidebar-header {
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
}

/* Header Integrated Sidebar Toggle Button */
.header-sidebar-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.header-sidebar-toggle-btn:hover {
  background: #fafafc;
  color: var(--accent-purple);
  border-color: rgba(142, 47, 137, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(142, 47, 137, 0.12);
}

.header-sidebar-toggle-btn:active {
  transform: translateY(0);
}

/* Sidebar Internal Collapse Item (Footer Action) */
.sidebar-collapse-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  background: #fafafc;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-collapse-item-btn:hover {
  background: rgba(142, 47, 137, 0.06);
  color: var(--accent-purple);
  border-color: rgba(142, 47, 137, 0.2);
}

.sidebar.collapsed .sidebar-collapse-item-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  margin: 0 auto 0.75rem auto;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
}

.sidebar.collapsed .sidebar-collapse-item-btn:hover {
  background: rgba(142, 47, 137, 0.1);
  color: var(--accent-purple);
  border-color: rgba(142, 47, 137, 0.3);
}

.sidebar.collapsed .sidebar-collapse-item-text {
  display: none !important;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav .role-tab {
  text-align: left;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  white-space: nowrap;
}

.sidebar-nav .role-tab:hover {
  background-color: #f1f5f9;
  color: var(--accent-purple);
  transform: translateX(2px);
}

.sidebar-nav .role-tab.active {
  background-color: rgba(142, 47, 137, 0.08);
  color: var(--accent-purple);
  border: 1px solid rgba(142, 47, 137, 0.15);
  font-weight: 700;
}

.sidebar-nav .role-tab .tab-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.25px;
  flex-shrink: 0;
}

/* Collapsed styles for role tabs */
.sidebar.collapsed .sidebar-nav .role-tab {
  justify-content: center;
  padding: 0.75rem 0.4rem;
  gap: 0;
}

.sidebar.collapsed .sidebar-nav .role-tab:hover {
  transform: none;
}

.sidebar.collapsed .sidebar-nav .role-tab .tab-label {
  display: none !important;
}

.sidebar.collapsed .sidebar-nav .role-tab .tab-icon {
  margin-right: 0 !important;
}

/* Collapsed styles for footer */
.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  transition: all 0.25s ease;
}

.sidebar.collapsed .sidebar-footer .user-profile-info {
  display: none !important;
}

.sidebar.collapsed .sidebar-footer .user-profile-btn {
  padding: 0.3rem !important;
  border: none !important;
  background: transparent !important;
  align-items: center !important;
}

.sidebar.collapsed .sidebar-footer .logout-label {
  display: none !important;
}

.sidebar.collapsed .sidebar-footer .logout-sidebar-btn {
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.user-profile-btn {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  border-radius: 10px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

main {
  padding: 2rem 2.5rem !important;
  max-width: 1350px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.role-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.role-panel > * {
  min-width: 0;
  max-width: 100%;
}

#panel-inventory.dashboard-grid {
  grid-template-columns: 1fr;
}

/* Searchable Combobox Component */
.combobox-container {
  position: relative;
  width: 100%;
}

.combobox-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary, #64748b);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.combobox-toggle-btn:hover {
  color: var(--primary, #8e2f89);
  background: rgba(142, 47, 137, 0.08);
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  z-index: 9999;
  padding: 0.25rem 0;
}

.combobox-group-label {
  padding: 0.5rem 0.75rem 0.25rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-purple, #8e2f89);
  letter-spacing: 0.05em;
  background: rgba(142, 47, 137, 0.04);
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  user-select: none;
}
.combobox-group-label:first-child {
  border-top: none;
}

.combobox-item {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-primary, #1e293b);
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.combobox-item:hover, .combobox-item.active {
  background: rgba(142, 47, 137, 0.08);
  color: var(--accent-purple, #8e2f89);
  font-weight: 600;
}

.combobox-item .combobox-tag {
  font-size: 0.72rem;
  color: var(--text-secondary, #64748b);
  font-weight: 500;
}

.combobox-no-results {
  padding: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-secondary, #64748b);
  text-align: center;
  font-style: italic;
}

/* Subnav / Submenus Component for Inventory and Finance */
.inventory-subnav-container, .finance-subnav-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color, #e2e8f0);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.subnav-tab {
  background: transparent;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subnav-tab:hover {
  background-color: rgba(142, 47, 137, 0.05);
  color: var(--accent-purple, #8e2f89);
  border-color: var(--accent-purple, #8e2f89);
}

.subnav-tab.active {
  background-color: var(--accent-purple, #8e2f89);
  color: #ffffff;
  border-color: var(--accent-purple, #8e2f89);
  box-shadow: 0 2px 8px rgba(142, 47, 137, 0.25);
}

.subnav-tab.active .badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

/* Modal System */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.btn-close:hover {
  color: var(--text-primary);
  background: #f1f5f9;
}

/* =========================================
   MODERN STAFF PICKER (ACOMPAÑANTAS)
   ========================================= */
.staff-picker-group {
  position: relative;
  width: 100%;
}

.staff-picker-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: #ffffff;
  border: 1.5px solid var(--border-color, #cbd5e1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.staff-picker-trigger:hover,
.staff-picker-trigger:focus {
  border-color: var(--primary, #8e2f89);
  box-shadow: 0 0 0 3px rgba(142, 47, 137, 0.12);
  outline: none;
}

.staff-trigger-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.staff-trigger-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.staff-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  background-size: cover;
  background-position: center;
  position: relative;
}

.staff-avatar-status {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.staff-avatar-status.status-avail { background: #10b981; }
.staff-avatar-status.status-limited { background: #f59e0b; }
.staff-avatar-status.status-paused { background: #94a3b8; }

.staff-trigger-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.staff-trigger-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.staff-trigger-desc {
  font-size: 0.72rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 12px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.05);
  z-index: 9999;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.15s ease-out;
}

.staff-dropdown-search-box {
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.staff-filter-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.staff-filter-tab {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.staff-filter-tab:hover {
  background: #f1f5f9;
}

.staff-filter-tab.active {
  background: var(--primary, #8e2f89);
  color: #ffffff;
  border-color: var(--primary, #8e2f89);
}

.staff-dropdown-divider {
  padding: 0.35rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-purple, #8e2f89);
  letter-spacing: 0.05em;
  background: rgba(142, 47, 137, 0.04);
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  user-select: none;
}

.staff-picker-list {
  overflow-y: auto;
  max-height: 250px;
  padding: 0.35rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.staff-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}

.staff-picker-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.staff-picker-item.active {
  background: rgba(142, 47, 137, 0.08);
  border-color: rgba(142, 47, 137, 0.3);
}

.staff-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.staff-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.staff-item-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.staff-code-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  background: rgba(142, 47, 137, 0.12);
  color: var(--accent-purple, #8e2f89);
}

.staff-item-details {
  font-size: 0.72rem;
  color: var(--text-secondary, #64748b);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.staff-workload-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.workload-free {
  background: #ecfdf5;
  color: #047857;
}

.workload-moderate {
  background: #f5f3ff;
  color: #6d28d9;
}

.workload-busy {
  background: #fffbeb;
  color: #b45309;
}

.workload-paused {
  background: #f1f5f9;
  color: #64748b;
}

/* Directory Modal Card Grid */
.staff-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.staff-card {
  background: #ffffff;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all 0.2s ease;
  position: relative;
}

.staff-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary, #8e2f89);
  box-shadow: 0 8px 16px -2px rgba(142, 47, 137, 0.1);
}

/* =========================================
   ASIGNADORA SUBNAV & STATUS FILTER TABS
   ========================================= */
.assigner-subnav-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color, #e2e8f0);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.assigner-subpanel {
  width: 100%;
  animation: modalFadeIn 0.2s ease-out;
}

/* Status Filter Tabs (Activos / Todos / Concluidos) con contraste óptimo */
.case-status-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 20px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.case-status-tab:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.case-status-tab.active {
  background: #8e2f89 !important;
  color: #ffffff !important;
  border-color: #8e2f89 !important;
  box-shadow: 0 2px 8px rgba(142, 47, 137, 0.35);
  font-weight: 700;
}

.case-status-tab.active span,
.case-status-tab.active strong {
  color: #ffffff !important;
}

/* =========================================
   MODERN CASE PICKER (ATENCIÓN / ACOMPAÑANTA)
   ========================================= */
.case-picker-group {
  position: relative;
  width: 100%;
}

.case-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.95rem;
  background: #ffffff;
  border: 1.5px solid var(--border-color, #cbd5e1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  gap: 0.65rem;
}

.case-picker-trigger:hover {
  border-color: var(--primary, #8e2f89);
  background: #fdf6fd;
  box-shadow: 0 4px 14px rgba(142, 47, 137, 0.08);
}

.case-picker-trigger:focus-visible {
  outline: none;
  border-color: var(--primary, #8e2f89);
  box-shadow: 0 0 0 3px rgba(142, 47, 137, 0.15);
}

.case-trigger-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.case-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.case-trigger-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.case-trigger-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.case-trigger-desc {
  font-size: 0.73rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-trigger-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.case-picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 12px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.05);
  z-index: 9999;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.15s ease-out;
}

.case-dropdown-search-box {
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.case-filter-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.case-filter-tab {
  padding: 0.22rem 0.6rem;
  font-size: 0.73rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.case-filter-tab:hover {
  background: #f1f5f9;
}

.case-filter-tab.active {
  background: var(--primary, #8e2f89);
  color: #ffffff;
  border-color: var(--primary, #8e2f89);
}

.case-picker-list {
  overflow-y: auto;
  max-height: 270px;
  padding: 0.35rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.case-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}

.case-picker-item:hover {
  background: #fdf4fd;
  border-color: rgba(142, 47, 137, 0.2);
}

.case-picker-item.active {
  background: rgba(142, 47, 137, 0.1);
  border-color: rgba(142, 47, 137, 0.35);
}

.case-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.case-quick-pill:hover {
  border-color: var(--primary, #8e2f89);
  background: #faf5fa;
  color: var(--primary, #8e2f89);
}

.case-quick-pill.active {
  background: var(--primary, #8e2f89);
  color: #ffffff;
  border-color: var(--primary, #8e2f89);
}

/* ==========================================================================
   MODERN DASHBOARD & REPORTS (KPI Cards & Charts Grid)
   ========================================================================== */

.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.kpi-card-modern {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  padding: 1.25rem 1.25rem 1.15rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 12px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

.kpi-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-icon-bubble {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.kpi-card-modern:hover .kpi-icon-bubble {
  transform: scale(1.06);
}

.kpi-badge-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.kpi-card-body {
  display: flex;
  flex-direction: column;
}

.kpi-card-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum";
}

.kpi-card-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.35rem;
}

.kpi-card-sublabel {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 0.15rem;
}

.reports-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .reports-charts-grid {
    grid-template-columns: 1fr;
  }
}

/* ================= ADMIN MODERN UI ================= */
.admin-role-chip {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  cursor: pointer;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  background: #ffffff;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.admin-role-chip:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.admin-role-chip:has(input:checked) {
  border-color: var(--accent-purple);
  background: rgba(142, 47, 137, 0.04);
  box-shadow: 0 3px 10px rgba(142, 47, 137, 0.1);
}

.admin-role-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  padding: 1.25rem 1.25rem 1.15rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 12px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

.admin-role-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

/* ================= NOTIFICATIONS BELL & DROPDOWN ================= */
.notifications-bell-container {
  position: relative;
  display: inline-block;
}

.notifications-bell-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
}

.notifications-bell-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.notifications-count-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #e11d48;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(225, 29, 72, 0.35);
  animation: badgePop 0.25s ease-out;
}

@keyframes badgePop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 2rem);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
  z-index: 1000;
  overflow: hidden;
  animation: notifSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 640px) {
  .notifications-dropdown {
    position: fixed;
    top: 70px;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: calc(100vw - 2rem);
    z-index: 1200;
  }
}

@keyframes notifSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notifications-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  background: #fafafc;
}

.notifications-pill-tag {
  background: rgba(142, 47, 137, 0.08);
  color: var(--accent-purple);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
}

.notifications-list {
  max-height: 400px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notification-item {
  display: flex;
  gap: 0.8rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.15s ease;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background-color: #f8fafc;
}

.notification-item.unread {
  background-color: rgba(142, 47, 137, 0.035);
}

.notification-item.unread:hover {
  background-color: rgba(142, 47, 137, 0.065);
}

.notification-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon-wrap.case_assigned,
.notification-icon-wrap.case_reassigned {
  background: rgba(142, 47, 137, 0.1);
  color: var(--accent-purple);
}

.notification-icon-wrap.general {
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
}

.notification-icon-wrap.system {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.notification-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.notification-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-purple);
  flex-shrink: 0;
}

.notification-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.notification-meta {
  font-size: 0.7rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Filter tabs row in notification dropdown */
.notifications-filters-row {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
}

.notif-filter-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.notif-filter-tab:hover {
  color: var(--text-primary);
}

.notif-filter-tab.active {
  background: #ffffff;
  color: var(--accent-purple);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Notification item enhancements */
.notif-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.notif-item-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.4;
}

.notif-item-tag.case_assigned,
.notif-item-tag.case_reassigned {
  background: rgba(142, 47, 137, 0.1);
  color: var(--accent-purple);
}

.notif-item-tag.general {
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
}

.notif-item-tag.system {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.notif-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.45rem;
  padding-top: 0.35rem;
  border-top: 1px dashed #f1f5f9;
}

.notif-action-pill-btn {
  background: none;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.69rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.notif-action-pill-btn:hover {
  background: #f8fafc;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.notif-action-pill-btn.read-toggle {
  color: var(--accent-purple);
  border-color: rgba(142, 47, 137, 0.25);
  background: rgba(142, 47, 137, 0.04);
}

.notif-action-pill-btn.read-toggle:hover {
  background: rgba(142, 47, 137, 0.12);
}

/* ================= HELP & DOCUMENTATION HUB ================= */
.help-search-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.help-search-box {
  position: relative;
  width: 100%;
}

.help-search-box input {
  padding-left: 2.75rem;
  border-radius: 12px;
  font-size: 0.92rem;
  height: 46px;
  border: 1.5px solid var(--border-color);
  background: #ffffff;
  transition: all 0.2s ease;
  width: 100%;
}

.help-search-box input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(142, 47, 137, 0.1);
  outline: none;
}

.help-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.help-category-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.help-category-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.help-category-pill:hover {
  background: #f8fafc;
  color: var(--accent-purple);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.help-category-pill.active {
  background: rgba(142, 47, 137, 0.1);
  color: var(--accent-purple);
  border-color: var(--accent-purple);
  font-weight: 700;
}

.help-accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  margin-bottom: 0.85rem;
}

.help-accordion-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.help-accordion-trigger {
  width: 100%;
  padding: 1.15rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafc;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.help-accordion-trigger:hover {
  background: #f1f5f9;
}

.help-accordion-content {
  padding: 1.5rem 1.5rem 1.75rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.help-badge-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  font-family: monospace;
}

.help-callout-box {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin: 1rem 0;
  font-size: 0.85rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  line-height: 1.5;
}

.help-callout-info {
  background: rgba(14, 165, 233, 0.07);
  border: 1px solid rgba(14, 165, 233, 0.2);
  color: #0369a1;
}

.help-callout-warning {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #b45309;
}

.help-callout-danger {
  background: rgba(225, 29, 72, 0.07);
  border: 1px solid rgba(225, 29, 72, 0.2);
  color: #be123c;
}

.help-callout-success {
  background: rgba(34, 197, 94, 0.07);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #15803d;
}

.help-step-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 1rem 0;
}

.help-step-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.help-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(142, 47, 137, 0.1);
  color: var(--accent-purple);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Bitácora Event Form Insumo Counters and Multi-site generator */
.btn-counter {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 4px;
  font-weight: 700;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-counter:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.multi-site-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.multi-site-row select {
  font-size: 0.78rem;
}

.multi-site-row input[type="number"] {
  font-size: 0.78rem;
  text-align: center;
}

/* =========================================================
   RESPONSIVE DESIGN & MOBILE DRAWER (SMARTPHONES & TABLETS)
   ========================================================= */

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1045;
  transition: opacity 0.25s ease;
}

.sidebar-mobile-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-secondary);
  cursor: pointer;
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  transition: all 0.15s ease;
  z-index: 10;
}

.sidebar-mobile-close-btn:hover {
  background: #f1f5f9;
  color: var(--accent-purple);
}

@media (max-width: 768px) {
  /* Layout: Stack vertically and eliminate 100vw unit bugs */
  .app-layout {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
  }

  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
  }

  main {
    padding: 0.75rem 0.65rem 4rem 0.65rem !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Sidebar transforms into an Off-Canvas Drawer */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 285px !important;
    min-width: 285px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1050 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease !important;
    box-shadow: none !important;
    overflow-y: auto !important;
    padding: 1.25rem 0.85rem !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.35) !important;
  }

  .sidebar-backdrop.active {
    display: block !important;
  }

  .sidebar-mobile-close-btn {
    display: flex !important;
  }

  /* When on mobile, cancel desktop collapse mini-mode */
  .sidebar.collapsed {
    width: 285px !important;
    min-width: 285px !important;
    padding: 1.25rem 0.85rem !important;
  }

  .sidebar.collapsed .sidebar-header {
    margin-bottom: 1.5rem !important;
    padding-bottom: 1.25rem !important;
  }

  .sidebar.collapsed .sidebar-logo-img {
    height: 70px !important;
    max-height: 70px !important;
    max-width: 85% !important;
  }

  .sidebar.collapsed .tab-label,
  .sidebar.collapsed .sidebar-collapse-item-text,
  .sidebar.collapsed .user-profile-info,
  .sidebar.collapsed .logout-label {
    display: inline !important;
  }

  .sidebar.collapsed .sidebar-nav .role-tab {
    justify-content: flex-start !important;
    padding: 0.65rem 0.85rem !important;
  }

  .sidebar-collapse-item-btn {
    display: none !important;
  }

  /* Top Header compact styling */
  .top-header {
    padding: 0.5rem 0 !important;
    margin-bottom: 0.75rem !important;
    gap: 0.5rem !important;
  }

  .top-header-subtitle {
    display: none !important;
  }

  .top-header-title h2 {
    font-size: 1.15rem !important;
    margin: 0 !important;
  }

  .top-header-right {
    gap: 0.45rem !important;
  }

  .pwa-badge {
    padding: 0.3rem 0.5rem !important;
    font-size: 0.72rem !important;
  }

  .pwa-badge #connection-text {
    display: none !important;
  }

  #user-header-profile {
    padding: 0.25rem 0.45rem !important;
    gap: 0.3rem !important;
  }

  #user-header-name {
    display: none !important;
  }

  /* Critical: Neutralize CSS Grid track blowout and horizontal overflow */
  .role-panel,
  #panel-assigner,
  #panel-attending,
  #panel-inventory,
  #panel-finance,
  #panel-reports,
  #panel-admin,
  #panel-help {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .role-panel > *,
  .assigner-subpanel,
  .assigner-subnav-container,
  .inventory-subnav-container,
  .finance-subnav-container,
  .glass-panel,
  .panel-body,
  form,
  .form-group,
  .combobox-container,
  .staff-picker-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Subnav Bars horizontal scroll without expanding document width */
  .assigner-subnav-container,
  .inventory-subnav-container,
  .finance-subnav-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    margin-bottom: 0.85rem !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .assigner-subnav-container > div:first-child,
  .inventory-subnav-container,
  .finance-subnav-container {
    display: flex !important;
    gap: 0.45rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex-wrap: nowrap !important;
    padding-bottom: 6px !important;
    scrollbar-width: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .assigner-subnav-container > div:first-child::-webkit-scrollbar,
  .inventory-subnav-container::-webkit-scrollbar,
  .finance-subnav-container::-webkit-scrollbar {
    display: none !important;
  }

  .subnav-tab {
    flex-shrink: 0 !important;
    padding: 0.45rem 0.75rem !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
  }

  #assigner-view-stacked-toggle {
    width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* Cards strictly contained within phone screen */
  .glass-panel {
    border-radius: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .panel-header {
    padding: 0.75rem 0.85rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .panel-body {
    padding: 0.85rem 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Interactive Staff Picker mobile refinement */
  .staff-picker-trigger {
    padding: 0.55rem 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    gap: 0.5rem !important;
  }

  .staff-trigger-left {
    min-width: 0 !important;
    flex: 1 !important;
    gap: 0.6rem !important;
  }

  .staff-trigger-info {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .staff-trigger-title {
    font-size: 0.84rem !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    word-break: break-word !important;
  }

  .staff-trigger-desc {
    display: none !important;
  }

  .staff-trigger-right {
    flex-shrink: 0 !important;
    gap: 0.35rem !important;
  }

  .staff-trigger-right .badge {
    display: none !important;
  }

  .staff-picker-dropdown {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    box-sizing: border-box !important;
  }

  /* Form controls and inputs */
  .form-control, .form-input, input, select, textarea {
    font-size: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  input[type="file"].form-control {
    padding: 0.45rem 0.65rem !important;
    font-size: 0.8rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .combobox-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .combobox-dropdown {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Form layouts: 2-column or inline grids switch to single-column */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: repeat(2, 1fr)"],
  [style*="grid-template-columns: 2fr 1fr 1.2fr auto"] {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  /* Full-width responsive submit button */
  #create-case-btn,
  .btn-submit-mobile {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    justify-content: center !important;
    white-space: normal !important;
    text-align: center !important;
    min-height: 46px !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
  }

  /* Form footer shortcut */
  .form-footer-shortcut {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    text-align: center !important;
  }

  .form-footer-shortcut button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* List items wrap cleanly */
  .list-item {
    padding: 0.75rem 0.85rem !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  /* Login card responsiveness */
  .login-card {
    padding: 1.75rem 1.25rem !important;
    margin: 0.5rem !important;
    border-radius: 14px !important;
    width: 100% !important;
    max-width: 95% !important;
  }

  /* Availability banner */
  #attending-availability-banner {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #attending-availability-banner button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Modals on mobile */
  .modal-backdrop {
    padding: 0.5rem !important;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 14px !important;
    margin: 0.25rem !important;
    box-sizing: border-box !important;
  }
}






