/* =========================================================
   青年高級中學 - 校內留校登記申請與安全管理系統
   Modern Campus Administrative Web Stylesheet
   ========================================================= */

:root {
  --primary-50: #fff7ed;
  --primary-100: #ffedd5;
  --primary-200: #fed7aa;
  --primary-300: #fdba74;
  --primary-400: #fb923c;
  --primary-500: #f97316;
  --primary-600: #ea580c;
  --primary-700: #c2410c;
  --primary-800: #9a3412;
  --primary-900: #7c2d12;
  
  --secondary-50: #f0fdf4;
  --secondary-500: #22c55e;
  --secondary-600: #16a34a;
  
  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background-color: #f1f5f9;
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* Header & Top Bar */
.top-header {
  background: linear-gradient(135deg, #9a3412 0%, #c2410c 45%, #ea580c 100%);
  color: #ffffff;
  padding: 0.9rem 1.5rem;
  box-shadow: 0 4px 14px rgba(154, 52, 18, 0.22);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.school-logo-badge {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  flex-shrink: 0;
}

.school-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.82);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.role-switch-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.role-select {
  background: #ffffff;
  color: var(--gray-800);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.btn-role-matrix {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  border-radius: 20px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-role-matrix:hover {
  background: rgba(255, 255, 255, 0.3);
}

.role-banner {
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  padding: 0.45rem 1.5rem;
  font-size: 0.84rem;
  color: #9a3412;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.03);
}

.current-time-badge {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.time-pulse {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Nav Tabs */
.nav-tab-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 76px;
  z-index: 40;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.nav-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-tab-btn {
  background: none;
  border: none;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--primary-600);
  background: var(--primary-50);
}

.nav-tab-btn.active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-600);
  background: #ffffff;
}

.nav-tab-badge {
  background: var(--gray-200);
  color: var(--gray-700);
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
}

.nav-tab-btn.active .nav-tab-badge {
  background: var(--primary-100);
  color: var(--primary-700);
}

/* Main Container */
.main-wrapper {
  max-width: 1360px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* View Sections */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* Cards & Layout */
.card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #fafbfc;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

.card-body {
  padding: 1.5rem;
}

/* Form Styles */
.form-section {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  position: relative;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-700);
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.required-badge {
  color: var(--danger-600);
  margin-left: 0.2rem;
}

.auto-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--secondary-600);
  background: var(--secondary-50);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #bbf7d0;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.92rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--gray-800);
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.18);
}

/* Modern user feedback: user-invalid / user-valid */
.form-control:user-invalid {
  border-color: var(--danger-500);
  background-color: var(--danger-50);
}

.form-control:user-valid:not(:placeholder-shown) {
  border-color: var(--secondary-500);
}

.error-feedback {
  display: none;
  font-size: 0.78rem;
  color: var(--danger-600);
  margin-top: 0.35rem;
}

.form-control:user-invalid ~ .error-feedback {
  display: block;
}

/* Readonly fields that are auto-filled */
.form-control.auto-filled {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
  font-weight: 500;
}

/* Tags bar for common choices */
.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.tag-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-700);
}

/* Alert notice cards */
.notice-box {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  color: #0f766e;
}

.conflict-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  color: #92400e;
  font-size: 0.88rem;
  margin-top: 0.75rem;
  display: none;
  align-items: center;
  gap: 0.6rem;
}

.conflict-warning.active {
  display: flex;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.22);
}

.btn-primary:hover {
  background: var(--primary-700);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-success {
  background: var(--secondary-600);
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
}

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

.btn-danger:hover {
  background: #b91c1c;
}

.btn-outline-primary {
  background: #ffffff;
  color: var(--primary-600);
  border-color: var(--primary-500);
}

.btn-outline-primary:hover {
  background: var(--primary-50);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 4px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

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

.badge-approved {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-rejected {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-in-school {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.badge-completed {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Data Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}

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

.data-table th {
  background: #f8fafc;
  color: var(--gray-700);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1.5px solid var(--gray-300);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-800);
  vertical-align: middle;
}

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

.data-table tbody tr.row-today {
  background-color: #fff7ed;
}

/* Filter & Search Bar */
.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.search-input-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

.search-input {
  padding-left: 2.2rem;
}

.filter-select {
  padding: 0.55rem 0.85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-size: 0.88rem;
  color: var(--gray-700);
  outline: none;
}

/* Directory Subtabs & Pagination */
.dir-subtab-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gray-200);
}

.dir-subtab-btn {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dir-subtab-btn:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.dir-subtab-btn.active {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-700);
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.25);
}

.dir-subtab-btn .badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
}

