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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #f5f7fb, #e3f2fd);
  color: #1f2933;
  min-height: 100vh;
}

.header {
  padding: 24px 16px 8px;
  text-align: center;
}

.header h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 14px;
  color: #60748a;
}

/* Magic Link 登入區塊 */
.auth-section {
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.login-form input[type="email"] {
  border-radius: 8px;
  border: 1px solid #cbd2e1;
  padding: 8px 12px;
  font-size: 14px;
  min-width: 200px;
}

.login-form input[type="email"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb33;
}

#send-magic-link {
  background: #7c3aed;
  color: #ffffff;
}

#send-magic-link:hover:not(:disabled) {
  background: #6d28d9;
}

.login-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-status span {
  font-size: 14px;
  color: #374957;
}

#user-email {
  font-weight: 600;
  color: #1f2933;
}

#logout-btn {
  background: #64748b;
  color: #ffffff;
}

#logout-btn:hover {
  background: #475569;
}

.auth-message {
  margin-top: 8px;
  font-size: 13px;
  min-height: 20px;
}

.auth-message.success {
  color: #166534;
}

.auth-message.error {
  color: #b91c1c;
}

.layout {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 16px 18px 18px;
}

.card h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.field span {
  color: #374957;
}

input[type="text"],
input[type="number"] {
  border-radius: 8px;
  border: 1px solid #cbd2e1;
  padding: 8px 10px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb33;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#submit-button {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
}

#submit-button:hover:not(:disabled) {
  background: #1d4ed8;
}

.secondary-button {
  background: #edf2f7;
  color: #1f2933;
}

.secondary-button:hover:not(:disabled) {
  background: #d9e2ec;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.table-wrapper {
  max-height: 420px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #e0e7ff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead {
  background: #eff3ff;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table th,
.table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  white-space: nowrap;
}

.table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

.table tbody tr:hover {
  background-color: #e5edff;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.table-actions button {
  padding-inline: 10px;
}

.edit-button {
  background: #0ea5e9;
  color: #ffffff;
}

.edit-button:hover {
  background: #0284c7;
}

.delete-button {
  background: #f97373;
  color: #ffffff;
}

.delete-button:hover {
  background: #ef4444;
}

.message {
  min-height: 20px;
  font-size: 13px;
  margin-bottom: 6px;
}

.message.error {
  color: #b91c1c;
}

.message.success {
  color: #166534;
}

.empty-text {
  font-size: 13px;
  color: #6b7280;
}

