:root {
  --gold: #f4a51c;
  --leaf: #256f48;
  --ink: #202124;
  --muted: #6f7479;
  --line: #e2e5e8;
  --bg: #f5f6f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
  border: 0;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  color: #fff;
  background: var(--leaf);
  font-weight: 700;
}

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

.login-box,
.panel,
.stat,
.modal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-box {
  width: min(420px, 100%);
  padding: 26px;
}

.field {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.sidebar {
  background: #17251d;
  color: #fff;
  padding: 18px;
}

.brand {
  margin: 0 0 22px;
  font-size: 22px;
}

.nav button {
  width: 100%;
  justify-content: flex-start;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  text-align: left;
}

.nav .active {
  color: #fff;
  background: rgba(244, 165, 28, 0.28);
}

.main {
  padding: 22px;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  padding: 16px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel {
  padding: 16px;
  overflow: auto;
}

.table-note {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #d7eadf;
  border-radius: 6px;
  color: var(--leaf);
  background: #eef8f2;
  font-size: 13px;
  font-weight: 700;
}

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

.table-tools input,
.table-tools select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 800;
}

.sort-head {
  min-height: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
}

.thumb {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 6px;
  background: #f4f6f5;
}

.media-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 76px;
}

.name-full {
  display: inline-block;
  max-width: 220px;
  margin-top: 6px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.upload-preview {
  width: 100%;
  height: 132px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f5;
}

.preview-box {
  display: grid;
  gap: 6px;
}

.preview-box small {
  max-width: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.batch-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.batch-item {
  display: grid;
  gap: 4px;
  width: 92px;
}

.batch-item img,
.batch-item video {
  width: 92px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f5;
}

.batch-item small {
  font-size: 11px;
}

.gallery-thumb button {
  min-height: 24px;
  padding: 0 6px;
  color: #fff;
  background: #d44444;
  font-size: 12px;
}

.upload-status {
  min-height: 24px;
  color: var(--leaf);
  font-size: 13px;
  font-weight: 700;
}

.upload-status a {
  color: var(--leaf);
  text-decoration: underline;
}

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

.ghost {
  color: var(--leaf);
  background: #e9f3ee;
}

.warn {
  background: #d44444;
}

.status {
  min-height: 30px;
  padding: 0 11px;
}

.status.show {
  background: #1d8f55;
}

.status.hide {
  background: #d44444;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 6px;
  color: #8a5b00;
  background: #fff1ca;
  font-weight: 800;
}

.flag-stack {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 150px;
}

.flag {
  min-height: 28px;
  padding: 0 9px;
  color: #6a7076;
  background: #eef0f1;
  font-size: 12px;
}

.flag.active {
  color: #fff;
  background: var(--leaf);
}

.tea-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  min-width: 48px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.tea-code.diamond {
  color: #174c27;
  background: linear-gradient(135deg, #e7f8cf, #6fbf4a);
}

.tea-code.gold {
  color: #875900;
  background: linear-gradient(135deg, #fff3bf, #f4a51c);
}

.tea-code.purple {
  color: #fff;
  background: linear-gradient(135deg, #9a63ff, #5a2bbf);
}

.tea-code.pink {
  color: #8d1742;
  background: linear-gradient(135deg, #ffd6e5, #f65f9a);
}

.status-text {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-text.show {
  color: #126b3f;
  background: #dff3e8;
}

.status-text.hide {
  color: #b72d2d;
  background: #ffe1e1;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.38);
}

.modal-card {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.wide {
  grid-column: 1 / -1;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.tag-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #f7f9f8;
}

.tag-picker input {
  width: auto;
}

.support-form {
  display: grid;
  grid-template-columns: 220px 1fr 180px 180px;
  gap: 10px 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 11px 14px;
  border-radius: 6px;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

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

  .nav button {
    width: auto;
    white-space: nowrap;
  }

  .stats,
  .form-grid,
  .table-tools,
  .support-form {
    grid-template-columns: 1fr;
  }
}
