:root {
  --paper: #f7f5ef;
  --panel: #ffffff;
  --ink: #1f2421;
  --muted: #6c716c;
  --line: #d9d5ca;
  --accent: #1f6f64;
  --accent-ink: #ffffff;
  --blue: #385c8a;
  --amber: #a56620;
  --red: #a23d3d;
  --shadow: 0 12px 36px rgba(31, 36, 33, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0) 260px),
    var(--paper);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  background: rgba(247, 245, 239, 0.92);
  border-bottom: 1px solid rgba(217, 213, 202, 0.82);
  backdrop-filter: blur(14px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.capture-panel {
  align-self: start;
}

.capture-form {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.file-drop span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

textarea {
  min-height: 170px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 100, 0.14);
}

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

.file-drop {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f4f1e9;
  border: 1px dashed #bdb6a7;
  border-radius: 8px;
}

.primary-button,
.text-button,
.icon-button,
.item-actions button,
.mini-upload {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.primary-button:disabled {
  cursor: default;
  opacity: 0.68;
}

.text-button,
.icon-button,
.item-actions button,
.mini-upload {
  background: #fbfaf7;
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  padding: 0;
  place-items: center;
}

.icon {
  font-size: 17px;
  line-height: 1;
}

.error-line,
.form-message {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
}

.form-message.ok {
  color: var(--accent);
}

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

.queue-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
  margin-bottom: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  background: #ece7dc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment {
  min-height: 40px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  font-weight: 650;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  color: var(--accent-ink);
  background: var(--blue);
}

.search-input {
  background: var(--panel);
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 12px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  color: var(--muted);
  background: #ede9de;
  border-radius: 999px;
  font-size: 12px;
}

.items-list {
  display: grid;
  gap: 12px;
}

.empty-state {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(31, 36, 33, 0.05);
}

.item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: start;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.platform-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.platform-badge {
  color: #1f332f;
  background: #dceee8;
}

.status-badge {
  color: #22314a;
  background: #e3e8f3;
}

.status-badge.needs-screenshot {
  color: #5e3d08;
  background: #f5e4bc;
}

.status-badge.imported {
  color: #174f3e;
  background: #d7ecdf;
}

.status-badge.failed {
  color: #7d2424;
  background: #f1d6d6;
}

.status-badge.duplicate,
.status-badge.archived {
  color: #5c5d61;
  background: #e7e5e0;
}

.date-text {
  color: var(--muted);
  font-size: 12px;
}

.item-url {
  overflow: hidden;
  color: var(--blue);
  font-size: 13px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-note {
  color: var(--amber);
  font-size: 13px;
  font-weight: 650;
}

.item-raw {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.asset-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.asset-thumb {
  flex: 0 0 auto;
  display: block;
  width: 72px;
  height: 72px;
  overflow: hidden;
  color: var(--muted);
  background: #f4f1e9;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

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

.asset-thumb span {
  display: grid;
  height: 100%;
  padding: 6px;
  place-items: center;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-actions button,
.mini-upload {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.item-actions button.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.item-actions .delete-button {
  color: var(--red);
  border-color: #e0bcbc;
}

.item-actions .delete-button:hover {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

.mini-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  color: var(--blue);
}

.mini-upload input {
  display: none;
}

@media (max-width: 820px) {
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 21px;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .queue-tools {
    grid-template-columns: 1fr;
  }

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

  .segment {
    padding: 0 5px;
    font-size: 13px;
  }
}
