:root {
  --bg: #090d16;
  --surface: #0f172a;
  --surface-2: #162036;
  --border: rgba(148, 163, 184, 0.18);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --danger: #f87171;
  --success: #34d399;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.dash-container {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(100%, 420px);
  padding: 28px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-row h1 {
  margin: 0;
  font-size: 1.2rem;
}

.brand-row p {
  margin: 2px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.login-footer {
  margin-top: 16px;
  text-align: center;
}

.login-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.login-footer a:hover { color: var(--accent); }

/* Header */
.dash-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(9, 13, 22, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.dash-header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-main {
  padding: 28px 0 64px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.tab-btn.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--accent);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.muted {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn.full { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--danger);
}

/* Forms */
.card-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-form.narrow {
  max-width: 480px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.84rem;
  color: #cbd5e1;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1120;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.save-msg {
  font-size: 0.86rem;
  color: var(--success);
}

.error-msg {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

/* Admin Project List */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.admin-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.thumb {
  width: 64px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #0b1120;
  flex-shrink: 0;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.item-meta {
  min-width: 0;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.item-summary {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 560px;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Upload */
.upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-row input[type="file"] {
  max-width: 210px;
  font-size: 0.82rem;
}

.cover-preview {
  margin-top: 8px;
}

.cover-preview img {
  max-height: 140px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(100%, 660px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h3 { margin: 0; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .admin-item { flex-direction: column; align-items: flex-start; }
  .upload-row { flex-direction: column; align-items: stretch; }
}
