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

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid #2a2a2a;
}

.tab {
  background: none;
  border: none;
  color: #888;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover {
  color: #ccc;
}

.tab.active {
  color: #fff;
  border-bottom-color: #6366f1;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.hidden {
  display: none !important;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

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

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

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  font-family: inherit;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #6366f1;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: #6366f1;
  color: #fff;
}

.btn-primary:hover {
  background: #5558e6;
}

.btn-primary:disabled {
  background: #3a3a5c;
  cursor: not-allowed;
}

.btn-secondary {
  background: #2a2a2a;
  color: #ccc;
}

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

/* Warning / Info */
.warning {
  background: #332b00;
  border: 1px solid #665500;
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #ffd000;
}

.warning .similar-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid #443600;
}

.warning .similar-item:last-child {
  border-bottom: none;
}

.info {
  background: #1a1a3a;
  border: 1px solid #3a3a6a;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #9999ff;
}

.feedback {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.feedback.success {
  background: #0a2a0a;
  border: 1px solid #1a5a1a;
  color: #4ade80;
}

.feedback.error {
  background: #2a0a0a;
  border: 1px solid #5a1a1a;
  color: #f87171;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filter-bar select {
  width: auto;
  min-width: 160px;
}

/* Table */
#prompts-table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #2a2a2a;
  font-weight: 600;
}

th.sortable {
  cursor: pointer;
}

th.sortable:hover {
  color: #bbb;
}

td {
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #1a1a1a;
  vertical-align: top;
}

tr:hover td {
  background: #161616;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-version {
  background: #2a2a4a;
  color: #9999ff;
}

.badge-category {
  background: #1a2a3a;
  color: #66aaff;
}

.badge-status-active {
  background: #0a2a0a;
  color: #4ade80;
}

.badge-status-draft {
  background: #2a2a1a;
  color: #ccc;
}

.badge-status-archived {
  background: #2a1a1a;
  color: #888;
}

.badge-tag {
  background: #2a2a2a;
  color: #aaa;
  margin: 0.1rem;
}

/* Expand Row */
.expand-btn {
  background: none;
  border: none;
  color: #6366f1;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
}

.expand-btn:hover {
  color: #8888ff;
}

.expanded-row td {
  background: #141420;
  padding: 1rem;
}

.prompt-text-preview {
  color: #999;
  font-size: 0.85rem;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-text-full {
  white-space: pre-wrap;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #ccc;
  background: #0f0f1a;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #2a2a3a;
}

/* Search */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-bar input {
  flex: 1;
}

#search-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.search-result-card:hover {
  border-color: #6366f1;
}

.search-result-card h3 {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.search-result-card .meta {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.search-result-card .preview {
  font-size: 0.85rem;
  color: #999;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #666;
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

.loading {
  text-align: center;
  color: #888;
  padding: 2rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 2rem;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

#modal-title {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.modal-field {
  margin-bottom: 1rem;
}

.modal-field label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 0.25rem;
}

.modal-field .value {
  font-size: 0.9rem;
  color: #ccc;
}

.modal-field .value.prompt-text {
  white-space: pre-wrap;
  background: #0f0f1a;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #2a2a3a;
  line-height: 1.5;
}

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

  .filter-bar {
    flex-direction: column;
  }

  .filter-bar select {
    width: 100%;
  }
}
