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

body {
  background: #fafafa;
  color: #09090b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

/* ── Header ── */
.home-header {
  background: #ffffff;
  border-bottom: 1px solid #e4e4e7;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-header-inner {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
}

.home-user-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #18181b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.home-user-btn:hover {
  background: #3f3f46;
  color: #ffffff;
}
.home-user-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-user-btn .user-initial {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  user-select: none;
}

.header-login-btn {
  font-size: 12px;
  color: #71717a;
  text-decoration: none;
  border: 1px solid #d4d4d8;
  padding: 4px 12px;
  border-radius: 6px;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.header-login-btn:hover { border-color: #09090b; color: #09090b; }

/* ── Guest view (not logged in) ── */
.guest-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  gap: 20px;
}
.guest-view-title {
  font-size: 22px;
  font-weight: 700;
  color: #09090b;
  letter-spacing: -0.03em;
}
.guest-view-desc {
  font-size: 14px;
  color: #71717a;
  line-height: 1.7;
  max-width: 320px;
}
.guest-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 10px;
  background: #09090b;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
  margin-top: 4px;
}
.guest-view-btn:hover { background: #27272a; }

.guest-preview-canvas {
  width: 100%;
  height: 280px;
  border-radius: 12px;
  display: block;
  background: #0d0d1a;
}

.home-logo-name {
  font-size: 16px;
  font-weight: 700;
  color: #09090b;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.home-logo-tag {
  font-size: 12px;
  color: #a1a1aa;
}

/* ── Main ── */
.home-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.home-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a;
  margin-bottom: 16px;
}

/* ── Project grid ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* New project card */
.project-card-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1.5px dashed #d4d4d8;
  border-radius: 10px;
  padding: 32px 16px;
  cursor: pointer;
  text-decoration: none;
  color: #71717a;
  background: #ffffff;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  min-height: 120px;
}
.project-card-new:hover {
  border-color: #18181b;
  color: #09090b;
  background: #fafafa;
}
.project-card-new-icon {
  width: 32px;
  height: 32px;
  border: 1.5px solid currentColor;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}
.project-card-new-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.project-card-new-label {
  font-size: 13px;
  font-weight: 500;
}

/* Existing project card */
.project-card {
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  background: #ffffff;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 120px;
  position: relative;
}
.project-card:hover {
  border-color: #a1a1aa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.project-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f4f4f5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.project-card-icon svg {
  width: 14px;
  height: 14px;
  stroke: #71717a;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #09090b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 24px;
}

.project-card-date {
  font-size: 11px;
  color: #a1a1aa;
  margin-top: auto;
  padding-top: 8px;
}

.project-card-del {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d4d4d8;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}
.project-card-del:hover {
  color: #ef4444;
  background: #fef2f2;
}
.project-card-del svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Loading / empty states */
.home-state {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  font-size: 13px;
  color: #a1a1aa;
}

/* ── Back link (shared across user/upgrade pages) ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #71717a;
  text-decoration: none;
  margin-bottom: 20px;
  transition: color 0.1s;
}
.back-link:hover { color: #09090b; }
.back-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Modal (shared) ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  padding: 24px;
  max-width: 360px;
  width: calc(100% - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.modal-box-title {
  font-size: 15px;
  font-weight: 700;
  color: #09090b;
  margin-bottom: 6px;
}

.modal-box-desc {
  font-size: 13px;
  color: #71717a;
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-box-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  outline: none;
  margin-bottom: 16px;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s;
}
.modal-box-input:focus { border-color: #a1a1aa; }

.modal-box-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  color: #09090b;
  transition: background 0.15s;
}
.modal-btn:hover { background: #f4f4f5; }

.modal-btn-primary {
  background: #09090b;
  color: #ffffff;
  border-color: #09090b;
}
.modal-btn-primary:hover { background: #27272a; }
.modal-btn-primary:disabled { background: #a1a1aa; border-color: #a1a1aa; cursor: not-allowed; }

.modal-btn-danger {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}
.modal-btn-danger:hover { background: #dc2626; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .home-main { padding: 24px 16px 60px; }
  .home-header { padding: 0 16px; }
}
