/* ==========================================================================
   KHẢO SÁT Ý KIẾN PHỤ HUYNH & BẦU CỬ BAN CÁN SỰ - STYLE.CSS
   Chuẩn thiết kế TCT.VN: Giao diện trực quan, tương phản cao, tối ưu in A4
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #64748b;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
}

/* ==========================================================================
   HEADER & NAVIGATION BAR
   ========================================================================== */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.header-icon {
  width: 42px;
  height: 42px;
  background: #dbeafe;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.app-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Dropdown */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  width: 290px;
  padding: 6px;
  display: none;
  z-index: 1000;
}

.dropdown-wrapper.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  font-size: 13px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Action Buttons */
.btn-action, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

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

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

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #475569;
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-sample {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
}
.btn-sample:hover {
  background: #dbeafe;
}

.btn-backup {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: var(--success);
}
.btn-backup:hover {
  background: #dcfce7;
}

.btn-restore {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #ea580c;
}
.btn-restore:hover {
  background: #ffedd5;
}

.btn-excel {
  background: #047857;
  color: #ffffff;
}
.btn-excel:hover {
  background: #065f46;
}

.input-sm {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
}

/* ==========================================================================
   CONTAINER & TABS
   ========================================================================== */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px 24px 60px 24px;
}

.tabs-nav {
  display: flex;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  gap: 6px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--primary);
  background: #f8fafc;
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

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

/* Grid Layouts */
.grid-2-cols {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .grid-2-cols {
    grid-template-columns: 1fr;
  }
}

.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 18px; }
.p-0 { padding: 0 !important; }

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.card-header.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 20px;
}

