*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22263a;
  --border: #2a2d3e;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --blue: #2563eb;
  --purple: #7c3aed;
  --green: #059669;
  --yellow: #d97706;
  --pink: #db2777;
  --orange: #ea580c;

  --radius: 12px;
  --radius-sm: 6px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* Header */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, 0.9);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

#last-updated {
  color: var(--text-dim);
  font-size: 12px;
}

#refresh-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

#refresh-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Main */
main {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: #3a3d52;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
}

/* Drag handle */
.drag-handle {
  color: var(--text-dim);
  cursor: grab;
  font-size: 14px;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: -2px;
  transition: color 0.15s;
  padding-right: 2px;
}
.drag-handle:hover { color: var(--text-muted); }
.card.dragging { opacity: 0.35; cursor: grabbing; }

/* Star / Favorite */
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--text-dim);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}
.star-btn:hover        { color: #f59e0b; transform: scale(1.25); }
.star-btn.active       { color: #f59e0b; }

/* Favorite card */
.card.favorite {
  border-color: #f59e0b;
  background: linear-gradient(160deg, #1e1d14 0%, #1a1d27 60%);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.15), inset 0 1px 0 rgba(245,158,11,0.05);
}
.card.favorite:hover { border-color: #fbbf24; }

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-type-civil   { background: rgba(37,99,235,0.15);  color: #60a5fa; }
.badge-type-navis   { background: rgba(124,58,237,0.15); color: #a78bfa; }
.badge-type-webapp  { background: rgba(5,150,105,0.15);  color: #34d399; }
.badge-type-python  { background: rgba(217,119,6,0.15);  color: #fbbf24; }
.badge-type-lovable { background: rgba(219,39,119,0.15); color: #f472b6; }
.badge-type-node    { background: rgba(5,150,105,0.15);  color: #34d399; }

.status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.active   { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.onhold   { background: #64748b; }
.status-dot.wip      { background: #f97316; }
.status-dot.unknown  { background: #475569; }

/* Section */
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* Commit */
.commit-block {
  border-left: 2px solid var(--border);
  padding-left: 12px;
}

.commit-message {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.commit-meta {
  color: var(--text-dim);
  font-size: 11px;
  display: flex;
  gap: 8px;
}

.commit-hash {
  font-family: 'Courier New', monospace;
  background: rgba(255,255,255,0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

.no-data {
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

/* Next Steps */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.step.done {
  color: var(--text-dim);
  text-decoration: line-through;
}

.step-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.step.done .step-check {
  background: #22c55e;
  border-color: #22c55e;
  color: #000;
}

/* Add Step */
.add-step-area {
  margin-top: 8px;
}

.add-step-toggle {
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 11px;
  font-family: inherit;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}
.add-step-toggle:hover {
  border-color: var(--text-dim);
  color: var(--text-muted);
}
.add-step-area.open .add-step-toggle { display: none; }

.add-step-form {
  display: none;
  gap: 6px;
}
.add-step-area.open .add-step-form { display: flex; }

.add-step-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.add-step-input:focus { border-color: #60a5fa; }
.add-step-input:disabled { opacity: 0.5; }

.add-step-submit {
  background: #2563eb;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  padding: 0 10px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.add-step-submit:hover { background: #1d4ed8; }

/* Card footer */
.card-footer {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}

.btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: #3a3d52;
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-vscode:hover { border-color: #2563eb; color: #60a5fa; }
.btn-github:hover { border-color: #7c3aed; color: #a78bfa; }

/* Loading / Error */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-dim);
  font-size: 13px;
  gap: 10px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
