/* style.css — 학교 분실물 관리 시스템 v3.0 Firebase Edition */

@font-face {
  font-family: 'BinggraeMelona';
  src: url('BinggraeMelona-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BinggraeMelona';
  src: url('BinggraeMelona.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e8e6e1;
  --border-strong: #d0cdc7;
  --text: #1a1a18;
  --text-2: #5c5a56;
  --text-3: #9c9a96;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --font: 'BinggraeMelona', 'Noto Sans KR', sans-serif;
  --mono: 'DM Mono', monospace;
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
#app { min-height: 100vh; display: flex; flex-direction: column; }

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 247, 245, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.school-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.school-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ── Role Badge ── */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.role-badge.teacher {
  background: var(--text);
  color: #fff;
}

.role-badge.student {
  background: var(--blue);
  color: #fff;
}

/* ── Summary Cards ── */
.summary-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.summary-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-card .label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.summary-card .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-family: var(--mono);
  color: var(--text);
  line-height: 1;
}

.summary-card.danger .value { color: var(--red); }
.summary-card.success .value { color: var(--green); }

/* ── Main Content ── */
main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--border);
  padding: 3px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tab-btn {
  padding: 7px 18px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ── Controls ── */
.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-btn:hover { border-color: var(--text-3); }

.filter-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 38px;
}

.btn-primary {
  background: var(--text);
  color: #fff;
}

.btn-primary:hover { background: #333; }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

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

.btn-blue {
  background: var(--blue);
  color: #fff;
}

.btn-blue:hover { background: #1d4ed8; }

.btn-green {
  background: var(--green);
  color: #fff;
}

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

.btn-red {
  background: var(--red);
  color: #fff;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}

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

/* ── Card Grid ── */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 540px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1100px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Item Card ── */
.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  animation: cardIn 0.2s ease both;
}

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

.item-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.item-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-light);
}

/* Mobile: horizontal layout */
.card-inner {
  display: flex;
  flex-direction: row;
  height: 100px;
}

@media (min-width: 540px) {
  .card-inner {
    flex-direction: column;
    height: auto;
  }
}

.card-img {
  width: 100px;
  flex-shrink: 0;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

@media (min-width: 540px) {
  .card-img {
    width: 100%;
    height: 160px;
  }
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.item-card:hover .card-img img { transform: scale(1.03); }

.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-3);
  background: var(--bg);
}

.card-body {
  padding: 12px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-kind {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-location {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.status-badge.keeping {
  background: var(--blue-light);
  color: var(--blue);
}

.status-badge.returned {
  background: var(--green-light);
  color: var(--green);
}

.status-badge.disposed {
  background: var(--red-light);
  color: var(--red);
}

.days-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: var(--red);
  color: #fff;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
}

/* Card top-right: checkbox + share */
.card-top-right {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 2;
}

.check-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12px;
  color: transparent;
}

.check-circle:hover { border-color: var(--blue); }

.item-card.selected .check-circle {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.share-btn-card {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-2);
  transition: all var(--transition);
  text-decoration: none;
}

.share-btn-card:hover {
  background: var(--surface);
  border-color: var(--text-3);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; margin-bottom: 4px; color: var(--text-2); }
.empty-state span { font-size: 13px; }

/* ── Loading ── */
.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 12px;
  color: var(--text-3);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Bulk Bar ── */
.bulk-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--text);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.bulk-bar.visible { transform: translateY(0); }

.bulk-count {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}

@media (min-width: 600px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
}

.modal-backdrop.visible { opacity: 1; }

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overscroll-behavior: contain;
}

@media (min-width: 600px) {
  .modal {
    border-radius: var(--radius);
    transform: translateY(8px) scale(0.98);
  }
}

.modal-backdrop.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 12px auto 0;
}

@media (min-width: 600px) { .modal-handle { display: none; } }

.modal-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-2);
  flex-shrink: 0;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--border); }

.modal-body { padding: 16px 20px 24px; }

.modal-img-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 16px;
  cursor: pointer;
  position: relative;
}

.modal-img-wrap img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
  background: var(--bg);
}

.modal-img-wrap:hover::after {
  content: '🔍 크게 보기';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: var(--font);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-item {}
.detail-item .d-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.detail-item .d-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.detail-desc {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 16px;
}

.teacher-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.teacher-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.teacher-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Form ── */
.form-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.form-label .req { color: var(--red); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ── Photo Upload ── */
.photo-upload-area {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: var(--bg);
}

.photo-upload-area:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}

.photo-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.photo-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
  margin-top: 8px;
}

.photo-upload-text {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
}

.photo-upload-icon { font-size: 28px; margin-bottom: 6px; }

/* ── Stats ── */
.stats-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stats-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* Bar chart */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 12px;
  color: var(--text-2);
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--mono);
}

.bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  gap: 2px;
}

