:root {
  --page: #f3f5f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #e3e7ed;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --shadow: 0 8px 20px rgba(23, 32, 42, 0.08);

  --idea-bg: #fef3c7;
  --idea-ink: #92400e;
  --scheduled-bg: #dbeafe;
  --scheduled-ink: #1d4ed8;
  --published-bg: #dcfce7;
  --published-ink: #166534;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.back-link:hover {
  color: var(--ink);
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.stat-idea {
  background: var(--idea-bg);
  color: var(--idea-ink);
}

.stat-scheduled {
  background: var(--scheduled-bg);
  color: var(--scheduled-ink);
}

.stat-published {
  background: var(--published-bg);
  color: var(--published-ink);
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 40%);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent), #000 12%);
}

.btn-remove {
  padding: 4px 10px;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger), transparent 60%);
  background: color-mix(in srgb, var(--danger), #fff 92%);
}

.content {
  flex: 1;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.col-order {
  width: 26px;
  flex: none;
}

.col-handle {
  width: 18px;
  flex: none;
}

.col-fields {
  flex: 1;
  min-width: 0;
}

.col-date {
  width: 150px;
  flex: none;
}

.col-status {
  width: 130px;
  flex: none;
}

.col-remove {
  width: 30px;
  flex: none;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: border-color 120ms ease, opacity 120ms ease;
}

.post-row.shift-transition {
  transition: transform 150ms ease, border-color 120ms ease, opacity 120ms ease;
}

.post-row.dragging-row {
  position: relative;
  z-index: 5;
  box-shadow: 0 14px 30px rgba(23, 32, 42, 0.22);
  border-color: var(--accent);
}

.order-badge {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), #fff 88%);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.drag-handle {
  width: 18px;
  flex: none;
  text-align: center;
  color: var(--muted);
  cursor: grab;
  font-size: 1rem;
  line-height: 1.6;
  user-select: none;
  touch-action: none;
  margin-top: 2px;
}

.drag-handle:active {
  cursor: grabbing;
}

.post-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-title {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
}

.p-title:hover,
.p-title:focus {
  border-color: var(--line);
  background: var(--panel);
  outline: none;
}

.p-desc {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  resize: vertical;
  min-height: 20px;
}

.p-desc:hover,
.p-desc:focus {
  border-color: var(--line);
  background: var(--page);
  outline: none;
  color: var(--ink);
}

.p-date {
  width: 150px;
  flex: none;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-top: 2px;
}

.p-status {
  width: 130px;
  flex: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-top: 2px;
  cursor: pointer;
}

.p-status.status-idea {
  background: var(--idea-bg);
  color: var(--idea-ink);
  border-color: transparent;
}

.p-status.status-scheduled {
  background: var(--scheduled-bg);
  color: var(--scheduled-ink);
  border-color: transparent;
}

.p-status.status-published {
  background: var(--published-bg);
  color: var(--published-ink);
  border-color: transparent;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 0.95rem;
}

.empty-state[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .list-header {
    display: none;
  }

  .post-row {
    flex-wrap: wrap;
  }

  .post-fields {
    order: 1;
    flex-basis: 100%;
  }

  .p-date,
  .p-status {
    width: auto;
    flex: 1;
  }
}
