/* ============================
   管理后台 — 额外样式
   ============================ */

/* Admin link in header */
.admin-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent2);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--accent2);
  padding: 4px 16px;
  border-radius: 16px;
  transition: background 0.2s, color 0.2s;
}
.admin-link:hover {
  background: var(--accent2);
  color: #111;
}

/* Stats bar */
.stats-bar {
  text-align: center;
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ===== Admin Layout ===== */
.admin-main {
  margin-top: 28px;
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover {
  color: #fff;
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Panels */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-header h3 {
  color: #fff;
  font-size: 1.1rem;
  margin: 0;
}
.inline-search {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  min-width: 180px;
}
.inline-search:focus {
  border-color: var(--accent);
}
.inline-select {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}
.inline-select:focus {
  border-color: var(--accent);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
thead {
  background: var(--bg-card);
}
th {
  padding: 12px 14px;
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
tbody tr:hover {
  background: rgba(255,255,255,0.03);
}
tbody tr:last-child td {
  border-bottom: none;
}

/* Table badges */
.status-in-tuan { color: #2ecc71; font-weight: 600; }
.status-graduate { color: #f39c12; font-weight: 600; }
.status-rest { color: #e74c3c; font-weight: 600; }
.status-quit { color: #c0392b; font-weight: 600; }

/* Action buttons in table */
.btn-sm {
  padding: 4px 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: opacity 0.2s;
}
.btn-sm:hover { opacity: 0.85; }
.btn-danger {
  background: rgba(255,71,87,0.2);
  color: #ff4757;
}
.btn-edit {
  background: rgba(254,202,87,0.2);
  color: #feca57;
}

/* ===== CRUD Forms ===== */
.crud-form {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.crud-form h3 {
  color: #fff;
  margin-bottom: 4px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-row label {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
}
.req { color: #ff4757; }
.form-row input,
.form-row select,
.form-row textarea {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--accent);
}
.form-row input[type="color"] {
  height: 40px;
  padding: 4px 8px;
  cursor: pointer;
}

.btn-primary {
  padding: 12px 24px;
  border-radius: 24px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover {
  background: #ff5252;
}

.form-msg {
  font-size: 0.85rem;
  min-height: 20px;
}
.form-msg.success { color: #2ecc71; }
.form-msg.error { color: #ff4757; }

/* Batch import */
.batch-section {
  margin-top: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.batch-section summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.batch-section textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.82rem;
  font-family: 'SF Mono', Monaco, monospace;
  outline: none;
  resize: vertical;
}
.batch-section textarea:focus {
  border-color: var(--accent);
}

/* Confirm dialog */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.confirm-box {
  background: var(--bg-modal);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow);
  text-align: center;
}
.confirm-box p {
  margin-bottom: 20px;
  font-size: 0.95rem;
}
.confirm-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-cancel {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.btn-confirm-danger {
  padding: 8px 20px;
  border-radius: 20px;
  border: none;
  background: #ff4757;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 640px) {
  .admin-tabs {
    gap: 2px;
  }
  .tab-btn {
    padding: 8px 12px;
    font-size: 0.78rem;
  }
  th, td {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
}