.bar-seg {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-count {
  font-size: 11px;
  color: var(--text-2);
  width: 40px;
  flex-shrink: 0;
  font-family: var(--mono);
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ── QR Modal ── */
.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.qr-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.qr-card canvas {
  display: block;
  margin: 0 auto 8px;
  border-radius: 4px;
}

.qr-card p {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

/* ── Toast ── */
.toast-wrap {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  background: var(--text);
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             toastOut 0.2s ease 2.5s both;
  white-space: nowrap;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

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

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

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* ── Image lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Upload Progress ── */
.upload-progress {
  margin-top: 8px;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}

/* ── Dialog Modals (confirm / prompt / PIN) ── */
.dialog-modal {
  max-width: 380px;
  padding: 32px 24px 24px;
  text-align: center;
  border-radius: var(--radius) !important;
}

.dialog-icon {
  font-size: 38px;
  margin-bottom: 12px;
  display: block;
}

.dialog-message {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 20px;
  white-space: pre-line;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.dialog-actions .btn {
  flex: 1;
  justify-content: center;
}

#promptInput {
  text-align: center;
  font-size: 15px;
}

.pin-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 8px;
  font-weight: 500;
}

/* ── Student kind filter (mobile scroll) ── */
#studentKindFilter {
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

#studentKindFilter::-webkit-scrollbar { display: none; }

.upload-progress-bar {
  height: 100%;
  background: var(--blue);
  border-radius: 2px;
  transition: width 0.2s ease;
}

/* ── Util ── */
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ── Checkbox inline ── */
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 2px;
  user-select: none;
}

.checkbox-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Stats table ── */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
}

.stats-table th {
  background: var(--bg);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-strong);
  color: var(--text-2);
  font-size: 12px;
}

.stats-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.stats-table tr:hover td { background: var(--bg); }

/* ── Item Number ── */
.card-item-no {
  font-size: 10px;
  font-weight: 700;
  color: var(--blue);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}

.detail-item-no-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.detail-item-no {
  display: inline-flex;
  align-items: center;
  padding: 6px 20px;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 20px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

/* ── Footer ── */
.app-footer {
  text-align: center;
  padding: 14px 20px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
}

/* ── School Selection Screen ── */
.school-select-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.school-select-inner {
  text-align: center;
  max-width: 480px;
  width: 100%;
}
.school-select-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.school-select-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 32px;
}
.school-select-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}
.school-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.school-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.school-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.school-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.school-card-actions a {
  text-decoration: none;
}
.school-select-footer {
  font-size: 11px;
  color: var(--text-3);
}
.school-select-loading {
  text-align: center;
  color: var(--text-3);
  padding: 16px 0;
}
@media (max-width: 480px) {
  .school-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .school-card-actions {
    width: 100%;
    justify-content: stretch;
  }
  .school-card-actions a {
    flex: 1;
    text-align: center;
  }
}

/* ── Super Admin Screen ── */
.super-admin-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  z-index: 500;
  padding: 20px;
}
.super-admin-box {
  max-width: 400px;
  margin: 15vh auto 0;
  text-align: center;
}
.super-admin-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.super-admin-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 20px;
}
.super-admin-box .form-control {
  margin-bottom: 10px;
  text-align: center;
}
.super-admin-box-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}
.super-admin-mgmt {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: 40px;
}
.super-admin-mgmt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.super-admin-mgmt-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.admin-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
}
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.admin-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
}
.form-hint {
  font-weight: 400;
  color: var(--text-3);
}
.admin-school-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-school-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  transition: opacity var(--transition);
}
.admin-school-item.inactive {
  opacity: 0.5;
}
.admin-school-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.admin-school-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
}
.admin-school-id {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}
.admin-school-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
}
.admin-empty {
  text-align: center;
  color: var(--text-3);
  padding: 16px 0;
}

/* ── School Apply Screen ── */
.school-select-apply {
  margin-bottom: 12px;
}
.school-apply-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.school-apply-link:hover { text-decoration: underline; }
.apply-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.apply-search-row .form-control { flex: 1; }
.apply-result-msg {
  font-size: 13px;
  color: var(--text-3);
  margin: 8px 0 4px;
}
.apply-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 6px;
}
.apply-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  text-align: left;
}
.apply-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.apply-form-actions {
  display: flex;
  gap: 8px;
}
.apply-success {
  text-align: center;
  padding: 32px 0;
}
.apply-success-icon { font-size: 52px; margin-bottom: 12px; }

/* ── Teacher Links Card ── */
.teacher-links-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 36px 12px 16px;
  margin: 12px 16px;
}
.teacher-links-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.teacher-links-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.teacher-links-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  width: 52px;
}
.teacher-links-url {
  font-size: 11px;
  color: var(--text-3);
  font-family: monospace;
  word-break: break-all;
  flex: 1;
}
.teacher-links-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-3);
  padding: 2px 4px;
}

/* ── Board Screen ── */
.board-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  overflow-y: auto;
  padding: 0 0 40px;
}
.board-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.board-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.board-toolbar {
  margin-bottom: 12px;
}
.board-write-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}
.board-write-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.board-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.board-empty {
  text-align: center;
  color: var(--text-3);
  padding: 32px 0;
  font-size: 14px;
}
.board-post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.board-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.board-post-author {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.board-post-date {
  font-size: 11px;
  color: var(--text-3);
}
.board-post-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
}
.board-reply {
  background: var(--bg);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  padding: 8px 10px;
  margin: 6px 0;
  font-size: 13px;
}
.board-reply-author {
  font-weight: 700;
  color: var(--primary);
  margin-right: 8px;
}
.board-reply-content { color: var(--text); }
.board-reply-date { font-size: 11px; color: var(--text-3); margin-left: 6px; }
.board-reply-form {
  margin-top: 8px;
}

/* ── Board desc / 건의함 추가 ── */
.board-desc {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
  margin: -8px 0 14px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}
.board-reply-pending {
  font-size: 12px;
  color: var(--text-3);
  margin: 6px 0 4px;
}
.school-badge {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
}
