:root {
  color-scheme: light;
  --page: #f4f6f5;
  --card: #ffffff;
  --text: #1f2724;
  --muted: #6b7773;
  --line: #dfe5e2;
  --subtle: #eef2f0;
  --accent: #1a8a5f;
  --accent-hover: #147350;
  --on-accent: #ffffff;
  --error: #a23f44;
  --warn: #8a5a00;
  --check-a: #e8ecea;
  --check-b: #ffffff;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #121714;
  --card: #1b221f;
  --text: #ecf1ee;
  --muted: #98a59f;
  --line: #2c3631;
  --subtle: #232c28;
  --accent: #4cc593;
  --accent-hover: #6ad6a8;
  --on-accent: #08130e;
  --error: #efa7ad;
  --warn: #e3b866;
  --check-a: #26302b;
  --check-b: #1b221f;
}

* {
  box-sizing: border-box;
}
[hidden],
[x-cloak] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font:
    14px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
select,
label.button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
:focus-visible,
label.button:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
h1,
h2 {
  margin: 0 0 8px;
  font-size: 15px;
}
h1 {
  font-size: 20px;
}
.muted {
  color: var(--muted);
}
.small-text {
  font-size: 12px;
}
.error {
  color: var(--error);
}
.warn {
  color: var(--warn);
  margin: 8px 0;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}
.brand-light {
  color: var(--accent);
}
.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--subtle);
  border-bottom: 1px solid var(--line);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 0;
}
.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px;
}

.button,
select,
input[type="text"],
input[type="number"] {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.button:hover:not(:disabled) {
  border-color: var(--accent);
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.button.small {
  min-height: 30px;
  padding: 3px 10px;
  font-size: 12px;
}
.button.quiet {
  background: transparent;
}
.button.wide {
  width: 100%;
}

@supports (appearance: base-select) {
  select,
  ::picker(select) {
    appearance: base-select;
  }
  ::picker(select) {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 4px;
  }
  option {
    padding: 7px 12px;
    border-radius: 6px;
  }
  option:hover,
  option:checked {
    background: var(--subtle);
  }
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--card);
  text-align: center;
  transition: border-color 0.15s;
}
.drop > * {
  margin-top: 0;
  margin-bottom: 0;
}
.drop.over {
  border-color: var(--accent);
  background: var(--subtle);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}
.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.fields.single {
  grid-template-columns: 1fr;
}
.fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
.fields select,
.fields input {
  width: 100%;
  color: var(--text);
  font-size: 14px;
}
.stale {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 16px;
  color: var(--warn);
}

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.list-head h2 {
  margin: 0;
}
.count {
  color: var(--muted);
  font-weight: 400;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.card.bad {
  border-color: var(--error);
}
.preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: repeating-conic-gradient(
      var(--check-a) 0 25%,
      var(--check-b) 0 50%
    )
    50% / 16px 16px;
}
.preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pending {
  display: grid;
  height: 100%;
  place-items: center;
  padding: 16px;
}
.pending progress {
  width: 100%;
  accent-color: var(--accent);
}
.badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 600;
}
.meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.row .button {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 760px) {
  .columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
