:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --ink: #1f2527;
  --muted: #697174;
  --panel: #ffffff;
  --line: #ded8ce;
  --accent: #2f7a71;
  --accent-strong: #195950;
  --coral: #d8654f;
  --gold: #c89332;
  --blue: #4d6f99;
  --shadow: 0 20px 50px rgba(31, 37, 39, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(47, 122, 113, 0.14), transparent 34%),
    linear-gradient(260deg, rgba(216, 101, 79, 0.14), transparent 36%),
    var(--bg);
  color: var(--ink);
}

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

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input[readonly] {
  background: #f0ebe4;
  color: var(--muted);
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  min-height: 230px;
  padding: 32px 0 26px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(3rem, 8vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 420px;
}

.hero-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(31, 37, 39, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.hero-stats strong {
  margin-right: 5px;
  color: var(--ink);
}

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

.panel,
.library-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.entry-panel {
  position: sticky;
  top: 20px;
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbc4b9;
  border-radius: 7px;
  background: #fffdfa;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 122, 113, 0.16);
}

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

input[type="range"] {
  min-height: 30px;
  padding: 0;
  accent-color: var(--accent);
}

.range-readout {
  color: var(--ink);
  font-weight: 850;
}

.primary-action {
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(47, 122, 113, 0.22);
}

.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-action {
  min-height: 42px;
  width: 100%;
  border: 1px solid #b8ada0;
  border-radius: 7px;
  background: #fffdfa;
  color: var(--ink);
  font-weight: 850;
}

.secondary-action:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.metadata-tools {
  display: grid;
  gap: 8px;
}

.metadata-status {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.4;
}

.metadata-results {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.metadata-result {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.metadata-result img {
  width: 58px;
  height: 78px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8e0d5;
}

.metadata-result-copy {
  min-width: 0;
}

.metadata-result-title,
.metadata-result-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metadata-result-title {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
}

.metadata-result-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.metadata-result button {
  min-height: 34px;
  border: 1px solid #cbc4b9;
  border-radius: 7px;
  background: #f8f4ed;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
}

.library-panel {
  min-height: 620px;
  padding: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(170px, auto);
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.search-box {
  position: relative;
  display: block;
}

.search-box span {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.1rem;
}

.search-box input {
  padding-left: 38px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  border: 1px solid #cbc4b9;
  border-radius: 7px;
  overflow: hidden;
  background: #fffdfa;
}

.filter-button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid #cbc4b9;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.filter-button:last-child {
  border-right: 0;
}

.filter-button.active {
  background: var(--ink);
  color: #fff;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.media-card {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.cover-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 7px;
  background: #e8e0d5;
}

.cover-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-frame.empty img {
  display: none;
}

.cover-fallback {
  display: none;
  color: rgba(31, 37, 39, 0.48);
  font-size: 2rem;
  font-weight: 900;
}

.cover-frame.empty .cover-fallback {
  display: block;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.type-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.type-pill {
  background: rgba(77, 111, 153, 0.15);
  color: #294f7d;
}

.status-pill {
  background: rgba(200, 147, 50, 0.18);
  color: #785515;
}

.status-pill.completed {
  background: rgba(47, 122, 113, 0.16);
  color: var(--accent-strong);
}

.status-pill.dropped {
  background: rgba(216, 101, 79, 0.14);
  color: #91402f;
}

.media-card h3 {
  min-height: 30px;
  margin-bottom: 0;
  font-size: 1.18rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.metadata-line {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.date-line {
  min-height: 18px;
  margin-bottom: 0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e0d5;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.notes-preview {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #cbc4b9;
  border-radius: 7px;
  background: #fffdfa;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.delete-button:hover {
  border-color: var(--coral);
  color: #91402f;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 450px;
  padding: 34px;
  border: 1px dashed #c7bfb5;
  border-radius: 8px;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 430px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state.hidden {
  display: none;
}

@media (max-width: 1050px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .entry-panel {
    position: static;
  }

  .hero-stats {
    justify-content: flex-start;
  }

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

@media (max-width: 620px) {
  .app-shell {
    padding: 18px;
  }

  .hero {
    min-height: auto;
    padding-top: 16px;
  }

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

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

  .filter-button:nth-child(2) {
    border-right: 0;
  }

  .filter-button:nth-child(-n + 2) {
    border-bottom: 1px solid #cbc4b9;
  }

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

  .metadata-result {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .metadata-result button {
    grid-column: 1 / -1;
  }
}
