:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --primary-25: #fff7ed;
  --primary-50: #ffedd5;
  --primary-100: #fed7aa;
  --primary-200: #fdba74;
  --primary-400: #fb923c;
  --primary-500: #f97316;
  --primary-600: #ea580c;
  --primary-700: #c2410c;
  --text-strong: #2d1f12;
  --text-muted: #7a695c;
  --card-shadow: rgba(191, 90, 12, 0.15);
  --glow: rgba(249, 115, 22, 0.18);
  background-color: var(--primary-25);
  color: var(--text-strong);
}

body {
  margin: 0;
  min-height: 100vh;
}

body.has-modal {
  overflow: hidden;
}

.page-root {
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  box-sizing: border-box;
}

.container {
  background: #fff;
  padding: 3rem 4rem;
  border-radius: 16px;
  box-shadow: 0 20px 45px var(--card-shadow);
  width: min(1120px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.container.narrow {
  width: min(520px, 100%);
  text-align: center;
}

h1 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary-600);
}

p {
  line-height: 1.6;
  margin: 0 0 0.75rem;
}

.form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

label {
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid #d7d9e0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
  color: #fff;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(234, 88, 12, 0.28);
}

.error {
  color: #d14343;
  font-weight: 600;
  margin: 0;
}

.footnote {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.container .btn.primary {
  align-self: center;
}

.profile {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  text-align: left;
  position: relative;
  overflow: visible;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile .welcome {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.profile .email {
  color: var(--text-muted);
  margin: 0;
}

.profile-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.branch-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  background: rgba(249, 115, 22, 0.08);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.branch-filter-option input {
  accent-color: var(--primary-600);
}


.students header {
  text-align: left;
  margin-bottom: 1rem;
}

.students h2 {
  margin: 0 0 0.5rem;
  color: var(--primary-700);
}

.students .sub {
  margin: 0;
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(191, 90, 12, 0.12);
}

thead {
  background: var(--primary-50);
}

th,
td {
  padding: 0.9rem 1rem;
  text-align: left;
  font-size: 0.95rem;
}

tbody tr:nth-child(odd) {
  background: rgba(254, 215, 170, 0.35);
}

tbody tr:hover {
  background: rgba(249, 115, 22, 0.12);
}

.empty {
  text-align: center;
  margin: 2rem 0 0;
}

.btn.primary {
  align-self: flex-start;
}

.quick-links h2 {
  margin: 0 0 1rem;
  color: var(--primary-700);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 15px 30px rgba(191, 90, 12, 0.12);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid rgba(249, 115, 22, 0.12);
}

.card h3 {
  margin: 0;
  color: var(--primary-700);
}

.card p {
  margin: 0;
  color: var(--text-muted);
  min-height: 60px;
}

.btn.secondary {
  background: rgba(249, 115, 22, 0.12);
  color: var(--primary-600);
}

.btn.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.22);
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tab-btn {
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(249, 115, 22, 0.28);
  background: rgba(249, 115, 22, 0.08);
  color: var(--primary-600);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.26);
}

.tab-panels {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.tab-panel.active {
  display: flex;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filters-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 240px;
  min-width: 240px;
}

.student-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
}

.student-search-inline {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 0.4rem;
}

.student-search-inline input {
  width: 200px;
  padding: 0.55rem 2.2rem 0.55rem 0.9rem;
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.85);
  font-size: 0.95rem;
  color: var(--primary-700);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.student-search-inline input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.student-search-inline-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.panel-header .branch-filter-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
  width: auto;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  background: rgba(249, 115, 22, 0.08);
  color: var(--primary-600);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.18);
}

.chip.active {
  background: var(--primary-600);
  color: #fff;
  border-color: transparent;
}

.student-filters .chip {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: var(--primary-600);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.student-filters .chip:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(249, 115, 22, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.12);
}

.student-filters .chip.active {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.25);
  transition: none;
}

