:root {
  --bg: #0a0a0b;
  --surface: #131317;
  --surface-2: #1a1a1f;
  --line: #262629;
  --line-2: #34343a;
  --ink: #f4f3ef;
  --muted: #8a8a91;
  --muted-2: #61616a;
  --accent: #ff5e3a;
  --green: #3ecf8e;
  --font-display: "Space Grotesk Variable", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Geist Variable", ui-sans-serif, system-ui, sans-serif;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
}
html {
  color-scheme: dark;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
::selection {
  background: var(--accent);
  color: #0a0a0b;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  border: none;
  background: none;
}
input,
select,
textarea {
  font: inherit;
  color: var(--ink);
}
a {
  color: inherit;
}

/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-card .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 20px;
}
.login-card .sub {
  color: var(--muted);
  margin: 6px 0 26px;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
  letter-spacing: 0.3em;
  margin-bottom: 12px;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- App shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100dvh;
}
.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.sidebar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 16px;
  padding: 6px 10px 20px;
}
.sidebar .brand span {
  color: var(--accent);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  color: var(--ink);
  background: var(--surface);
}
.nav-item.active {
  color: var(--ink);
  background: var(--surface);
}
.nav-item svg {
  width: 17px;
  height: 17px;
  opacity: 0.9;
}
.sidebar .spacer {
  flex: 1;
}
.sidebar .foot {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted-2);
  font-size: 12px;
  padding-left: 10px;
}

.main {
  padding: 0;
  min-width: 0;
}
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  z-index: 20;
}
.topbar .crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 500;
}
.topbar .crumbs b {
  color: var(--ink);
  font-weight: 600;
}
.topbar .actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.content {
  padding: 28px;
  max-width: 1080px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--line-2);
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn:hover {
  border-color: var(--muted-2);
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn.primary {
  background: var(--accent);
  color: #0a0a0b;
  border-color: var(--accent);
}
.btn.primary:hover {
  filter: brightness(1.05);
}
.btn.ghost {
  border-color: transparent;
  color: var(--muted);
}
.btn.ghost:hover {
  color: var(--ink);
  background: var(--surface);
}
.btn.danger:hover {
  border-color: #e5484d;
  color: #e5484d;
}
.btn.sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* ---------- Headings ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 26px;
}
.page-head .count {
  color: var(--muted);
  font-weight: 500;
}

/* ---------- Project list ---------- */
.proj-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.proj-row {
  display: grid;
  grid-template-columns: 22px 56px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 10px 14px 10px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.proj-row:hover {
  border-color: var(--line-2);
}
.drag {
  color: var(--muted-2);
  cursor: grab;
  display: grid;
  place-items: center;
}
.drag:active {
  cursor: grabbing;
}
.thumb {
  width: 56px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.proj-meta .t {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.proj-meta .t:hover {
  color: var(--accent);
}
.proj-meta .s {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.chips {
  display: flex;
  gap: 6px;
}
.chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge.published {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, transparent);
}
.badge.draft {
  color: var(--muted);
  background: var(--surface-2);
}

.sortable-ghost {
  opacity: 0.35;
}
.sortable-chosen {
  border-color: var(--accent) !important;
}

/* ---------- Editor ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card > .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-head h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.card-head .hint {
  color: var(--muted-2);
  font-size: 12px;
}

.field {
  margin-bottom: 14px;
}
.field:last-child {
  margin-bottom: 0;
}
.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 9px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field textarea {
  resize: vertical;
  min-height: 68px;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* image field */
.imgfield {
  display: flex;
  gap: 10px;
  align-items: center;
}
.imgfield .prev {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  flex-shrink: 0;
}
.imgfield input {
  flex: 1;
}
.upload {
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.upload:hover {
  color: var(--ink);
  border-color: var(--muted-2);
}
.listrow {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.listrow .x {
  color: var(--muted-2);
  padding: 6px;
}
.listrow .x:hover {
  color: #e5484d;
}

/* ---------- Blocks ---------- */
.blocks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.block-bar {
  display: grid;
  grid-template-columns: 22px 30px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.block-bar .type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.block-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--accent);
}
.block-icon svg {
  width: 16px;
  height: 16px;
}
.block-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
}
.block-sum {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46ch;
}
.block-actions {
  display: flex;
  gap: 4px;
}
.iconbtn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
}
.iconbtn:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.iconbtn.del:hover {
  color: #e5484d;
}
.iconbtn svg {
  width: 16px;
  height: 16px;
}
.block-body {
  border-top: 1px solid var(--line);
  padding: 18px;
  background: var(--bg);
}

/* add block palette */
.palette {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.pal {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--ink);
  font-weight: 500;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.pal:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.pal svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* lead type toggle */
.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  overflow: hidden;
}
.seg button {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}
.seg button.on {
  background: var(--accent);
  color: #0a0a0b;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #0a0a0b;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
}