.dir-section-card {
  transition: opacity 0.2s ease;
}

.dir-section-card.hidden {
  display: none !important;
}

.pagination-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.84rem;
  color: var(--gray-600);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-page {
  background: #ffffff;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-page:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-page:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-size-select {
  padding: 0.25rem 0.5rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 4px;
  background: #ffffff;
  font-size: 0.8rem;
  color: var(--gray-700);
  outline: none;
}

/* Guard Room Cards */
.guard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1.15rem;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.kpi-num {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--gray-900);
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--gray-500);
}

.guard-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.guard-item-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-200);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all 0.2s ease;
}

.guard-item-card.is-overdue {
  border-color: var(--danger-500);
  background: #fffafa;
}

.guard-item-card:hover {
  box-shadow: var(--shadow-md);
}

.guard-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.guard-venue {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-700);
}

.guard-class {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-800);
}

.guard-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.4rem;
}

.guard-phone-link {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.guard-phone-link:hover {
  text-decoration: underline;
}

.guard-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  border-top: 1px dashed var(--gray-200);
  padding-top: 0.85rem;
}

/* Timeline & Schedule View */
.timeline-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline-venue-row {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  padding: 1rem 1.25rem;
}

.timeline-venue-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.timeline-slot-chip {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-left: 4px solid var(--primary-600);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 170px;
}

/* Modals */
.custom-modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  max-width: 620px;
  width: min(92vw, 620px);
  max-height: 86vh;
  margin: auto;
  background: #ffffff;
  z-index: 1000;
  overflow: hidden;
  box-sizing: border-box;
}

.custom-modal[open] {
  display: flex;
  flex-direction: column;
}

.custom-modal:not([open]) {
  display: none;
}

.custom-modal::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.modal-header {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray-400);
  padding: 0.2rem;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--gray-700);
}

.modal-body {
  padding: 1.25rem 1.4rem;
  flex: 1 1 auto;
  overflow-y: auto;
}

.modal-footer {
  padding: 0.9rem 1.4rem;
  border-top: 1px solid var(--gray-200);
  background: #fafbfc;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Detail view within Modal */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.detail-item {
  background: #f8fafc;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.detail-value {
  font-size: 0.92rem;
  color: var(--gray-800);
  font-weight: 600;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideUp 0.25s ease-out;
}

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

.toast.success {
  background: #166534;
}

.toast.error {
  background: #991b1b;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}

.chart-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 0.85rem;
}

.chart-wrapper {
  position: relative;
  height: 280px;
  width: 100%;
  flex: 1;
}

.chart-wrapper canvas {
  display: block;
  max-width: 100%;
}

/* =========================================================
   Print Stylesheet (@media print)
   Formal A4 Campus Official Approval & Safety Patrol Sheet
   ========================================================= */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .top-header,
  .nav-tab-bar,
  .filter-toolbar,
  .card-header .btn,
  .btn,
  #toast-container,
  .no-print {
    display: none !important;
  }

  .main-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
  }

  .print-only-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #000000;
    padding-bottom: 0.5rem;
  }

  .print-only-header h1 {
    font-size: 18pt;
    font-weight: bold;
    margin-bottom: 0.25rem;
  }

  .print-only-header h2 {
    font-size: 13pt;
    font-weight: normal;
  }

  .print-stamp-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid #000000;
    margin-top: 2rem;
    text-align: center;
  }

  .stamp-box {
    border-right: 1px solid #000000;
    padding: 0.5rem;
    height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .stamp-box:last-child {
    border-right: none;
  }

  .data-table {
    border: 1px solid #000000 !important;
  }

  .data-table th,
  .data-table td {
    border: 1px solid #000000 !important;
    padding: 6px 8px !important;
    font-size: 9.5pt !important;
  }
}