/* 이름 셀 내 출석 상태 점 (Slack 스타일) */
.name-with-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.status-dot.status-active {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-dot.status-inactive {
  background: transparent;
  border: 2px solid #10b981;
  opacity: 0.4;
}

#consult-visit-filter {
  transition: all 0.2s ease;
}

#consult-visit-filter.active {
  background: var(--primary-600);
  color: #fff;
  border-color: var(--primary-600);
  box-shadow: 0 6px 14px rgba(234, 88, 12, 0.25);
}

.registration-dot {
  border: none;
}

.registration-dot-registered {
  background: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.25);
}

.registration-dot-unregistered {
  background: transparent;
  border: 2px solid #f97316;
  opacity: 0.5;
}


.table-wrapper {
  border: 1px solid rgba(249, 115, 22, 0.16);
  border-radius: 16px;
  overflow-x: auto;
  background: #fff;
  padding: 0;
  min-height: 400px;
}

.table-wrapper table {
  margin: 0;
  border-radius: 16px;
}

.table-wrapper > .muted {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 2rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  background: rgba(72, 36, 12, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(194, 65, 12, 0.24);
  width: min(600px, 95%);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal.small {
  width: min(540px, 90%);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(249, 115, 22, 0.12);
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.95) 0%, rgba(255, 237, 213, 0.95) 100%);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-700);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 2rem;
  overflow-y: auto;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-strong);
}

.modal-body input[type="text"],
.modal-body input[type="tel"],
.modal-body input[type="email"],
.modal-body input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(249, 115, 22, 0.2);
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #fff;
}

.modal-body input[type="text"]:focus,
.modal-body input[type="tel"]:focus,
.modal-body input[type="email"]:focus,
.modal-body input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.branch-fieldset {
  border: 1px solid rgba(249, 115, 22, 0.15);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 247, 237, 0.5);
}

.branch-fieldset legend {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-700);
  padding: 0 0.5rem;
}

.branches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.branch-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 0.9rem;
}

.branch-option:hover {
  background: rgba(249, 115, 22, 0.08);
}

.branch-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-500);
}

.modal.wide {
  width: min(760px, 100%);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(249, 115, 22, 0.12);
}

.modal-message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 0;
}

.modal-message:not(:empty) {
  background: rgba(249, 115, 22, 0.1);
  color: var(--primary-700);
}

.modal-message.error {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.modal-message.success {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(249, 115, 22, 0.1);
  color: var(--primary-600);
}



.payment-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.payment-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(249, 115, 22, 0.16);
  border-radius: 16px;
  padding: 1.5rem;
  background: rgba(255, 247, 237, 0.92);
  box-shadow: 0 12px 24px rgba(234, 88, 12, 0.08);
}

.payment-form-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-700);
}

.payment-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.payment-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.payment-field input,
.payment-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  background: #fff;
  color: var(--primary-700);
  box-shadow: inset 0 1px 2px rgba(234, 88, 12, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.payment-field input:focus,
.payment-field textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.payment-field textarea {
  min-height: 110px;
  resize: vertical;
}


.payment-field select {
  appearance: none;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  background: #fff;
  font-size: 0.95rem;
  color: var(--primary-700);
  box-shadow: inset 0 1px 2px rgba(234, 88, 12, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.payment-field select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.payment-field select::-ms-expand {
  display: none;
}

.payment-field select {
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%226%22 viewBox=%220 0 10 6%22%3E%3Cpath fill=%22%23ea580c%22 d=%22M5 6L0 0h10z%22/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 10px 6px;
}
.payment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.payment-message {
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.payment-message.error {
  color: #d14343;
}

.payment-message.success {
  color: #188038;
}

.payment-history {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}


.payment-history-count {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.payment-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.payment-history h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--primary-700);
}

.payment-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 320px;
  overflow-y: auto;
}

.payment-history-card {
  border: 1px solid rgba(249, 115, 22, 0.16);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  background: #fff;
  box-shadow: 0 10px 20px rgba(234, 88, 12, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.payment-history-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.payment-history-amount {
  margin: 0;
  font-weight: 700;
  color: var(--primary-700);
  font-size: 1rem;
}

.payment-history-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.payment-history-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.payment-history-details li strong {
  font-weight: 600;
  color: var(--primary-600);
}



.btn.small {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.btn.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  border: none;
}

.btn.danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

.payment-history-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.counsel-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
}

.counsel-history h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--primary-700);
}

.counsel-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem;
  background: rgba(255, 247, 237, 0.5);
  border-radius: 12px;
}

