:root {
  color-scheme: light;
  --ink: #1c1d20;
  --muted: #6b6560;
  --line: #e5dbd0;
  --paper: #f7f4ed;
  --panel: #ffffff;
  --red: #b84432;
  --red-soft: #f7dfd7;
  --blue: #285c74;
  --blue-soft: #dceef4;
  --mint: #26735b;
  --mint-soft: #dcf4e9;
  --amber: #8f611b;
  --amber-soft: #fff0c2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

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

.is-hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 25% 20%, rgba(184, 68, 50, 0.2), transparent 34%),
    linear-gradient(145deg, #f7f4ed, #e8e1d5);
}

.login-card {
  width: min(100%, 460px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(23, 25, 29, 0.16);
}

.login-card h1 {
  margin: 16px 0 8px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.45;
}

.account-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.account-button {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
}

.account-button:hover {
  border-color: var(--red);
  background: var(--red-soft);
}

#app {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #17191d;
  color: #fff;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #f2eee6;
  color: #17191d;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #d8d1c8;
  margin-top: 2px;
}

.rail-item,
.logout-button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f7f1e9;
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
  font-weight: 800;
}

.rail-item.active,
.rail-item:hover {
  background: #4b334b;
}

.rail-note {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 16px;
  color: #e6ded4;
  font-size: 13px;
}

.logout-button {
  width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
}

.shell {
  min-width: 0;
  padding: 24px;
}

.toolbar,
.actions,
.filters,
.lead-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.1;
}

.search span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input {
  width: min(34vw, 390px);
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

.primary-button,
.tiny-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #d82f7f;
  color: #fff;
  cursor: pointer;
  padding: 0 15px;
  font-weight: 900;
}

.tiny-button {
  min-height: 32px;
  background: var(--red);
  padding: 0 10px;
  font-size: 12px;
}

.listing-hero,
.historical-panel,
.settings-panel,
.table-panel,
.detail-card,
.review-card,
.lower-grid > div,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.listing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
}

.listing-hero h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.listing-hero p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.email-chip {
  align-self: center;
  border-left: 4px solid var(--red);
  background: #fff7f2;
  padding: 12px;
}

.email-chip span,
.email-chip strong {
  display: block;
  overflow-wrap: anywhere;
}

.email-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.historical-panel {
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 16px;
}

.historical-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.historical-head h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.historical-head strong {
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 6px 10px;
  white-space: nowrap;
}

.historical-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.historical-grid article {
  border: 1px solid #efe4d7;
  border-radius: 8px;
  background: #fffaf0;
  padding: 12px;
}

.historical-grid span {
  color: var(--amber);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.historical-grid h3 {
  margin: 6px 0;
  font-size: 15px;
}

.historical-grid p,
.historical-grid a {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.historical-grid p {
  color: var(--muted);
}

.historical-grid a {
  margin-top: 8px;
  color: #9a1b5c;
  font-weight: 900;
  text-decoration: none;
}

.metric {
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 28px;
}

.metric.red {
  background: var(--red-soft);
}

.metric.mint {
  background: var(--mint-soft);
}

.metric.blue {
  background: var(--blue-soft);
}

.metric.amber {
  background: var(--amber-soft);
}

.settings-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 20px;
  margin-bottom: 18px;
  padding: 18px;
}

.settings-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.account-form {
  display: grid;
  gap: 10px;
}

.account-form label,
.progress-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.account-form input,
.account-form button {
  width: 100%;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.table-panel {
  min-width: 0;
}

.filters {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  max-height: 610px;
  overflow: auto;
}

.lead-summary {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fff7e0;
  padding: 12px;
}

.lead-summary span {
  color: var(--muted);
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid #f1e8ee;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td a {
  color: #9a1b5c;
  font-weight: 900;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

tr {
  cursor: pointer;
}

tr:hover,
tr.selected {
  background: #fff1f7;
}

tr.owned {
  background: #f0fff8;
}

tr.review {
  background: #fff8e8;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.detail {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.detail-card,
.review-card,
.lower-grid > div {
  padding: 16px;
}

.cover-frame {
  position: relative;
  display: grid;
  justify-items: center;
}

.detail-image {
  display: block;
  width: min(100%, 210px);
  aspect-ratio: 2 / 3;
  border: 1px solid #e2d8ca;
  border-radius: 8px;
  background: #17191d;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(23, 25, 29, 0.18);
}

.blurred-cover {
  filter: blur(12px);
  transform: scale(0.98);
}

.cover-toggle {
  position: absolute;
  bottom: 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(23, 25, 29, 0.86);
  color: #fff;
  cursor: pointer;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.row-poster {
  width: 46px;
  height: 64px;
  border-radius: 5px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(23, 25, 29, 0.15);
}

.pill {
  display: inline-flex;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--red-soft);
  color: #7c261a;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.pill.amber {
  background: var(--amber-soft);
  color: #754706;
}

.pill.blue {
  background: var(--blue-soft);
  color: #1c5268;
}

.detail h2 {
  margin: 12px 0;
  font-size: 22px;
  line-height: 1.15;
}

dl {
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #f2e9ee;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.progress-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  border-top: 1px solid #f2e9ee;
  padding-top: 14px;
}

.progress-form input,
.progress-form select {
  width: 100%;
}

.save-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.review-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.review-card button {
  width: 100%;
  border: 0;
  border-top: 1px solid #f2e9ee;
  background: transparent;
  cursor: pointer;
  padding: 10px 0;
  text-align: left;
}

.review-card span {
  display: block;
  color: var(--amber);
  font-size: 12px;
  margin-top: 3px;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.year-bars {
  display: grid;
  gap: 7px;
}

.year-bars button {
  display: grid;
  grid-template-columns: 50px 1fr 150px;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
}

.year-bars i {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red) var(--w), #f2e8ef var(--w));
}

.year-bars i.empty-year {
  background: repeating-linear-gradient(90deg, #efd6e2 0 8px, #fff 8px 14px);
}

.year-bars b {
  color: var(--muted);
  font-size: 12px;
}

.artifact-list {
  display: grid;
  gap: 8px;
}

.artifact-list article {
  border-left: 3px solid var(--line);
  padding-left: 10px;
}

.artifact-list article.active {
  border-left-color: var(--red);
}

.artifact-list strong,
.artifact-list span {
  display: block;
  overflow-wrap: anywhere;
}

.artifact-list span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

@media (max-width: 980px) {
  #app,
  .workbench,
  .lower-grid,
  .listing-hero,
  .settings-panel {
    grid-template-columns: 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }

  .brand,
  .rail-note {
    grid-column: 1 / -1;
    margin: 0;
  }

  .toolbar,
  .actions,
  .filters,
  .lead-summary {
    align-items: stretch;
    flex-direction: column;
  }

  input,
  select {
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .historical-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: 470px;
  }
}
