:root {
  --primary-color: #004e9a; /* Inha Blue */
  --primary-hover: #003b75;
  --bg-color: #f4f7fb;
  --card-bg: #ffffff;
  --text-main: #1d1d1f;
  --text-muted: #86868b;
  --border-color: #d2d2d7;
  --error-color: #ff3b30;
  --success-color: #34c759;
  --focus-ring: rgba(0, 78, 154, 0.3);
  --border-radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.header {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 20px;
}

.logo {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #111;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  word-break: keep-all;
}

.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary-color);
}

.terms-content {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 20px;
}

.terms-box {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  margin: 12px 0;
  border: 1px solid #eaeaea;
}

.terms-box ul {
  list-style-type: none;
}

.terms-box li {
  margin-bottom: 8px;
}
.terms-box li:last-child {
  margin-bottom: 0;
}

.warning-text {
  color: var(--error-color);
  font-size: 0.85rem;
  margin-top: 8px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.validation-error {
  border-radius: 12px;
  outline: 2px solid var(--error-color);
  outline-offset: 6px;
  background: rgba(220, 53, 69, 0.04);
}

.form-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #222;
}

.form-input, .form-select {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background-color: #fff;
  transition: all 0.2s ease;
  color: var(--text-main);
  appearance: none;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-input::placeholder {
  color: #adb5bd;
}

.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-with-suffix .form-input {
  flex: 1;
}

.suffix {
  font-size: 1rem;
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
}

/* Custom Radios */
.radio-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-group-horizontal {
  display: flex;
  gap: 16px;
}

.radio-group-horizontal .radio-label {
  flex: 1 1 0;
  justify-content: center;
  min-width: 0;
}

.radio-group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.radio-label {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.2s ease;
  background: #fff;
  user-select: none;
  word-break: keep-all;
}

.radio-label:hover {
  border-color: #b0c4de;
  background: #fcfdfd;
}

.radio-label input[type="radio"] {
  display: none;
}

.custom-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  margin-right: 12px;
  display: inline-block;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.radio-label input[type="radio"]:checked + .custom-radio {
  border-color: var(--primary-color);
}

.radio-label input[type="radio"]:checked + .custom-radio::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--primary-color);
  border-radius: 50%;
}

.radio-label:has(input[type="radio"]:checked) {
  border-color: var(--primary-color);
  background-color: rgba(0, 78, 154, 0.03);
  font-weight: 600;
  color: var(--primary-color);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.submit-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background-color: var(--primary-color);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 78, 154, 0.3);
}

.submit-btn:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 78, 154, 0.4);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  cursor: not-allowed;
}

/* Success Message */
.hidden {
  display: none !important;
}

.success-message {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  animation: slideUp 0.5s ease;
}

