:root {
  color-scheme: light;
  --ink: #1d2526;
  --muted: #66706a;
  --line: #d8ded9;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --leaf: #356b4b;
  --sea: #237586;
  --sun: #d99b33;
  --coral: #c65f4b;
  --soft: #eef4ee;
  --shadow: 0 14px 36px rgba(27, 40, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px;
  background: #18352b;
  color: #f8fbf4;
  min-height: 100vh;
}

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

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--sun);
  color: #1f2f21;
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #c8d8ca;
}

nav {
  display: grid;
  gap: 8px;
}

.nav {
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  color: #eaf1e8;
  background: transparent;
  cursor: pointer;
}

.nav.active,
.nav:hover {
  background: rgba(255, 255, 255, 0.12);
}

.status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dce8dc;
  font-size: 14px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #80d28d;
}

main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.topbar p,
.panel p {
  color: var(--muted);
  margin-top: 6px;
}

.token {
  display: grid;
  gap: 6px;
  min-width: 260px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

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

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

button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  color: #fff;
  background: var(--leaf);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

button:hover {
  filter: brightness(0.96);
}

.secondary-button {
  color: var(--leaf);
  background: #eef4ee;
}

.primary-button {
  background: #3f6f50;
  color: #fff;
  box-shadow: 0 8px 18px rgba(48, 93, 66, 0.18);
}

.ghost-button {
  border: 1px solid #cbd8cf;
  color: #315943;
  background: #f7faf7;
}

.ghost-button:hover,
.secondary-button:hover {
  background: #eef4ee;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #18352b;
}

.login-screen.hidden {
  display: none;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(100%, 420px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #fbfcf8;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  padding: 22px;
}

.login-brand {
  color: var(--ink);
}

.login-brand small {
  color: var(--muted);
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 160px 170px 160px;
  gap: 10px;
  margin-bottom: 14px;
}

.gallery-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.gallery-toolbar {
  grid-template-columns: minmax(240px, 1fr) 180px 160px;
}

.gallery-count {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--muted);
  text-align: center;
}

.bulkbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(130px, 0.8fr) minmax(150px, 0.8fr) minmax(140px, 0.8fr) minmax(150px, 0.8fr) minmax(150px, 0.9fr) 88px 88px;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow);
}

.bulkbar button {
  width: 100%;
  padding-inline: 14px;
}

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

.gallery-tile {
  position: relative;
  display: grid;
  grid-template-rows: 150px auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.gallery-tile.selected {
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(35, 117, 134, 0.16);
}

.gallery-tile input[type="checkbox"] {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  accent-color: var(--sea);
}

.thumb {
  display: grid;
  place-items: center;
  background: #edf4ef;
  overflow: hidden;
}

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

.tile-body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
}

.tile-title {
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-packs {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 16px;
  min-height: 650px;
}

.list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.ref-card,
.detail,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ref-card {
  padding: 14px;
  cursor: pointer;
}

.ref-card.active {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(53, 107, 75, 0.14);
}

.ref-card strong {
  display: block;
  margin-bottom: 7px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.pill {
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--soft);
  color: #2f4c3d;
  font-size: 12px;
}

.pill.review {
  background: #fff3d8;
  color: #805c16;
}

.pill.approved {
  background: #e4f4e6;
  color: #296537;
}

.summary {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.detail {
  padding: 18px;
  min-width: 0;
}

.empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.asset-preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f4f7f2;
  overflow: hidden;
}

.asset-preview img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.asset-preview iframe {
  width: 100%;
  height: 420px;
  border: 0;
}

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

.dropzone {
  margin-top: 16px;
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 250px;
  border: 1px dashed #aab7ae;
  border-radius: 8px;
  background: #f6faf4;
  padding: 22px;
  text-align: center;
}

.dropzone.dragging {
  border-color: var(--sea);
  background: #eaf7f4;
  box-shadow: 0 0 0 3px rgba(35, 117, 134, 0.12);
}

.dropzone input {
  max-width: 100%;
}

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

.upload-status {
  min-height: 24px;
  margin-top: 10px;
  color: var(--muted);
}

.upload-status.good {
  color: var(--leaf);
}

.upload-status.bad {
  color: var(--coral);
}

.note-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.settings-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.inline {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px;
}

.context-output {
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17231d;
  color: #e8f4e9;
  padding: 16px;
  white-space: pre-wrap;
}

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

code {
  display: inline-block;
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef4ee;
  color: #234437;
}

ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

@media (max-width: 920px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .toolbar,
  .gallery-top,
  .gallery-toolbar,
  .bulkbar,
  .split,
  .access-grid,
  .inline {
    grid-template-columns: 1fr;
  }

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

  .token {
    min-width: 0;
  }
}