.counsel-card {
  border: 1px solid rgba(249, 115, 22, 0.16);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: #fff;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.06);
}

.counsel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.counsel-card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.counsel-card-content {
  font-size: 0.9rem;
  color: var(--text-strong);
  white-space: pre-wrap;
  margin: 0;
}

.counsel-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid rgba(249, 115, 22, 0.16);
  border-radius: 16px;
  padding: 1.5rem;
  background: rgba(255, 247, 237, 0.92);
  box-shadow: 0 12px 24px rgba(234, 88, 12, 0.08);
}

.counsel-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: nowrap;
  width: 100%;
}

.counsel-form-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-700);
  white-space: nowrap;
}

.counsel-method-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  justify-content: flex-end;
  text-align: right;
}

.counsel-method-inline select {
  appearance: none;
  border: 2px solid rgba(249, 115, 22, 0.25);
  border-radius: 10px;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: #fff;
  color: var(--primary-700);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.08);
  transition: all 0.2s ease;
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%226%22 viewBox=%220 0 10 6%22%3E%3Cpath fill=%22%23ea580c%22 d=%22M5 6L0 0h10z%22/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 10px 6px;
  min-width: 100px;
}

.counsel-method-inline select:hover {
  border-color: rgba(249, 115, 22, 0.4);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.12);
}

.counsel-method-inline select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.counsel-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-strong);
}

.counsel-field input,
.counsel-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  background: #fff;
  color: var(--primary-700);
  box-shadow: inset 0 1px 2px rgba(234, 88, 12, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.counsel-field input:focus,
.counsel-field textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.counsel-field textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

.counsel-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.counsel-message {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  min-height: 0;
}

.counsel-message.error {
  color: #d14343;
}

.counsel-message.success {
  color: #188038;
}
.modal-footer {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(249, 115, 22, 0.15);
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  color: var(--text-muted);
}

.modal-message {
  min-height: 1.25rem;
  font-size: 0.9rem;
  color: #d14343;
}

.action-body {
  gap: 1.5rem;
}

.action-summary {
  margin: 0;
  font-weight: 600;
  color: var(--primary-700);
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.action-buttons .btn {
  width: 100%;
}

.student-search {
  gap: 1.25rem;
}

.student-search-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.student-search-form input {
  flex: 1;
}

.student-search-submit {
  padding-inline: 1.1rem;
  flex-shrink: 0;
}

.student-search-results {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.student-search-results p {
  margin: 0;
}

.student-table {
  margin: 0;
  box-shadow: none;
  border: 1px solid rgba(249, 115, 22, 0.16);
}

.student-table thead {
  background: var(--primary-50);
}

.student-table tbody tr:nth-child(odd) {
  background: rgba(254, 215, 170, 0.25);
}

.student-table tbody tr:hover {
  background: rgba(249, 115, 22, 0.12);
}

.student-table th.name-cell,
.student-table td.name-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 신규상담 탭의 이름 컬럼 */
#consults-container .student-table th:first-child,
#consults-container .student-table td:first-child {
  max-width: 6ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-table td.name-cell.interactive {
  color: var(--primary-600);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(249, 115, 22, 0.55);
  text-decoration-thickness: 2px;
}

.student-table td.name-cell.interactive:focus,
.student-table td.name-cell.interactive:hover {
  color: var(--primary-700);
  text-decoration-color: var(--primary-600);
}

.student-table th.grade-cell,
.student-table td.grade-cell {
  width: 4ch;
  max-width: 4ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.student-table th.branch-cell,
.student-table td.branch-cell,
.student-table th.state-cell,
.student-table td.state-cell {
  width: 6ch;
  max-width: 6ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 재원생 테이블 컬럼 폭 고정 */
#students-container .student-table {
  table-layout: fixed;
  width: 100%;
}

#students-container .student-table th,
#students-container .student-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.6rem 0.6rem;
}

#students-container .student-table th.name-cell,
#students-container .student-table td.name-cell {
  width: 7%;
  min-width: 70px;
  max-width: 110px;
  padding: 0.5rem 0.45rem;
}

#students-container .student-table th:nth-child(1),
#students-container .student-table td:nth-child(1) {
  min-width: 70px;
  max-width: 110px;
}

#students-container .student-table th:nth-child(2),
#students-container .student-table td:nth-child(2) {
  min-width: 55px;
  max-width: 80px;
  text-align: center;
}