.success-icon {
  width: 80px;
  height: 80px;
  background-color: var(--success-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 24px;
}

.success-message h2 {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

.success-message p {
  color: var(--text-muted);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Disabled state when privacy is not agreed */
.disabled-section {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(1);
  transition: all 0.3s ease;
}

/* Closed / Not-yet-open Message */
.closed-message {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  animation: slideUp 0.5s ease;
}

.closed-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.closed-message h2 {
  font-size: 1.4rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

.closed-message p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.closed-contact {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 600;
}

/* =========================================================
   Admin Dashboard Styles (Desktop-first)
   ========================================================= */
.admin-body {
  background-color: #f0f2f5;
}

.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 32px 60px;
}

.admin-header {
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

/* --- Control Bar (horizontal) --- */
.admin-control-card {
  margin-bottom: 24px;
}

.control-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: nowrap;
}

.control-group-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-group-inline label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
}

.input-inline {
  width: 220px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.btn-inline {
  padding: 8px 16px;
  font-size: 0.85rem;
  white-space: nowrap;
  height: 38px;
  width: auto;
}

.btn-compact {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 8px;
  box-shadow: none;
}

.spacer {
  flex: 1;
}

/* --- Stats Summary (horizontal) --- */
.stats-card {
  background: linear-gradient(135deg, #004e9a, #007aff);
  color: white;
  margin-bottom: 24px;
}

/* New 5-Card Dashboard Layout */
.draft-b-wrapper {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1fr 1fr 1.25fr;
  gap: 16px;
  margin-bottom: 24px;
}

.draft-b-wrapper-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.draft-b-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.03);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (max-width: 1100px) {
  .draft-b-wrapper { grid-template-columns: repeat(3, 1fr); }
  .draft-b-wrapper-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .draft-b-wrapper { grid-template-columns: repeat(2, 1fr); }
  .draft-b-wrapper-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .draft-b-wrapper, .draft-b-wrapper-4 { grid-template-columns: 1fr; }
}

.draft-b-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.draft-b-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.draft-b-icon {
  width: 36px;
  height: 36px;
  background: #e8f0fe;
  color: #004e9a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.draft-b-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
}

.draft-b-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: #111;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
  word-break: keep-all;
}

.draft-b-sub {
  font-size: 0.85rem;
  color: #888;
  font-weight: 500;
}

.badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.draft-b-badge {
  display: inline-block;
  background: #f1f3f5;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #444;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary {
  background: #e3effd;
  color: #004e9a;
}

.badge-female {
  background: #fff0f5;
  color: #d81b60;
}


@media (min-width: 1101px) {
  .draft-b-wrapper {
    grid-template-columns: 0.86fr 1.08fr 1.18fr 1.05fr 1.28fr;
  }

  #statGradeBadges {
    flex-wrap: nowrap;
    gap: 5px;
  }

  #statGradeBadges .draft-b-badge {
    padding: 4px 7px;
    font-size: 0.78rem;
  }
}
.detailed-stats-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 2.0fr;
  gap: 0;
  padding: 0;
}

.detailed-stats-row .stat-item-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 24px 16px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.detailed-stats-row .stat-item-col:last-child {
  border-right: none;
}

.stat-item-col .stat-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-item-col .stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  word-break: keep-all;
  line-height: 1.5;
}

.stat-value-big {
  font-size: 2.6rem !important;
  font-weight: 800 !important;
  letter-spacing: -1px;
}

.stat-value-mid {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.5px;
  line-height: 1.4 !important;
}

.stat-total-col {
  justify-content: flex-start;
}

/* --- Charts --- */
.charts-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.charts-grid-1col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.chart-card {
  min-height: 300px;
}

.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}

/* --- Buttons --- */
.btn-small {
  padding: 10px 15px;
  font-size: 0.95rem;
}

.btn-excel {
  background-color: #107c41;
}
.btn-excel:hover:not(:disabled) {
  background-color: #0b5e31;
}

.btn-danger {
  background-color: var(--error-color);
}
.btn-danger:hover:not(:disabled) {
  background-color: #d32f2f;
}

.btn-secondary {
  background-color: var(--text-muted);
}
.btn-secondary:hover:not(:disabled) {
  background-color: #666;
}


.admin-table-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.department-filter-select {
  width: 180px;
  height: 42px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.admin-table-filters #searchTableInput {
  width: 250px;
  height: 42px;
  padding: 8px 14px;
  font-size: 0.9rem;
}

