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

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

.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-size: 1.5rem;
  color: #fff;
}

.card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  color: #fff;
}

.create-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.form-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
}

.input, select.input {
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 0.875rem;
  outline: none;
}

.input:focus { border-color: #7c3aed; }
.input::placeholder { color: rgba(255,255,255,0.3); }

select.input option { background: #222; color: #fff; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn:hover { background: rgba(255,255,255,0.12); }
.btn-primary { background: #7c3aed; border-color: #7c3aed; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.row-inactive { opacity: 0.4; }

.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; }

.link-input {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  color: #7c3aed;
  width: 120px;
}

.copy-btn { margin-left: 0.25rem; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-download { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-upload { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-active { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-inactive { background: rgba(239,68,68,0.15); color: #f87171; }

.empty { color: rgba(255,255,255,0.4); font-size: 0.9rem; }
.error-text { color: #ef4444; font-size: 0.875rem; margin-bottom: 0.75rem; }

/* Login */
.login-card {
  max-width: 360px;
  margin: 6rem auto;
  text-align: center;
}

.login-card h1 {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 1.5rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Customize panel */
.customize-toggle {
  margin: 0.5rem 0;
}

.customize-panel {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.customize-panel[hidden] { display: none; }

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 2px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.input-short {
  width: 100px;
}

.input-file {
  font-size: 0.8rem;
  padding: 0.375rem;
}

.input-file::file-selector-button {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  margin-right: 0.5rem;
}

.hint {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
  margin-top: 0.25rem;
}

.color-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.styled-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
}

/* Templates */
.template-create summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
}

.template-create summary::-webkit-details-marker { display: none; }

.template-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.template-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}

.template-preview {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}

.template-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  flex-wrap: wrap;
}

.template-info strong {
  color: #fff;
  font-size: 0.85rem;
}

/* File Browser Modal */
.browser-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
}

.browser-overlay[hidden], .browser-modal[hidden] { display: none; }

.browser-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  z-index: 101;
  display: flex;
  flex-direction: column;
}

.browser-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.browser-header h3 {
  font-size: 1rem;
  color: #fff;
  margin: 0;
}

.browser-breadcrumb {
  padding: 0.625rem 1.25rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.browser-breadcrumb a {
  color: #7c3aed;
  text-decoration: none;
}

.browser-breadcrumb a:hover { text-decoration: underline; }

.browser-list {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
  max-height: 50vh;
}

.browser-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
}

.browser-item:hover {
  background: rgba(255,255,255,0.04);
}

.browser-folder {
  color: rgba(255,255,255,0.7);
}

.browser-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.browser-file {
  color: #e0e0e0;
}

.browser-file input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: #7c3aed;
}

.browser-filename {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-filesize {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.browser-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.browser-summary {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

@media (max-width: 640px) {
  .form-row { flex-direction: column; }
  .admin-wrap { padding: 1rem; }
  .browser-modal { width: 95%; }
}
