* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

header {
  padding: 30px 0 20px;
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.header-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}

/* Card */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: #1a1a1a;
}

.card-hint {
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* Form */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: #fff;
}

input:focus, select:focus {
  outline: none;
  border-color: #4f46e5;
}

button {
  padding: 10px 20px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #4338ca;
}

.btn-outline {
  background: #fff;
  color: #4f46e5;
  border: 1px solid #4f46e5;
}

.btn-outline:hover {
  background: #f5f3ff;
}

.btn-danger {
  background: #ef4444;
}

.btn-danger:hover {
  background: #dc2626;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-add {
  background: #008CBA;
}

.btn-add:hover {
  background: #007B9A;
}

/* API test */
.api-test-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.api-test-row input {
  flex: 1;
}

.result {
  padding: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  word-break: break-all;
  font-family: monospace;
  font-size: 0.85rem;
  margin-top: 12px;
}

.result pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.result.error {
  background: #fef2f2;
  border-color: #fecaca;
}

.hidden {
  display: none !important;
}

/* Search */
.search-box {
  display: flex;
  gap: 8px;
}

.search-box input {
  flex: 1;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

th {
  background: #f9fafb;
  font-weight: 600;
}

tr:hover {
  background: #f9fafb;
}

.status-active {
  color: #22c55e;
  font-weight: 600;
}

.status-inactive {
  color: #ef4444;
  font-weight: 600;
}

.actions-cell {
  display: flex;
  gap: 6px;
}

.actions-cell button {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.empty {
  text-align: center;
  padding: 40px 0;
  color: #999;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 90%;
  max-width: 420px;
}

.modal-content h3 {
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* Login page */
.login-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  text-align: center;
}

.login-card h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.login-subtitle {
  color: #888;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.login-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-bottom: 12px;
  min-height: 20px;
}

.login-card button {
  width: 100%;
}

.login-card .form-group {
  margin-bottom: 16px;
}

.hint {
  font-size: 0.8rem;
  color: #999;
  margin-top: 16px;
}

/* Copy toast */
.copy-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 0.85rem;
  z-index: 2000;
  animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 12px; }
  .header-row { flex-direction: column; gap: 8px; }
  th, td { font-size: 0.8rem; padding: 8px 4px; }
  .actions-cell { flex-direction: column; }
}