/* --- Data Table --- */
.full-width-card {
  width: 100%;
  margin-bottom: 24px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.data-table th, .data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.admin-submissions-table {
  table-layout: fixed;
  min-width: 1200px;
}

.admin-submissions-table th,
.admin-submissions-table td {
  padding: 10px 8px;
  font-size: 0.9rem;
  white-space: nowrap;
  vertical-align: middle;
}

.admin-submissions-table th:nth-child(1),
.admin-submissions-table td:nth-child(1) {
  width: 48px;
  text-align: center;
}

.admin-submissions-table th:nth-child(2),
.admin-submissions-table td:nth-child(2) {
  width: 142px;
}

.admin-submissions-table th:nth-child(3),
.admin-submissions-table td:nth-child(3) {
  width: 72px;
}

.admin-submissions-table th:nth-child(4),
.admin-submissions-table td:nth-child(4) {
  width: 126px;
}

.admin-submissions-table th:nth-child(5),
.admin-submissions-table td:nth-child(5) {
  width: 92px;
}

.admin-submissions-table th:nth-child(6),
.admin-submissions-table td:nth-child(6) {
  width: 230px;
}

.admin-submissions-table th:nth-child(7),
.admin-submissions-table td:nth-child(7) {
  width: 54px;
  text-align: center;
}

.admin-submissions-table th:nth-child(8),
.admin-submissions-table td:nth-child(8) {
  width: 76px;
}

.admin-submissions-table th:nth-child(9),
.admin-submissions-table td:nth-child(9) {
  width: 76px;
}

.admin-submissions-table th:nth-child(10),
.admin-submissions-table td:nth-child(10) {
  width: 166px;
}

.admin-submissions-table th:nth-child(11),
.admin-submissions-table td:nth-child(11) {
  width: 112px;
  padding-left: 18px;
}

.admin-submissions-table .edit-btn,
.admin-submissions-table .delete-one-btn {
  padding: 5px 10px;
  font-size: 0.82rem;
}

.admin-submissions-table .delete-one-btn {
  margin-left: 3px;
}
.data-table tbody tr:hover {
  background-color: #f8faff;
}

.edit-btn {
  padding: 6px 14px;
  background-color: #f1f3f5;
  color: #333;
  border: 1px solid #ced4da;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.edit-btn:hover {
  background-color: #e2e6ea;
}

.delete-one-btn {
  padding: 6px 14px;
  background-color: #fff0f0;
  color: #dc3545;
  border: 1px solid #f5c2c7;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  margin-left: 4px;
}

.delete-one-btn:hover {
  background-color: #f8d7da;
}

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: white;
  padding: 30px;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.error-text {
  color: var(--error-color);
  font-size: 0.9rem;
}

/* --- Pagination --- */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.page-ellipsis {
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 2px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  background-color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
}

.page-btn:hover:not(:disabled) {
  background-color: #f1f3f5;
}

.page-btn.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Admin Tabs --- */
.admin-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
}

