/* === Settings Layout === */
.settings-layout {
  display: flex;
  gap: 20px;
  min-height: calc(100vh - var(--topbar-height) - 48px);
}

.settings-nav {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 8px;
  align-self: flex-start;
  position: sticky;
  top: 0;
}

.settings-nav-item {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
}

.settings-nav-item:hover { background: var(--bg); }
.settings-nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.vip-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-content {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}

.settings-section {
  display: none;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: fadeIn 0.25s ease;
}

.settings-section.active { display: block; }

.settings-section-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.settings-sub-title {
  font-size: 14px;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--text);
}

/* === Toast === */
.settings-toast {
  position: fixed;
  top: 70px;
  right: 30px;
  background: #22c55e;
  color: #fff;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s;
  z-index: 999;
  pointer-events: none;
}

.settings-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* === Form Elements === */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  max-width: 400px;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.2s;
  outline: none;
  font-family: inherit;
}

.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,0.1); }

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row .form-input { max-width: 100%; }

/* Color Picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-color {
  width: 40px;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}

.color-value {
  font-size: 13px;
  color: var(--text-light);
  font-family: monospace;
}

.color-presets {
  display: flex;
  gap: 6px;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
}

.color-dot:hover { transform: scale(1.15); }
.color-dot.active { border-color: var(--text); }

/* === Nav Editor === */
.nav-editor-list { display: flex; flex-direction: column; gap: 8px; }

.nav-editor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-editor-item:hover { background: #f0f4ff; }

.nav-editor-item .drag-handle {
  cursor: grab;
  color: var(--text-light);
  font-size: 16px;
  user-select: none;
}

.nav-editor-item .nav-ed-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.nav-editor-item .nav-ed-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  min-width: 80px;
}

.nav-editor-item .nav-ed-input:focus { border-color: var(--primary); }

/* === Toggle Switch === */
.toggle-list { display: flex; flex-direction: column; gap: 4px; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}

.toggle-row:last-child { border-bottom: none; }

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* === Buttons - 由 style.css 统一管理，settings 页面不再重复定义 === */

/* === Dept Editor === */
.dept-editor-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fafbfc;
}

.dept-editor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.dept-editor-header .form-input { max-width: 160px; }

.dept-editor-members { margin-left: 16px; }

.member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.member-row .form-input { max-width: 120px; }

/* === Data Actions === */
.data-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.data-action-card {
  text-align: center;
  padding: 24px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafbfc;
}

.data-action-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.data-action-card h3 { font-size: 15px; margin-bottom: 6px; }
.data-action-card p { font-size: 12px; color: var(--text-light); margin-bottom: 14px; }

/* === Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--white);
  border-radius: 10px;
  padding: 28px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.modal-box h3 { font-size: 16px; margin-bottom: 10px; }
.modal-box p { font-size: 14px; color: var(--text-light); margin-bottom: 20px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* === Responsive === */
@media (max-width: 768px) {
  .settings-layout { flex-direction: column; }
  .settings-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    position: static;
  }
  .form-row { grid-template-columns: 1fr; }
  .data-actions { grid-template-columns: 1fr; }
}

/* === Permission Matrix === */
.perm-matrix { font-size: 12px; }
.perm-matrix th, .perm-matrix td { padding: 6px 10px; text-align: center; white-space: nowrap; }
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; font-weight: 500; }
.perm-matrix thead th { background: #f8f9ff; font-size: 11px; }
.perm-matrix .perm-group-row td { background: #f0f4ff; font-weight: 600; font-size: 12px; color: var(--primary); }
.perm-matrix input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; width: 15px; height: 15px; }
.perm-matrix input[type="checkbox"]:disabled { opacity: 0.5; cursor: default; }

.role-del-btn {
  background: none; border: none; color: #ef4444; cursor: pointer; font-size: 11px; margin-left: 4px;
}
.role-del-btn:hover { text-decoration: underline; }

/* Account status */
.acc-status-on { color: #16a34a; font-weight: 500; }
.acc-status-off { color: #ef4444; font-weight: 500; }

/* === School URL Config === */
.school-url-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.school-url-item .school-name { font-weight: 600; min-width: 120px; }
.school-url-item .school-url { flex: 1; color: var(--primary); word-break: break-all; }
.school-url-item .school-url a { color: var(--primary); text-decoration: none; }
.school-url-item .school-url a:hover { text-decoration: underline; }

/* === Service Type Config === */
.svc-type-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fafbfc;
}

.svc-type-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.svc-type-header h4 { font-size: 14px; font-weight: 600; color: var(--primary); }

.svc-sub-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.svc-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--white);
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 13px;
}

.svc-sub-item .svc-sub-name { font-weight: 500; min-width: 80px; }
.svc-sub-item .svc-sub-tags { display: flex; gap: 4px; flex: 1; }
.svc-sub-item .svc-sub-tag { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #ede9fe; color: #7c3aed; }

/* Service editor in student form */
.svc-editor-list { display: flex; flex-direction: column; gap: 6px; }

.svc-editor-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 12px;
  flex-wrap: wrap;
}

.svc-editor-item select, .svc-editor-item input[type="date"] {
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
}

.svc-add-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
