:root {
  color-scheme: light dark;
  font-family: "Segoe UI", Roboto, sans-serif;
}

body {
  margin: 0;
  background: #0e0e0e;
  color: #f1f1f1;
  min-height: 100vh;
}

.site-header {
  background: #151515;
  border-bottom: 1px solid #2c2c2c;
  padding: 1rem 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.container {
  width: min(960px, 92vw);
  margin: 0 auto;
  padding: 1.5rem 0;
}

.logo {
  font-weight: 600;
  font-size: 1.25rem;
  color: #61dafb;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

nav a {
  color: #f1f1f1;
  text-decoration: none;
}

nav a:hover {
  color: #61dafb;
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-menu {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: 110%;
  background: #1f1f1f;
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  min-width: 160px;
  padding: 0.4rem;
  display: none;
  z-index: 20;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.profile-dropdown a,
.profile-dropdown .link-button {
  display: block;
  color: #f1f1f1;
  text-decoration: none;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.profile-dropdown form {
  margin: 0;
}

.profile-dropdown a:hover,
.profile-dropdown .link-button:hover {
  background: rgba(97, 218, 251, 0.15);
}

.profile-menu.is-open .profile-dropdown {
  display: block;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-avatar.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2c2c2c;
  color: #f1f1f1;
  font-size: 0.75rem;
  text-transform: uppercase;
}
.token-chip {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  font-size: 0.85rem;
  color: #bfdbfe;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
}

.card {
  background: rgba(20, 20, 30, 0.85);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.avatar-wrap {
  width: 72px;
  height: 72px;
}

.avatar-img,
.avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2c2c2c;
  color: #f1f1f1;
  font-size: 1.1rem;
  text-transform: uppercase;
}

.avatar-img {
  object-fit: cover;
  background: transparent;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.activity-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.4rem;
}

form label {
  display: block;
  margin-bottom: 0.5rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid #2f2f2f;
  border-radius: 6px;
  background: rgba(18, 18, 18, 0.9);
  color: #f1f1f1;
}

button.primary {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  border: 1px solid #2f2f2f;
  color: #f1f1f1;
  text-decoration: none;
  background: rgba(40, 40, 54, 0.7);
  transition: transform 0.15s ease, background 0.15s ease;
}

.button-link:hover {
  transform: translateY(-1px);
  background: rgba(96, 165, 250, 0.2);
}

.button-link.primary {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  border: none;
  color: white;
}

.button-link.danger,
.button-link.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.impersonation-banner form {
  margin: 0;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.message.success {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.message.error {
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.library-search {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.library-search .search-row {
  display: flex;
  gap: 0.5rem;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.model-card {
  background: rgba(15, 15, 25, 0.85);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.model-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.model-card .tag-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  list-style: none;
}

.model-card .tag-list li {
  background: rgba(59, 130, 246, 0.2);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.model-card .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.model-card form {
  margin: 0;
}

.pagination {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.pagination a {
  color: #61dafb;
  text-decoration: none;
}

.table-scroll {
  overflow-x: auto;
}

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

.prompt-table th,
.prompt-table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.prompt-table th {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.prompt-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.5);
}

.prompt-thumb {
  width: 128px;
  height: auto;
  max-width: 256px;
  max-height: 256px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(96, 165, 250, 0.4);
  flex-shrink: 0;
  background: #0f172a;
}

.prompt-table .meta {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 0.35rem;
}

.form-inline {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-inline .form-field {
  flex: 1;
  min-width: 180px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.stats-grid div {
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 10px;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.6);
}

.stats-grid span {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.stats-grid strong {
  font-size: 1.4rem;
}