.admin-tab {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.admin-tab:hover {
  color: var(--primary-color);
}

.admin-tab.active {
  color: var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
}

.tab-content {
  display: block;
  animation: fadeIn 0.3s ease;
}

.tab-content.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.placeholder-card {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.placeholder-card h2 {
  border: none;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* --- Horizontal Admin Header --- */
.admin-header-combined {
  text-align: left;
  margin-bottom: 24px;
}
.admin-header-combined .logo {
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.header-main-row {
  display: flex;
  align-items: flex-end;
  gap: 40px;
  border-bottom: 2px solid var(--border-color);
}
.header-main-row h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #111;
  margin: 0;
  padding-bottom: 12px;
}
.header-main-row .admin-tabs {
  margin-bottom: 0;
  border-bottom: none;
  gap: 20px;
}

@media (max-width: 640px) {
  .admin-body {
    background-color: #f4f6f8;
  }

  .admin-container {
    padding: 20px 16px 48px;
    width: 100%;
    overflow-x: hidden;
  }

  .admin-header-combined {
    margin-bottom: 18px;
  }

  .admin-header-combined .logo {
    font-size: 0.82rem;
    margin-bottom: 14px;
  }

  .header-main-row,
  .header-main-row[style] {
    display: block !important;
    border-bottom: 0;
  }

  .header-main-row > div:first-child,
  .header-main-row > div:first-child[style] {
    display: block !important;
  }

  .header-main-row h1 {
    font-size: 2.1rem;
    line-height: 1.2;
    padding-bottom: 12px;
    word-break: keep-all;
  }

  .header-main-row > div:last-child,
  .header-main-row > div:last-child[style] {
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
    width: 100%;
  }

  .header-main-row .admin-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    border-bottom: 2px solid var(--border-color);
  }

  .admin-tab {
    min-width: 0;
    padding: 10px 4px 12px;
    font-size: 0.92rem;
    line-height: 1.25;
    word-break: keep-all;
  }

  .admin-page-links,
  .admin-page-links[style] {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
    width: 100%;
  }

  .admin-page-links .btn-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
  }

  .admin-control-card {
    padding: 16px;
    overflow: hidden;
  }

  .control-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .control-group-inline,
  .input-inline,
  .control-row .submit-btn {
    width: 100%;
    min-width: 0;
  }

  .input-inline {
    height: 44px;
    font-size: 0.95rem;
  }

  .control-row .btn-inline {
    height: 42px;
    margin-right: 0 !important;
  }

  .draft-b-wrapper,
  .draft-b-wrapper-4 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .draft-b-card {
    border-radius: 12px;
    padding: 22px 18px;
  }

  .draft-b-label {
    white-space: normal;
  }

  .draft-b-value {
    font-size: 2rem;
    line-height: 1.2;
  }
}
@media (max-width: 640px) {
  #tab-edit .full-width-card {
    max-width: 100%;
    overflow: hidden;
  }

  #tab-edit .full-width-card > div:first-child,
  #tab-edit .full-width-card > div:first-child[style] {
    display: grid !important;
    grid-template-columns: 1fr;
    align-items: stretch !important;
    gap: 14px !important;
  }

  #tab-edit .full-width-card h2 {
    font-size: 1.45rem;
    line-height: 1.25;
    word-break: keep-all;
    overflow-wrap: normal;
  }

  #toggleAdminLateFormBtn {
    width: 100%;
    height: 44px;
  }

  .admin-late-form {
    width: 100%;
    overflow: hidden;
  }

  .admin-late-form > div,
  .admin-late-form > div[style] {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .admin-late-form label,
  .admin-late-form label[style] {
    display: block;
    grid-column: auto !important;
    min-width: 0;
    width: 100%;
  }

  .admin-late-form .form-input,
  .admin-late-form .submit-btn {
    width: 100%;
    min-width: 0;
  }

  .admin-table-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-left: 0;
    width: 100%;
  }

  .department-filter-select,
  .admin-table-filters #searchTableInput,
  #searchTableInput[style] {
    width: 100% !important;
    min-width: 0;
  }

  .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 640px) {
  #editModal.modal-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #editModal .modal-box {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 24px);
    margin: 0;
    padding: 20px 18px 18px;
    overflow-y: auto;
    border-radius: 14px;
  }

  #editModal .modal-box h2 {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: -20px -18px 18px;
    padding: 18px 18px 14px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.35rem;
    line-height: 1.25;
    word-break: keep-all;
  }

  #editForm .form-group {
    margin-bottom: 16px;
  }

  #editForm .form-label {
    margin-bottom: 8px;
    font-size: 1rem;
  }

  #editForm .form-input {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 1rem;
    border-radius: 10px;
  }

  #editForm .submit-btn {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 1rem;
  }

  #editForm button[type="submit"] {
    margin-top: 8px !important;
  }

  #closeModalBtn {
    margin-top: 8px !important;
  }
}
/* =========================================================
   Satisfaction Survey Page Styles
   ========================================================= */

