:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #172554;
  --accent-gold: #d97706;
  --accent-gold-light: #fef3c7;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f4f6f9;
  font-family: var(--font-family);
  color: #2b2c40;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ========================================================================= */
/* LEFT SIDEBAR NAVIGATION (THIẾT KẾ ĐỒNG BỘ 100% SỔ TAY TU DƯỠNG) */
/* ========================================================================= */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 1045;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

.sidebar-header {
  height: 60px;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1e293b;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  overflow: hidden;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-toggle-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.sidebar-nav-container::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav-container::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

/* ========================================================================= */
/* SIDEBAR NAVIGATION - GIAO DIỆN TƯƠI SÁNG, ĐỒNG BỘ SỔ TAY TU DƯỠNG */
/* ========================================================================= */
.sidebar-group-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 14px 4px;
  white-space: nowrap;
}

.sidebar-group-title.mt-2 {
  margin-top: 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #334155;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  margin-bottom: 3px;
  transition: all 0.18s ease;
  white-space: nowrap;
  cursor: pointer;
}

.sidebar-link .menu-icon,
.sidebar-link i {
  font-size: 1.12rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.sidebar-link:hover {
  background-color: #f8fafc;
  color: #6d28d9;
  transform: translateX(2px);
}

.sidebar-link:hover .menu-icon,
.sidebar-link:hover i {
  transform: scale(1.15);
}

/* Active Link State: Tươi sáng, nền lavender pastel sang trọng, chữ tím rực rỡ */
.sidebar-link.active,
a.sidebar-link.active,
.sidebar-link.view-tab-btn.active {
  background-color: #ede9fe !important;
  color: #6d28d9 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(109, 40, 217, 0.12) !important;
}

.sidebar-link.active .menu-icon,
.sidebar-link.active i,
a.sidebar-link.active .menu-icon,
a.sidebar-link.active i,
.sidebar-link.view-tab-btn.active .menu-icon,
.sidebar-link.view-tab-btn.active i {
  color: #6d28d9 !important;
}

/* Palette Màu Icon Tươi Sáng & Sống Động */
.icon-blue { color: #2563eb !important; }
.icon-green { color: #10b981 !important; }
.icon-amber { color: #f59e0b !important; }
.icon-orange { color: #ea580c !important; }
.icon-purple { color: #8b5cf6 !important; }
.icon-word-blue { color: #1d4ed8 !important; }
.icon-teal { color: #0d9488 !important; }
.icon-yellow { color: #eab308 !important; }
.icon-indigo { color: #6366f1 !important; }
.icon-cyan { color: #0284c7 !important; }
.icon-emerald { color: #059669 !important; }
.icon-rose { color: #f43f5e !important; }

/* Các Lớp Màu Text Chuẩn */
.text-primary { color: #2563eb !important; }
.text-success { color: #10b981 !important; }
.text-warning { color: #f59e0b !important; }
.text-info { color: #0284c7 !important; }
.text-danger { color: #ef4444 !important; }
.text-secondary { color: #64748b !important; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid #f1f5f9;
  background-color: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.avatar-box {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.sidebar-footer-text {
  overflow: hidden;
  line-height: 1.15;
}

.sidebar-user-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-user-role {
  font-size: 0.7rem;
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-dots-options {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-dots-options:hover {
  background: #e2e8f0;
  color: #334155;
}

/* Collapsed Sidebar on Desktop */
body.sidebar-collapsed .app-sidebar {
  width: 68px;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-group-title,
body.sidebar-collapsed .sidebar-link-text,
body.sidebar-collapsed .sidebar-footer-text,
body.sidebar-collapsed .sidebar-header #sidebarToggleBtn {
  display: none !important;
}

body.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 10px 0;
}

body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 9px 0;
}

body.sidebar-collapsed .sidebar-link i {
  margin: 0;
  font-size: 1.15rem;
}

body.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: 10px 0;
}

/* Main Content Wrapper */
.main-wrapper {
  margin-left: 250px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  background: #f4f6f9;
}

body.sidebar-collapsed .main-wrapper {
  margin-left: 68px;
}

/* Top Compact Bar */
.top-compact-bar {
  height: 48px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-top-toggle {
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-top-toggle.mobile-only-toggle {
  display: none !important;
}

.btn-top-toggle.desktop-only-toggle {
  display: flex !important;
}

@media (max-width: 991.98px) {
  .btn-top-toggle.mobile-only-toggle {
    display: flex !important;
  }
  .btn-top-toggle.desktop-only-toggle {
    display: none !important;
  }
}

.btn-top-toggle:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.top-bar-page-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.2px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-role-admin {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-role-guest {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #dbeafe;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
}

/* Main Content Header Bar */
.main-content-header-bar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.time-control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-nav-month {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-nav-month:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.current-month-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-select-month, .form-select-year {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  outline: none;
  cursor: pointer;
}

.form-select-month:focus, .form-select-year:focus {
  border-color: #673ab7;
}

.badge-canchi {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.2);
}

.legend-badges-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-legend {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}

.badge-dai-le { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.badge-trung-le { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-tieu-le { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-ky-niem { background: #f3e8ff; color: #7c3aed; border: 1px solid #e9d5ff; }
.badge-luc-trai { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-thap-trai { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

.main-body-container {
  padding: 20px;
  flex: 1;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: 260px !important;
  }
  .app-sidebar.show-mobile {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
    display: none;
  }
  .sidebar-backdrop.show-mobile {
    display: block;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .d-none-mobile {
    display: none !important;
  }
}

/* Table View Layout (Only Table View gets the 340px right stats sidebar!) */
.table-view-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1200px) {
  .table-view-layout {
    grid-template-columns: 1fr;
  }
}

.table-main-card {
  min-width: 0;
}

/* Year Overview Full Width Layout */
.year-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  width: 100%;
}

@media (max-width: 1100px) {
  .year-overview-grid {
    grid-template-columns: 1fr;
  }
}

.year-left-column, .year-right-column {
  min-width: 0;
  width: 100%;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  color: #ffffff;
  padding: 16px 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  border: 2px solid #facc15;
  overflow: hidden;
  padding: 2px;
}

.header-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.brand-text p {
  font-size: 12px;
  color: #cbd5e1;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.month-picker-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px 8px;
  gap: 8px;
}

.month-picker-group select {
  background: transparent;
  color: #ffffff;
  border: none;
  font-weight: 600;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.month-picker-group select option {
  color: #0f172a;
}

.can-chi-badge {
  background: #fef08a;
  color: #854d0e;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
}
.btn-primary:hover {
  background-color: #2563eb;
}

.btn-gold {
  background-color: #f59e0b;
  color: white;
}
.btn-gold:hover {
  background-color: #d97706;
}

.btn-success {
  background-color: #10b981;
  color: white;
}
.btn-success:hover {
  background-color: #059669;
}

.btn-outline {
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #334155;
}
.btn-secondary:hover {
  background-color: #cbd5e1;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Main Layout */
.main-container {
  max-width: 1600px;
  margin: 20px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

@media (max-width: 1200px) {
  .main-container {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fafaf9;
}

.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 16px;
}

/* Schedule Table */
.table-responsive {
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: center;
}

.schedule-table th {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 10px 8px;
  border: 1px solid #cbd5e1;
  text-transform: uppercase;
  font-size: 12px;
  white-space: nowrap;
}

.schedule-table td {
  padding: 8px 6px;
  border: 1px solid #cbd5e1;
  vertical-align: middle;
}

.schedule-table tr:hover {
  background-color: #f8fafc;
}

.schedule-table tr.row-special {
  background-color: #fffbeb;
}

.schedule-table tr.row-weekend {
  background-color: #f0fdf4;
}

.schedule-table tr.row-highlight {
  outline: 2px solid #3b82f6;
  background-color: #eff6ff !important;
}

/* Cell Drop Targets */
.role-cell {
  position: relative;
  min-width: 110px;
  min-height: 38px;
  padding: 4px !important;
  cursor: pointer;
  transition: background 0.15s;
}

.role-cell:hover {
  background-color: #e0f2fe;
}

.role-cell.drag-over {
  background-color: #bbf7d0 !important;
  outline: 2px dashed #16a34a;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  cursor: grab;
  transition: transform 0.1s, box-shadow 0.1s;
}

.member-chip:active {
  cursor: grabbing;
}

.member-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chip-chule {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.chip-chuong {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.chip-phach {
  background-color: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}

.chip-empty {
  color: #94a3b8;
  font-style: italic;
  font-size: 12px;
  border: 1px dashed #cbd5e1;
  padding: 4px 8px;
  border-radius: 6px;
}

.chip-remove-btn {
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}
.chip-remove-btn:hover {
  background-color: rgba(0,0,0,0.1);
  color: #dc2626;
}

.lunar-highlight {
  background-color: #fef08a;
  color: #854d0e;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.ghi-chu-input {
  width: 100%;
  border: 1px solid transparent;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  background: transparent;
  text-align: left;
}

.ghi-chu-input:focus, .ghi-chu-input:hover {
  background: #ffffff;
  border-color: #94a3b8;
  outline: none;
}

/* Auth & User Badges */
.auth-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

.guest-notice-bar {
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
  font-size: 12px;
  color: #475569;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guest-notice-bar strong {
  color: #1e3a8a;
}

/* Empty Schedule State */
.empty-schedule-banner {
  padding: 30px;
  text-align: center;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  margin: 20px;
}
.empty-schedule-banner h3 {
  font-size: 16px;
  color: #334155;
  margin-bottom: 8px;
}
.empty-schedule-banner p {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}

/* Ghi Chu & Companions Container */
.ghi-chu-cell-container {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
  text-align: left;
}

.companion-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.companion-tag .remove-tag {
  cursor: pointer;
  color: #0284c7;
  border-radius: 50%;
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.companion-tag .remove-tag:hover {
  background-color: #bae6fd;
  color: #b91c1c;
}

.btn-add-companion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 7px;
  background-color: #f1f5f9;
  border: 1px dashed #94a3b8;
  color: #334155;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-add-companion:hover {
  background-color: #e2e8f0;
  border-color: #3b82f6;
  color: #2563eb;
}

/* Gender Indicator & Warnings */
.gender-pill {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  margin-left: 2px;
}
.gender-huynh {
  background: #dbeafe;
  color: #1e40af;
}
.gender-ty {
  background: #fce7f3;
  color: #be185d;
}

.gender-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-top: 2px;
  animation: pulseWarning 1.5s infinite;
}

@keyframes pulseWarning {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.role-cell.cell-gender-mismatch {
  border: 2px solid #ef4444 !important;
  background-color: #fef2f2 !important;
}

/* Sidebar / Stats */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.stats-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.stats-item:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.stats-item.active-filter {
  background-color: #eff6ff;
  border-color: #3b82f6;
  font-weight: 700;
}

.stats-item .member-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-item .duty-badge {
  background-color: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
}

.stats-item.zero-duty {
  background-color: #fef2f2;
  border-color: #fecaca;
}
.stats-item.zero-duty .duty-badge {
  background-color: #fee2e2;
  color: #dc2626;
}

/* Draggable Palette */
.palette-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
  padding: 8px 2px;
}

.palette-item {
  padding: 5px 10px;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.palette-item:active {
  cursor: grabbing;
}

.palette-item:hover {
  background-color: #e2e8f0;
  border-color: #94a3b8;
}

.role-tag {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #cbd5e1;
  color: #334155;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

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

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #64748b;
  cursor: pointer;
}
.modal-close:hover {
  color: #0f172a;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background-color: #fafafa;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Tabs */
.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 8px;
}

.tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Form inputs */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: #334155;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.form-control:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease-out;
}

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

.toast.toast-success {
  background: #065f46;
  border-left: 4px solid #10b981;
}

.toast.toast-error {
  background: #881337;
  border-left: 4px solid #f43f5e;
}



/* View Switcher */
.view-switcher-container {
  max-width: 1600px;
  margin: 12px auto 0;
  padding: 0 20px;
}

.view-switcher-bar {
  display: flex;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  flex-wrap: wrap;
}

.view-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.view-tab-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.view-tabs-header .view-tab-btn.active,
button.view-tab-btn.active {
  background: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.2);
}

/* Calendar Grid View (Lịch Vạn Niên Lưới Tháng) */
.calendar-grid-container {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background-color: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8fafc;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid var(--border);
}

.calendar-grid-header div {
  padding: 10px 4px;
}

.calendar-grid-header div.sun-header {
  color: #dc2626;
}
.calendar-grid-header div.sat-header {
  color: #0284c7;
}

.calendar-grid-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background-color: var(--border);
}

.cal-day-cell {
  background: #ffffff;
  min-height: 140px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.cal-day-cell:hover {
  background: #f8fafc;
}

.cal-day-cell.day-other-month {
  background: #fafafa;
  opacity: 0.6;
}

.cal-day-cell.day-special {
  background: #fffdf5;
}

.cal-day-cell.day-chay {
  border-top: 3px solid #16a34a;
}

.cal-day-cell.day-levia {
  border-top: 3px solid #d97706;
}

.cal-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.cal-solar-num {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.cal-solar-num.is-sunday {
  color: #dc2626;
}

.cal-solar-num.is-saturday {
  color: #0284c7;
}

.cal-lunar-tag {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
}

.cal-lunar-tag.lunar-soc-vong {
  background: #fef08a;
  color: #854d0e;
}

.cal-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.badge-chay {
  font-size: 10px;
  background: #dcfce7;
  color: #15803d;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.badge-levia {
  font-size: 10px;
  background: #fef3c7;
  color: #b45309;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  line-height: 1.2;
}

.cal-duties-container {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  background: #f8fafc;
  border-radius: 4px;
  padding: 4px;
  border: 1px solid #e2e8f0;
}

.cal-duty-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cal-duty-item strong {
  font-weight: 600;
}

/* Day Bloc Detail View */
.day-bloc-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
}

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

.day-bloc-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  text-align: center;
}

.day-bloc-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  color: #ffffff;
  padding: 14px;
}

.day-bloc-header .bloc-month-year {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.day-bloc-body {
  padding: 24px;
}

.bloc-solar-big {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
  margin: 10px 0;
}

.bloc-solar-big.sun-day {
  color: #dc2626;
}

.bloc-day-name {
  font-size: 20px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.bloc-lunar-section {
  background: #fffbeb;
  border: 1px solid #fef08a;
  border-radius: 8px;
  padding: 12px;
  margin-top: 14px;
}

.bloc-lunar-title {
  font-size: 11px;
  color: #92400e;
  text-transform: uppercase;
  font-weight: 700;
}

.bloc-lunar-date {
  font-size: 24px;
  font-weight: 800;
  color: #b45309;
}

/* Lacquer Mount Bloc Style (Kế thừa từ Sổ Tay Tu Dưỡng) */
.day-bloc-card.lacquer-bloc {
  border: 4px solid #b45309;
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(0,0,0,0.18);
  position: relative;
}

.bloc-mount-header {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 50%, #7c2d12 100%);
  border-bottom: 3px solid #f59e0b;
  color: #ffffff;
  padding: 16px 12px 12px 12px;
  text-align: center;
  position: relative;
}

.brass-rings {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 8px;
}

.brass-ring {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fef08a 30%, #b45309 80%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  display: inline-block;
}

.bloc-logo-wrapper {
  margin: 0 auto 8px auto;
  width: 58px;
  height: 58px;
  background: #ffffff;
  border-radius: 50%;
  border: 2.5px solid #facc15;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
}

.bloc-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.org-title-sub {
  font-size: 11px;
  color: #fde68a;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.org-title-main {
  font-size: 13px;
  font-weight: 800;
  color: #fef08a;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 2px 0 6px 0;
  font-family: 'Times New Roman', serif;
}

.bloc-mount-header .bloc-month-year {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(254, 240, 138, 0.4);
  border-radius: 20px;
  display: inline-block;
  padding: 3px 14px;
  letter-spacing: 1px;
}

.bloc-watermark-svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 280px;
  pointer-events: none;
  opacity: 0.16;
  z-index: 0;
}

.bloc-front-content {
  position: relative;
  z-index: 1;
}

.bloc-full-solar {
  font-size: 13px;
  color: #475569;
  font-weight: 600;
}

.bloc-lunar-sub {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
}

.bloc-chay-box {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 700;
}

/* Thánh Ngôn / Thánh Giáo Card */
.thanh-giao-card {
  background: rgba(255, 251, 235, 0.95);
  border: 1px solid #fde68a;
  border-left: 5px solid #d97706;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.thanh-giao-header {
  font-weight: 700;
  color: #b45309;
  font-size: 14px;
  margin-bottom: 8px;
  font-family: 'Times New Roman', serif;
  display: flex;
  align-items: center;
  gap: 6px;
}

.thanh-giao-quote {
  font-size: 14px;
  line-height: 1.6;
  color: #1e293b;
  font-family: 'Times New Roman', serif;
  font-style: italic;
  white-space: pre-line;
  margin-bottom: 8px;
}

.thanh-giao-author {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  font-style: italic;
}

/* Level Badges for Le Via */
.badge-level-dai-le {
  background: #dc2626;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.badge-level-trung-le {
  background: #2563eb;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.badge-level-tieu-le {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.badge-level-ky-niem {
  background: #8b5cf6;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

/* Year Overview View */
.year-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1000px) {
  .year-overview-grid {
    grid-template-columns: 1fr;
  }
}

.levia-scroll-list {
  max-height: 600px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.levia-card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s;
}

.levia-card-item.is-major {
  background: #fffdf5;
  border-left: 4px solid #d97706;
}

.levia-card-item:hover {
  background: #f1f5f9;
}

.levia-date-badge {
  background: #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  min-width: 75px;
}

.levia-date-badge.major {
  background: #fef08a;
  color: #854d0e;
}

/* ========================================================================= */
/* Day Bloc Inner Elements (Đưa Ngày Ăn Chay, Lễ Vía, Thánh Giáo, Ban Trực vào Lịch Ngày) */
/* ========================================================================= */
.day-bloc-container {
  display: grid;
  grid-template-columns: minmax(380px, 480px) 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 950px) {
  .day-bloc-container {
    grid-template-columns: 1fr;
  }
}

.bloc-chay-in-card {
  margin-top: 12px;
}

.bloc-chay-notice-box {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1.5px solid #86efac;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.08);
}

.bloc-chay-title {
  color: #15803d;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bloc-chay-sub {
  color: #166534;
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

.bloc-chay-none {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 2px;
}

.bloc-levia-in-card {
  margin-top: 12px;
  background: rgba(254, 243, 199, 0.95);
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.bloc-sub-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-amber { color: #b45309; }
.text-blue { color: #1e3a8a; }

.bloc-levia-text {
  font-size: 13px;
  color: #78350f;
  line-height: 1.4;
}

.thanh-giao-card-in-bloc {
  margin-top: 12px;
  background: rgba(255, 251, 235, 0.95);
  border: 1px solid #fde68a;
  border-left: 5px solid #d97706;
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.bloc-duty-in-card {
  margin-top: 12px;
  background: rgba(248, 250, 252, 0.95);
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.bloc-duty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.bloc-duty-cell {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}

.bloc-duty-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.bloc-duty-name {
  font-size: 13px;
  font-weight: 800;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bloc-duty-cell-companions {
  grid-column: 1 / -1;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
  text-align: left;
}

/* Quick Month Jump Grid */
.bloc-quick-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.bloc-quick-day-btn {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  padding: 6px 2px;
  text-align: center;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bloc-quick-day-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
}

.bloc-quick-day-btn.active {
  background: #1e3a8a;
  color: #ffffff;
  border-color: #1e3a8a;
  font-weight: 700;
}

.bloc-quick-day-btn.is-chay {
  border-top: 2.5px solid #16a34a;
}

.bloc-quick-day-btn.is-levia {
  border-bottom: 2.5px solid #d97706;
}

/* Natural Language Rules Modal Styles */
.nl-input-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px;
}

.nl-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nl-chip {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.nl-chip:hover {
  background: #0284c7;
  color: #ffffff;
}

.nl-rules-scroll-area {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nl-rule-card-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background 0.15s;
}

.nl-rule-card-item:hover {
  background: #f8fafc;
}

.nl-rule-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.badge-tag-general { background: #e0e7ff; color: #3730a3; }
.badge-tag-special { background: #fef3c7; color: #92400e; }
.badge-tag-dow { background: #dbeafe; color: #1e40af; }
.badge-tag-group { background: #f3e8ff; color: #6b21a8; }
.badge-tag-custom { background: #f1f5f9; color: #475569; }

.btn-del-rule {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-del-rule:hover {
  background: #fee2e2;
}

/* ========================================================================= */
/* MOBILE BOTTOM NAVIGATION & PERFORMANCE STYLES (ĐỒNG BỘ SỔ TAY TU DƯỠNG) */
/* ========================================================================= */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  z-index: 1040;
  justify-content: space-around;
  align-items: stretch;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding: 2px 2px calc(2px + env(safe-area-inset-bottom, 0px)) 2px;
  transform: translateZ(0);
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #64748b;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 2px 0;
  transition: all 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-icon {
  font-size: 1.15rem;
  line-height: 1.2;
}

.mobile-nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
  color: #673ab7;
}

.mobile-nav-link.active .mobile-nav-icon {
  transform: scale(1.1);
  color: #673ab7;
}

/* Schedule View Mode Bar (Chuyển đổi Dạng Thẻ Ngày & Dạng Bảng) */
.schedule-view-mode-bar {
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.view-mode-buttons {
  display: inline-flex;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 8px;
}

.btn-mode-toggle {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-mode-toggle.active {
  background: #ffffff;
  color: #1e3a8a;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Mobile Day Cards Container */
.mobile-cards-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-day-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s;
  contain: content;
}

.mobile-day-card.special-day {
  border-left: 4px solid #f59e0b;
  background: #fffdf5;
}

.m-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e2e8f0;
}

.m-date-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.m-thu {
  font-weight: 800;
  font-size: 13px;
  color: #1e293b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.m-solar {
  font-weight: 700;
  font-size: 13px;
  color: #1e3a8a;
}

.m-lunar {
  font-size: 12px;
  color: #b45309;
  font-weight: 600;
}

.m-tags-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.m-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.m-tag-socvong { background: #fef08a; color: #854d0e; }
.m-tag-chay { background: #dcfce7; color: #166534; }
.m-tag-levia { background: #fef3c7; color: #92400e; }

.btn-m-reminder {
  border: none;
  background: #f1f5f9;
  color: #64748b;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Duty slots on mobile card */
.m-card-roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

@media (max-width: 480px) {
  .m-card-roles {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.m-role-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}

.m-role-box:active {
  background: #e2e8f0;
  transform: scale(0.98);
}

.m-role-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.m-role-name {
  font-size: 13px;
  font-weight: 800;
  margin-top: 3px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-role-empty {
  color: #94a3b8;
  font-style: italic;
  font-weight: 500;
}

.m-card-companions {
  background: #fafbfc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
}

.m-comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.btn-m-add-comp {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.m-comp-content {
  font-size: 12px;
  color: #334155;
  line-height: 1.4;
}

/* Quick Select Member Grid */
.quick-select-member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.btn-quick-member-chip {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.btn-quick-member-chip:hover, .btn-quick-member-chip:active {
  background: #f0ebf8;
  border-color: #673ab7;
  transform: scale(0.98);
}

.btn-quick-member-chip.mismatch-gender {
  opacity: 0.35;
  border-style: dashed;
}

/* Mobile Responsive Optimization */
@media (max-width: 991.98px) {
  .mobile-bottom-nav {
    display: flex;
  }
  .main-wrapper {
    padding-bottom: 70px;
  }
}

/* Email Tags Container in Reminder Modal */
.email-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.email-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.email-tag-chip:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.email-tag-chip .btn-remove-email {
  cursor: pointer;
  color: #94a3b8;
  font-weight: bold;
  font-size: 16px;
  border: none;
  background: transparent;
  padding: 0 2px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.email-tag-chip .btn-remove-email:hover {
  color: #ef4444;
}

.email-empty-hint {
  color: #94a3b8;
  font-size: 12px;
  font-style: italic;
  display: flex;
  align-items: center;
  padding: 4px;
}