#students-container .student-table th:nth-child(3),
#students-container .student-table td:nth-child(3) {
  min-width: 100px;
  max-width: 140px;
}

#students-container .student-table th:nth-child(4),
#students-container .student-table td:nth-child(4) {
  min-width: 70px;
  max-width: 90px;
}

#students-container .student-table th:nth-child(5),
#students-container .student-table td:nth-child(5) {
  min-width: 70px;
  max-width: 90px;
}

#students-container .student-table th:nth-child(6),
#students-container .student-table td:nth-child(6) {
  min-width: 90px;
  max-width: 120px;
}

#students-container .student-table th:nth-child(7),
#students-container .student-table td:nth-child(7) {
  min-width: 80px;
  max-width: 110px;
}

#students-container .student-table th:nth-child(8),
#students-container .student-table td:nth-child(8) {
  min-width: 70px;
  max-width: 90px;
}

#students-container .student-table th:nth-child(9),
#students-container .student-table td:nth-child(9) {
  min-width: 190px;
  max-width: 260px;
}

.branches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin-top: 0.5rem;
}


.branch-fieldset .branches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 520px) {
  .branch-fieldset .branches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.branch-fieldset .branch-option {
  justify-self: start;
}
.branch-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  background: rgba(249, 115, 22, 0.12);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary-700);
  box-sizing: border-box;
}

.branch-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary-600);
  margin: 0;
}

.branch-option span {
  white-space: nowrap;
}

.sms-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sms-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-strong);
}

.sms-field input,
.sms-field select,
.sms-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  background: #fff;
  color: var(--primary-700);
  box-shadow: inset 0 1px 2px rgba(234, 88, 12, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}


.sms-field input:focus,
.sms-field select:focus,
.sms-field textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.sms-field textarea {
  min-height: 180px;
  resize: vertical;
  font-family: inherit;
}

.sms-field select {
  appearance: none;
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%226%22 viewBox=%220 0 10 6%22%3E%3Cpath fill=%22%23ea580c%22 d=%22M5 6L0 0h10z%22/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 10px 6px;
  cursor: pointer;
}

.sms-byte-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: -0.2rem;
}

.sms-byte-count.warning {
  color: #ea580c;
  font-weight: 600;
}

.sms-byte-count.error {
  color: #dc2626;
  font-weight: 700;
}

.sms-message {
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.sms-message.error {
  color: #d14343;
}

.sms-message.success {
  color: #188038;
}

.sms-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-700);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-200);
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-strong);
  font-size: 0.9rem;
}

.profile-field input,
.profile-field select,
.profile-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  background: #fff;
  color: var(--primary-700);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-field input:focus,
.profile-field select:focus,
.profile-field textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

#profile-phones-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.phone-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
  padding: 1rem;
  border: 1px solid rgba(249, 115, 22, 0.16);
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.5);
}

.phone-item label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-strong);
  font-size: 0.9rem;
}

