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

:root {
  --bg: #eef2f8;
  --surface: rgba(255, 255, 255, 0.92);
  --border: rgba(180, 200, 230, 0.5);
  --text: #1d2939;
  --text-secondary: #4a5568;
  --accent: #2b5ea7;
  --accent-hover: #1e4a8a;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(30, 58, 138, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/bg.png') center center / cover no-repeat;
  opacity: 1;
  z-index: -1;
  pointer-events: none;
}

.container {
  max-w: 1400px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
}

.header {
  margin-bottom: 24px;
}

.header h1 {
  color: #f6d27a;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px rgba(76, 12, 10, 0.72);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filters select,
.filters input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text);
  min-width: 140px;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

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

.btn-primary:hover { background: var(--accent-hover); }

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

.btn-secondary:hover { background: #f3f4f6; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover { background: #f3f4f6; }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead { background: #f9fafb; }

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f3f5;
}

tr:last-child td { border-bottom: none; }
tr:hover { background: #f9fafb; }

.td-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state p:first-child { font-size: 1rem; margin-bottom: 8px; }
.hint { font-size: 0.8rem; color: #98a2b3; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
}

.pagination button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-ellipsis {
  font-size: 0.8rem;
  color: #98a2b3;
  padding: 0 4px;
  user-select: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-lg { max-width: 800px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 { font-size: 1.1rem; font-weight: 600; }

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.preview-body {
  text-align: center;
}

.preview-body img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-gold { background: #fef3c7; color: #92400e; }
.badge-silver { background: #e5e7eb; color: #374151; }
.badge-bronze { background: #fed7aa; color: #9a3412; }
.badge-merit { background: #dbeafe; color: #1e40af; }

.loading { opacity: 0.5; pointer-events: none; }

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
}
.btn-danger:hover { background: #dc2626; }
.btn-danger-active { background: #dc2626; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.batch-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 6px;
}

.action-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.table-note {
  margin-top: 12px;
  font-size: 0.8rem;
  color: #f97316;
  text-align: center;
}