/* Likert Scale Blocks */
.likert-group {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.likert-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.likert-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.likert-option {
  flex: 1;
  cursor: pointer;
}

.likert-option input[type="radio"] {
  display: none;
}

.likert-box {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  background: #fff;
  line-height: 1.2;
}

.likert-option:hover .likert-box {
  background: #f8faff;
  border-color: #b0c4de;
}

/* Colors for each level */
.likert-option input[type="radio"]:checked + .box-1 {
  background: #ff3b30;
  border-color: #ff3b30;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(255, 59, 48, 0.3);
  transform: translateY(-2px);
}
.likert-option input[type="radio"]:checked + .box-2 {
  background: #ff9500;
  border-color: #ff9500;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(255, 149, 0, 0.3);
  transform: translateY(-2px);
}
.likert-option input[type="radio"]:checked + .box-3 {
  background: #8e8e93;
  border-color: #8e8e93;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(142, 142, 147, 0.3);
  transform: translateY(-2px);
}
.likert-option input[type="radio"]:checked + .box-4 {
  background: #34c759;
  border-color: #34c759;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(52, 199, 89, 0.3);
  transform: translateY(-2px);
}
.likert-option input[type="radio"]:checked + .box-5 {
  background: #007aff;
  border-color: #007aff;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
  transform: translateY(-2px);
}

/* Mobile adjust for boxes */
@media (max-width: 768px) {
  .radio-group-horizontal {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .radio-group-horizontal .radio-label {
    width: 100%;
  }

  .likert-scale {
    gap: 4px;
  }
  .likert-box {
    font-size: 0.75rem;
    height: 48px;
    padding: 0 2px;
    letter-spacing: -0.5px;
    word-break: keep-all;
  }
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Survey Form specific */
.survey-form .card {
  animation: slideUp 0.4s ease;
}

.survey-form .card:nth-child(2) { animation-delay: 0.05s; }
.survey-form .card:nth-child(3) { animation-delay: 0.1s; }
.survey-form .card:nth-child(4) { animation-delay: 0.15s; }

/* =========================================================
   Admin Satisfaction Dashboard Styles
   ========================================================= */

/* 4-column stats row for satisfaction */
.sat-stats-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 1fr 1fr;
  gap: 0;
  padding: 0;
}

.sat-stats-row .stat-item-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 24px 20px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.sat-stats-row .stat-item-col:last-child {
  border-right: none;
}

.sat-stats-row .stat-label {
  font-size: 1.15rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: 12px;
}

.stat-value-large {
  font-size: 2.2rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.5px;
  line-height: 1.3 !important;
}

/* Text Response List */
.text-response-list {
  max-height: 350px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.text-response-list::-webkit-scrollbar {
  width: 6px;
}

.text-response-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.text-response-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.text-response-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  animation: fadeIn 0.3s ease;
  min-width: 0;
}

.text-response-item:last-child {
  border-bottom: none;
}

.response-number {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

.response-text {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  font-size: 0.93rem;
  color: var(--text-main);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.empty-text {
  text-align: center;
  padding: 30px 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Mobile responsive for satisfaction stats */
@media (max-width: 768px) {
  .sat-stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .sat-stats-row .stat-item-col:nth-child(2) {
    border-right: none;
  }
  .charts-grid-2col {
    grid-template-columns: 1fr;
  }
  .likert-circle {
    width: 40px;
    height: 40px;
    font-size: 0.85rem;
  }
  .likert-scale {
    gap: 8px;
  }
}

/* =========================================================
   Print Styles for A4 Reports
   ========================================================= */
@media print {
  @page {
    size: A4;
    margin: 5mm 7mm;
  }
  * {
    box-sizing: border-box !important;
  }
  body, html {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background-color: #ffffff !important;
    font-size: 0.82rem !important;
    color: #333333 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .admin-container {
    margin: 0 !important;
    padding: 32px 6px 0 !important;
    width: 100% !important;
    max-width: none !important;
    background-color: #ffffff !important;
  }

  /* ── 헤더 ── */
  .admin-header-combined {
    padding: 0 0 6px !important;
    margin: 0 0 18px !important;
    box-shadow: none !important;
    border-bottom: 2px solid #d1d5db !important;
  }
  .admin-header-combined .logo {
    margin-bottom: 1px !important;
    font-size: 0.78rem !important;
    letter-spacing: 1.2px !important;
  }
  .header-main-row {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 12px !important;
    border-bottom: none !important;
  }
  .header-main-row > div:first-child {
    display: flex !important;
    align-items: baseline !important;
    gap: 12px !important;
  }
  .header-main-row > div:last-child {
    display: none !important;
  }
  .header-main-row h1 {
    font-size: 1.05rem !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
  }
  .print-timestamp {
    display: inline-block !important;
    font-size: 0.7rem !important;
    color: #666 !important;
    font-weight: normal !important;
    margin-left: 10px;
  }

  /* ── 요약 카드 (상단 5개) ── */
  .draft-b-wrapper {
    gap: 6px !important;
    margin-bottom: 28px !important;
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
  }
  .draft-b-wrapper-4 {
    gap: 6px !important;
    margin-bottom: 6px !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .draft-b-card {
    padding: 6px 8px !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
  }
  .draft-b-value {
    font-size: 0.95rem !important;
    line-height: 1.15 !important;
  }
  .draft-b-label {
    font-size: 0.72rem !important;
  }
  .draft-b-icon {
    font-size: 0.9rem !important;
  }
  .draft-b-sub,
  .badge-container {
    display: none !important;
  }

  /* ── 카드 공통 ── */
  .card, .chart-card {
    padding: 5px 8px !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
  }
  .card h2, .chart-card h2 {
    margin: 0 0 2px !important;
    font-size: 0.82rem !important;
    padding-bottom: 1px !important;
  }
  section.card {
    margin-top: 6px !important;
  }

  /* ── 차트 그리드 ── */
  .charts-grid-2col, .chart-grid {
    gap: 10px !important;
    margin-bottom: 20px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    page-break-inside: avoid;
    width: 100% !important;
  }

  /* ── 차트 카드 & 컨테이너 (비율 핵심) ── */
  .chart-card {
    page-break-inside: avoid;
    break-inside: avoid;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }
  .chart-container {
    width: 100% !important;
    height: 215px !important;
    position: relative !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .chart-container canvas {
    max-width: 100% !important;
    height: auto !important; /* Critical: allows proportional scaling based on aspect ratio */
    max-height: 100% !important;
    object-fit: contain !important;
  }

  /* ── 텍스트 응답 영역 ── */
  .text-response-list {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }
  .text-response-item {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .response-text {
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  /* ── 불필요 UI 숨김 ── */
  .admin-header-combined .admin-tabs,
  .admin-page-links,
  .admin-control-card,
  #adminLoginBtn,
  .pagination-container,
  #printRegistrationBtn,
  #printSatisfactionBtn,
  #exportExcelBtn,
  #exportSatisfactionBtn,
  #clearDataBtn,
  #clearSatisfactionBtn {
    display: none !important;
  }
  th:nth-child(11), td:nth-child(11) {
    display: none !important;
  }

  /* ── 탭 컨텐츠 ── */
  .tab-content {
    display: block !important;
  }
  .tab-content[style*="display: none"] {
    display: none !important;
  }
  table.admin-table {
    page-break-inside: auto;
  }
  table.admin-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  /* ── 푸터 ── */
  .admin-container::after {
    content: '입학처 입학팀';
    display: block !important;
    margin-top: 40px !important;
    text-align: center !important;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    color: #111 !important;
    letter-spacing: 0.15em !important;
  }
}

.text-link-button {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  color: var(--primary-color);
  font-weight: 700;
  text-decoration: none;
}

.text-link-button:hover {
  text-decoration: underline;
}

.check-result {
  margin-top: 24px;
  padding: 28px 24px;
  text-align: center;
  background: #fff;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  animation: slideUp 0.35s ease;
}

.check-result h2 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.check-result p {
  color: var(--text-muted);
  word-break: keep-all;
}

.check-result-success {
  border-color: rgba(52, 199, 89, 0.45);
}

.check-result-success h2 {
  color: var(--success-color);
}

.check-result-notice h2 {
  color: var(--primary-color);
}

.check-result-error {
  border-color: rgba(255, 59, 48, 0.45);
}

.check-result-error h2 {
  color: var(--error-color);
}
