:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #657287;
  --line: #d9e0ea;
  --paper: #f6f8fb;
  --surface: #ffffff;
  --teal: #0f766e;
  --blue: #24486f;
  --gold: #b7791f;
  --red: #b42318;
  --shadow: 0 14px 30px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

textarea {
  resize: vertical;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 68px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.94);
  backdrop-filter: blur(14px);
}

.brand,
.top-actions,
.card-meta,
.row-actions,
.form-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  font-size: 12px;
}

.global-search input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.top-actions {
  gap: 10px;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 60px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-head.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

h1 {
  font-size: 38px;
}

h2 {
  font-size: 22px;
}

.lead {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.detail-link,
.card-link {
  color: var(--teal);
  font-weight: 850;
}

.detail-link {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #b9ddd8;
  border-radius: 8px;
  background: #effaf8;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
}

.button.primary {
  color: #ffffff;
  background: var(--teal);
}

.button.secondary,
.icon-button {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.button.danger {
  color: var(--red);
  background: #fff7f5;
  border-color: #ffd1cb;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics div {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metrics span,
.project-form label,
.stack label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.toolbar a {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 800;
}

.toolbar a.active {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.project-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.project-card,
.project-form,
.import-panel,
.side-panel,
.attachment-row,
.empty,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.card-meta {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.status.queued {
  background: var(--blue);
}

.status.active {
  background: var(--teal);
}

.status.waiting {
  background: var(--gold);
}

.status.shipped {
  background: #316b35;
}

.status.archived {
  background: #667085;
}

.project-card p {
  color: var(--muted);
}

.project-card dl {
  display: grid;
  gap: 10px;
  margin: auto 0 0;
}

.project-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.project-card dd {
  margin: 2px 0 0;
  font-weight: 750;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.tags span {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: #eef5fb;
  font-size: 12px;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.project-form,
.side-panel {
  padding: 20px;
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
  padding: 18px;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.import-form input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.span-2 {
  grid-column: span 2;
}

.project-form input,
.project-form select,
.project-form textarea,
.stack input,
.stack textarea {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdff;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.side-panel h2,
.attachments h2 {
  margin-bottom: 14px;
}

.stack {
  display: grid;
  gap: 12px;
}

.upload-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.starter-upload {
  display: grid;
  gap: 8px;
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 148px;
  padding: 22px;
  border: 1px dashed #97a7ba;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdff;
  text-align: center;
  cursor: pointer;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-zone:focus-within,
.drop-zone.is-dragging {
  border-color: var(--teal);
  background: #effaf8;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.drop-title {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.drop-copy,
.selected-files {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.selected-files {
  min-height: 20px;
}

.attachments {
  margin-top: 24px;
}

.attachment-list {
  display: grid;
  gap: 10px;
}

.attachment-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.attachment-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.row-actions {
  gap: 8px;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
}

.notice.error {
  color: var(--red);
  background: #fff7f5;
  border: 1px solid #ffd1cb;
}

.notice.success {
  color: #075e55;
  background: #effaf8;
  border: 1px solid #b9ddd8;
}

.muted {
  color: var(--muted);
}

.empty {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(440px, calc(100% - 32px));
  padding: 0;
}

.login-panel {
  padding: 28px;
}

.login-brand {
  margin-bottom: 22px;
}

.login-panel h1 {
  margin-bottom: 18px;
  font-size: 30px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: space-between;
  }

  .metrics,
  .project-list,
  .detail-grid,
  .import-panel,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .import-form {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .page-head,
  .attachment-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  main {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  .topbar {
    padding: 12px;
  }

  h1 {
    font-size: 30px;
  }

  .row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .row-actions .button {
    width: 100%;
  }
}
