* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background: #f9fafb;
  color: #1f2937;
  font-family: "Noto Sans JP", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.has-modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.skip-link:focus {
  position: fixed;
  z-index: 100;
  width: auto;
  height: auto;
  clip: auto;
  margin: 0.75rem;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.5rem 1rem;
}

.projects-container {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding-inline: 1rem;
}

.projects-header {
  border-bottom: 1px solid #e5e7eb;
  background: rgb(255 255 255 / 0.94);
}

.header-inner,
.brand,
.projects-title-row,
.project-actions,
.modal-actions {
  display: flex;
  align-items: center;
}

.header-inner {
  justify-content: space-between;
  min-height: 4rem;
}

.brand { gap: 0.6rem; font-weight: 700; }
.brand-mark {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: #111827;
  color: #fff;
}
.top-link { color: #4f46e5; font-weight: 600; }

.projects-main { padding-block: 2.5rem 4rem; }
.projects-title-row { justify-content: space-between; }
.projects-title-row h1 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.25rem); }
.projects-title-row p { margin: 0.5rem 0 0; color: #6b7280; }
.projects-title-row .eyebrow { margin: 0 0 0.35rem; color: #4f46e5; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }

.projects-state {
  margin: 1.5rem 0 0;
  border-radius: 0.75rem;
  background: #fff;
  padding: 1.25rem;
  color: #6b7280;
}
.projects-error { border: 1px solid #fecaca; color: #991b1b; }
.projects-error p { margin: 0 0 0.75rem; }
.projects-list { display: grid; gap: 0.85rem; margin-top: 1.5rem; }

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #fff;
  padding: 1.1rem 1.25rem;
}
.project-card h2 { margin: 0; overflow-wrap: anywhere; font-size: 1.05rem; }
.project-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0.55rem 0 0; color: #6b7280; font-size: 0.8125rem; }
.project-meta div { display: flex; gap: 0.35rem; }
.project-meta dt { font-weight: 600; }
.project-meta dd { margin: 0; color: #374151; }
.project-actions { flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }

.button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  padding: 0.6rem 1rem;
  font-weight: 700;
}
.button:disabled { cursor: wait; opacity: 0.6; }
.primary-button { border: 1px solid #4338ca; background: #4f46e5; color: #fff; }
.secondary-button { border: 1px solid #d1d5db; background: #fff; color: #374151; }
.danger-button { border: 1px solid #b91c1c; background: #b91c1c; color: #fff; }
.rename-button { border: 0; background: transparent; color: #4f46e5; }
.delete-button { border: 0; background: transparent; color: #b91c1c; }
.pagination-actions { display: flex; justify-content: center; margin-top: 1.5rem; }

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.42); }
.modal-card {
  position: relative;
  width: min(30rem, 100%);
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 20px 35px rgb(0 0 0 / 0.16);
}
.modal-card h2 { margin: 0; font-size: 1.2rem; }
.name-field { display: grid; gap: 0.4rem; margin-top: 1.25rem; color: #4b5563; font-size: 0.875rem; font-weight: 700; }
.name-field input { min-height: 2.75rem; border: 1px solid #d1d5db; border-radius: 0.75rem; padding: 0.6rem 0.75rem; }
.delete-copy { color: #6b7280; line-height: 1.65; }
.modal-error { margin: 0.75rem 0 0; color: #b91c1c; font-size: 0.875rem; }
.modal-actions { justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; }

@media (max-width: 720px) {
  .projects-main { padding-top: 1.75rem; }
  .project-card { grid-template-columns: 1fr; }
  .project-actions { justify-content: flex-start; }
  .project-actions .primary-button { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  .brand span:last-child { display: none; }
  .project-actions { align-items: stretch; flex-direction: column; }
  .modal-actions { align-items: stretch; flex-direction: column-reverse; }
}