.shortlink-table {
  width: 100%;
  table-layout: auto;
}

.shortlink-name {
  max-width: 12ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shortlink-last-click {
  max-width: 16ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.shortlink-count {
  text-align: right;
  font-weight: 600;
  color: var(--text-strong);
}

.shortlink-name-value {
  cursor: pointer;
  color: var(--primary-600);
  font-weight: 600;
}

.shortlink-name-value:hover,
.shortlink-name-value:focus-visible {
  text-decoration: underline;
}

.shortlink-url {
  max-width: 20ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shortlink-url a {
  display: inline-block;
  max-width: 100%;
  white-space: inherit;
  overflow: inherit;
  text-overflow: inherit;
  color: var(--primary-600);
  text-decoration: none;
}

.shortlink-url a:hover {
  text-decoration: underline;
}

.shortlink-owner {
  max-width: 12ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-item input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  background: #fff;
  color: var(--primary-700);
}

.phone-item input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}

.phone-item .btn {
  padding: 0.6rem 1rem;
}

/* Skeleton UI for loading state */
.skeleton-table {
  width: 100%;
  border-collapse: collapse;
}

.skeleton-table thead th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-strong);
  border-bottom: 2px solid var(--primary-100);
}

.skeleton-table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--primary-50);
}

.skeleton-row {
  height: 45px;
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--primary-50) 0%,
    var(--primary-100) 50%,
    var(--primary-50) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 16px;
}

.skeleton-shimmer.short {
  width: 60%;
}

.skeleton-shimmer.medium {
  width: 80%;
}

.skeleton-shimmer.long {
  width: 100%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 신규상담 테이블 컬럼 폭 조정 */
#consults-container .student-table th:nth-child(2),
#consults-container .student-table td:nth-child(2) {
  /* 학년 컬럼 - 2글자 한줄 표시 */
  min-width: 3ch;
  max-width: 4ch;
  white-space: nowrap;
}

#consults-container .student-table th:nth-child(3),
#consults-container .student-table td:nth-child(3) {
  /* 학교 컬럼 - 70% 축소, ... 처리 */
  max-width: 8ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#consults-container .student-table th:nth-child(4),
#consults-container .student-table td:nth-child(4) {
  /* 상담일시 컬럼 - 넓게 */
  min-width: 9ch;
  white-space: nowrap;
}

#consults-container .student-table th:nth-child(5),
#consults-container .student-table td:nth-child(5) {
  /* 상담자 컬럼 - 3글자 한줄 표시 */
  min-width: 4ch;
  max-width: 5ch;
  white-space: nowrap;
}

#consults-container .student-table th:nth-child(8),
#consults-container .student-table td:nth-child(8) {
  /* 상담 내용 컬럼 */
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 모달 내 상담 기록 테이블 스타일 */
#consult-detail-modal #consult-history-table th:nth-child(4),
#consult-detail-modal #consult-history-table td:nth-child(4) {
  /* 상담 내용 컬럼 */
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#consult-detail-modal .consult-history .table-wrapper {
  overflow-x: auto;
}

#consult-detail-modal #consult-history-table {
  width: 100%;
  table-layout: auto;
}

/* Student filters */
.student-filters,
.teacher-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  border: 1.5px solid var(--primary-200);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.5);
}

.filter-group-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  padding-right: 0.5rem;
  border-right: 1.5px solid var(--primary-200);
}

.filter-group-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-group-buttons .chip {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.branch-filter-list,
.state-filter-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.pagination-btn {
  padding: 0.5rem 1rem;
  background: var(--primary-500);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary-600);
}

.pagination-btn:disabled {
  background: var(--primary-100);
  color: var(--text-muted);
  cursor: not-allowed;
}

.pagination-info {
  font-weight: 600;
  color: var(--text-strong);
  min-width: 80px;
  text-align: center;
}

/* Column header filters */
.filterable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px !important;
  overflow: visible !important;
}