/* Form controls */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-main);
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.layout-toggle {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.layout-toggle .radio-label {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.layout-toggle input[type="radio"]:checked + span {
  font-weight: 700;
  color: var(--primary);
}

.quick-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-overview-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.overview-item {
  display: flex;
  flex-direction: column;
}
.overview-lbl {
  font-size: 11.5px;
  color: var(--text-muted);
}
.overview-val {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }

/* Question list */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.question-item:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.q-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9999px;
  margin-right: 8px;
  text-transform: uppercase;
}
.q-badge.binary { background: #dbeafe; color: #1e40af; }
.q-badge.multi { background: #fef3c7; color: #92400e; }
.q-badge.rating { background: #e0e7ff; color: #3730a3; }
.q-badge.election { background: #fce7f3; color: #9d174d; }

.q-title {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}
.q-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.q-options-preview {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.q-opt-pill {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  color: #475569;
  border: 1px dashed #cbd5e1;
}

.q-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.btn-icon.delete:hover {
  background: var(--danger-light);
  border-color: #fecaca;
  color: var(--danger);
}

/* ==========================================================================
   TAB 2: PRINT PREVIEW & A4 STYLES
   ========================================================================== */
.toolbar-print {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}
.badge-success {
  background: #dcfce7;
  color: #166534;
}

/* A4 Printable Sheets Area */
.print-sheets-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

/* Virtual A4 Paper Simulation */
.a4-sheet {
  background: #ffffff;
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 15mm;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  color: #000000;
  box-sizing: border-box;
  position: relative;
  font-family: 'Merriweather', 'Times New Roman', serif;
  display: flex;
  flex-direction: column;
}

/* Sub-slips layout inside A4 */
.layout-2-slips {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.layout-2-slips .survey-slip {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4mm 2mm;
}
.layout-2-slips .survey-slip:first-child {
  border-bottom: 1.5px dashed #64748b;
  margin-bottom: 6mm;
  padding-bottom: 8mm;
  position: relative;
}
.layout-2-slips .survey-slip:first-child::after {
  content: '✂ Cắt rời theo đường nét đứt để phát cho 2 phụ huynh ✂';
  position: absolute;
  bottom: -4mm;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  padding: 0 8px;
  font-size: 9px;
  font-family: 'Be Vietnam Pro', sans-serif;
  color: #64748b;
}

.layout-3-slips {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.layout-3-slips .survey-slip {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3mm 1mm;
  border-bottom: 1.5px dashed #64748b;
  margin-bottom: 4mm;
  padding-bottom: 6mm;
  position: relative;
}
.layout-3-slips .survey-slip:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.layout-3-slips .survey-slip::after {
  content: '✂ Cắt rời theo đường nét đứt ✂';
  position: absolute;
  bottom: -3.5mm;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  padding: 0 6px;
  font-size: 8.5px;
  font-family: 'Be Vietnam Pro', sans-serif;
  color: #64748b;
}
.layout-3-slips .survey-slip:last-child::after {
  display: none;
}

/* Slip Header */
.slip-header {
  text-align: center;
  margin-bottom: 3mm;
}
.slip-org {
  font-size: 10pt;
  font-weight: 700;
  text-transform: uppercase;
}
.slip-suborg {
  font-size: 9.5pt;
  font-weight: 600;
}
.slip-title {
  font-size: 12pt;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2mm;
  line-height: 1.3;
}
.slip-intro {
  font-size: 9pt;
  font-style: italic;
  margin-top: 1.5mm;
  text-align: justify;
}

.slip-student-info {
  display: flex;
  justify-content: space-between;
  font-size: 9.5pt;
  margin-bottom: 2mm;
  padding-bottom: 1mm;
  border-bottom: 0.5px solid #000;
}
.slip-student-info .line-fill {
  border-bottom: 1px dotted #000;
  display: inline-block;
  min-width: 140px;
}

/* Slip Table of Questions */
.slip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
  margin: 2mm 0;
}
.slip-table th, .slip-table td {
  border: 1px solid #000;
  padding: 4px 6px;
  vertical-align: middle;
}
.slip-table th {
  background-color: #f1f5f9;
  font-weight: 700;
  text-align: center;
}
.slip-table td.col-center {
  text-align: center;
  width: 65px;
}
.slip-table td.col-stt {
  text-align: center;
  width: 32px;
}

.box-choice {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 1.5px solid #000;
  vertical-align: middle;
}

.slip-options-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 3px;
}
.slip-opt-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 8.5pt;
}

/* Slip Footer */
.slip-footer {
  margin-top: 2mm;
}
.slip-custom-opinion {
  font-size: 8.5pt;
  margin-bottom: 2mm;
}
.slip-custom-opinion .dots-line {
  border-bottom: 1px dotted #666;
  height: 16px;
  width: 100%;
  display: block;
}
.slip-signatures {
  display: flex;
  justify-content: space-between;
  font-size: 9pt;
  text-align: center;
  margin-top: 1mm;
}
.slip-signatures div {
  width: 45%;
}
.slip-signatures .sign-role {
  font-weight: 700;
}
.slip-signatures .sign-note {
  font-size: 8pt;
  font-style: italic;
  margin-top: 1px;
}
.slip-signatures .sign-space {
  height: 12mm;
}

/* ==========================================================================
   TAB 3: KPI CARDS & ANALYTICS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-blue .kpi-icon { background: #dbeafe; color: #1d4ed8; }
.card-purple .kpi-icon { background: #ede9fe; color: #7c3aed; }
.card-green .kpi-icon { background: #dcfce7; color: #15803d; }
.card-amber .kpi-icon { background: #fef3c7; color: #b45309; }

.kpi-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.kpi-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  margin: 2px 0;
}
.kpi-note {
  font-size: 11px;
  color: var(--text-muted);
}

/* Charts list */
.charts-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.chart-q-name {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}
.chart-rate-highlight {
  font-size: 16px;
  font-weight: 800;
}

.progress-group {
  margin-bottom: 8px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  font-weight: 600;
}
.progress-bar-wrap {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
}
.bar-agree { background: #22c55e; }
.bar-disagree { background: #ef4444; }
.bar-other { background: #f59e0b; }
.bar-opt { background: #3b82f6; }

/* Student votes table */
.table-responsive {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}
.data-table tr:hover {
  background: #f8fafc;
}

.select-vote {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
}
.select-vote.agree { background: #dcfce7; color: #166534; border-color: #86efac; }
.select-vote.disagree { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.select-vote.other { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* ==========================================================================
   TAB 4: FORMAL A4 REPORT (BIÊN BẢN TỔNG HỢP)
   ========================================================================== */
.report-paper-container {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.report-sheet {
  background: #ffffff;
  width: 210mm;
  min-height: 297mm;
  padding: 20mm 20mm;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  color: #000000;
  box-sizing: border-box;
  font-family: 'Merriweather', 'Times New Roman', serif;
  line-height: 1.6;
  font-size: 11pt;
}

.report-top-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}
.report-top-header .left-col {
  text-align: center;
  width: 48%;
}
.report-top-header .right-col {
  text-align: center;
  width: 48%;
}
.report-top-header .unit-name {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5pt;
}
.report-top-header .school-name {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11pt;
}
.report-top-header .national-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5pt;
}
.report-top-header .national-sub {
  font-weight: 700;
  font-size: 10.5pt;
}
.divider-line {
  width: 100px;
  height: 1px;
  background: #000;
  margin: 3px auto;
}

.report-title-section {
  text-align: center;
  margin: 20px 0 15px 0;
}
.report-main-title {
  font-size: 14pt;
  font-weight: 700;
  text-transform: uppercase;
}
.report-sub-title {
  font-size: 11pt;
  font-style: italic;
  margin-top: 4px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 10.5pt;
}
.report-table th, .report-table td {
  border: 1px solid #000;
  padding: 6px 8px;
}
.report-table th {
  background: #f1f5f9;
  text-align: center;
  font-weight: 700;
}

.report-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  text-align: center;
}
.report-signatures .sig-box {
  width: 45%;
}
.report-signatures .sig-title {
  font-weight: 700;
  font-size: 11pt;
}
.report-signatures .sig-sub {
  font-style: italic;
  font-size: 9.5pt;
}
.report-signatures .sig-space {
  height: 25mm;
}
.report-signatures .sig-name {
  font-weight: 700;
}

/* ==========================================================================
   MODAL & TOAST
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal.open { display: flex; }

.modal-dialog {
  width: 100%;
  max-width: 580px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 14px 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; }
.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body { padding: 20px; max-height: 75vh; overflow-y: auto; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  display: none;
  z-index: 9999;
  transition: opacity 0.3s;
}
.toast.show { display: block; animation: toastIn 0.25s ease-out; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   PRINT MEDIA RULES (In phiếu & Biên bản)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 10mm 10mm 10mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .no-print, .no-print-section, .tabs-nav, .app-header, .toolbar-print {
    display: none !important;
  }

  /* Show only active printable tab */
  .tab-pane {
    display: none !important;
  }
  .tab-pane.active {
    display: block !important;
  }

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

  .print-sheets-area {
    gap: 0 !important;
  }

  .a4-sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: auto !important;
    page-break-after: always;
  }

  .report-paper-container {
    margin: 0 !important;
  }

  .report-sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: auto !important;
  }
}
