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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e0e0e0;
  min-height: 100vh;
}

header {
  background: #1a1d27;
  border-bottom: 1px solid #2a2d3a;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: #5865f2;
  color: #fff;
}

.btn-danger {
  background: #ed4245;
  color: #fff;
}

.btn-secondary {
  background: #2a2d3a;
  color: #e0e0e0;
  border: 1px solid #3a3d4a;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-subtitle {
  color: #888;
  font-size: 0.875rem;
  margin-bottom: 24px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.persona-card {
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.persona-card.inactive {
  opacity: 0.5;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-emoji {
  font-size: 2rem;
  line-height: 1;
}

.card-info { flex: 1; }

.card-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.card-slug {
  font-size: 0.75rem;
  color: #888;
  font-family: monospace;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-gemini { background: #1a3a5c; color: #60a5fa; }
.badge-claude { background: #3a1a2a; color: #f472b6; }
.badge-openai { background: #1a3a2a; color: #34d399; }
.badge-default { background: #2a2a1a; color: #fbbf24; }

.card-description {
  font-size: 0.8rem;
  color: #aaa;
}

.card-commands {
  font-size: 0.78rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: #7dd3fc;
  background: #0c1929;
  border-radius: 4px;
  padding: 4px 8px;
}

.card-prompt {
  font-size: 0.8rem;
  color: #ccc;
  background: #12141c;
  border-radius: 6px;
  padding: 10px;
  line-height: 1.5;
  max-height: 80px;
  overflow: hidden;
  position: relative;
}

.card-prompt::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(transparent, #12141c);
}

.card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: #666;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.card-actions .btn {
  flex: 1;
  justify-content: center;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: #666;
}

.empty-state h2 { font-size: 1.1rem; margin-bottom: 8px; color: #888; }

/* ---- edit page ---- */
.form-container {
  max-width: 640px;
  margin: 0 auto;
}

.form-section {
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}

.form-section h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2d3a;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #aaa;
  margin-bottom: 6px;
}

.form-group label .required {
  color: #ed4245;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  background: #0f1117;
  border: 1px solid #2a2d3a;
  border-radius: 6px;
  padding: 8px 12px;
  color: #e0e0e0;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: #5865f2;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

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

.form-hint {
  font-size: 0.75rem;
  color: #666;
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #2a2d3a;
  border: 1px solid #3a3d4a;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 0.875rem;
  color: #e0e0e0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { border-color: #34d399; color: #34d399; }
.toast.error   { border-color: #ed4245; color: #ed4245; }

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .persona-grid { grid-template-columns: 1fr; }
}