.filterable-header::after {
  content: "▼";
  position: absolute;
  right: 8px;
  font-size: 0.7em;
  opacity: 0.5;
}

.filterable-header:hover {
  background: var(--primary-50);
}

.filterable-header.filtered::after {
  opacity: 1;
  color: var(--primary-600);
}

.column-filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid var(--primary-200);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 10000;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.column-filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.column-filter-option:hover {
  background: var(--primary-50);
}

.column-filter-option input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary-500);
}

/* Readonly input styling */
input[readonly],
textarea[readonly] {
  background-color: #f5f5f5 !important;
  color: #666 !important;
  cursor: not-allowed !important;
  border-color: #e0e0e0 !important;
}

input[readonly]:focus,
textarea[readonly]:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: #e0e0e0 !important;
}

/* Lessons tab */
.lesson-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.lesson-search-column {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(251, 146, 60, 0.08));
  border: 1px solid rgba(249, 115, 22, 0.2);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 10px 28px rgba(234, 88, 12, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lesson-search-column input[type="search"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
}

.lesson-search-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.lesson-search-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(249, 115, 22, 0.15);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lesson-search-item:hover {
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: 0 8px 16px rgba(234, 88, 12, 0.15);
  transform: translateY(-1px);
}

.lesson-form-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lesson-form-card,
.lesson-history-card {
  background: #fff;
  border: 1px solid rgba(249, 115, 22, 0.18);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(234, 88, 12, 0.12);
  padding: 1.1rem 1.25rem;
}

.lesson-table-wrapper {
  width: 100%;
}

.lesson-table-scroll {
  overflow-x: auto;
}

.lesson-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  table-layout: fixed;
}

.lesson-table th,
.lesson-table td {
  border: 1px solid #f2f2f2;
  padding: 0.4rem;
  vertical-align: top;
}

.lesson-table th {
  background: #fff7ed;
  color: #7a4a24;
  font-weight: 800;
  font-size: 0.9rem;
  position: sticky;
  top: 0;
  z-index: 1;
}

.lesson-table input,
.lesson-table textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
}

.lesson-table textarea {
  resize: vertical;
  min-height: 52px;
}

.lesson-name-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.lesson-name-label .muted {
  font-size: 0.85rem;
}

.lesson-weekday-display {
  margin-top: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lesson-date-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lesson-col-date { width: 12%; }
.lesson-col-absent { width: 7%; }
.lesson-col-progress { width: 20%; }
.lesson-col-remaining { width: 9%; }
.lesson-col-remark { width: 13%; }
.lesson-col-homework { width: 13%; }
.lesson-col-parent { width: 19%; }
.lesson-col-actions { width: 7%; }

.lesson-row-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lesson-row-actions .row-message {
  font-size: 0.8rem;
  min-height: 1.1rem;
  color: var(--text-muted);
}

.lesson-row-actions .row-message.success {
  color: #0f9d58;
}

.lesson-row-actions .row-message.error {
  color: #d14343;
}

.lesson-row-actions .row-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
}

.lesson-history-card {
  margin-top: 1rem;
}

.lesson-form-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.lesson-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.lesson-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.lesson-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
}

.lesson-field input,
.lesson-field textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.lesson-field textarea {
  resize: vertical;
}

.lesson-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.lesson-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
}

.lesson-message {
  margin: 0;
  color: var(--text-muted);
  min-height: 1.2rem;
  font-weight: 600;
}

.lesson-message.success {
  color: #0f9d58;
}

.lesson-message.error {
  color: #d14343;
}

.lesson-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.lesson-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.lesson-history-item {
  border: 1px solid rgba(249, 115, 22, 0.15);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: rgba(249, 115, 22, 0.03);
}

.lesson-history-item h4 {
  margin: 0 0 0.25rem 0;
}

.lesson-history-item p {
  margin: 0.2rem 0;
}

@media (max-width: 960px) {
  .lesson-layout {
    flex-direction: column;
  }
}
