:root {
  color-scheme: light;
  --bg: #f5f1ea;
  --panel: #fff8f2;
  --panel-strong: #ffffff;
  --text: #1f1a17;
  --muted: #6c5f57;
  --accent: #c7f000;
  --accent-dark: #95b800;
  --border: #ead7c8;
  --shadow: 0 24px 60px rgba(52, 30, 18, 0.14);
  --shadow-soft: 0 10px 30px rgba(52, 30, 18, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #1c2027;
  --panel-strong: #232832;
  --text: #f5f6f8;
  --muted: #a9b0bc;
  --border: #2f3643;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 14px 32px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 229, 204, 0.7) 0%, transparent 55%),
    radial-gradient(circle at 90% 10%, rgba(255, 223, 190, 0.6) 0%, transparent 60%),
    radial-gradient(circle at 50% 100%, rgba(234, 214, 197, 0.5) 0%, transparent 60%),
    linear-gradient(160deg, #f5f1ea 0%, #fff7f0 60%, #f1e1d4 100%);
  min-height: 100vh;
  padding: 28px 24px 40px;
}

body[data-theme="dark"] {
  background:
    radial-gradient(circle at 15% 10%, rgba(199, 240, 0, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(80, 160, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 120%, rgba(199, 240, 0, 0.06) 0%, transparent 55%),
    linear-gradient(160deg, #0d0f14 0%, #10141b 60%, #0a0c11 100%);
}

h1, h2, h3 {
  font-family: "Fraunces", serif;
  margin: 0;
}

p {
  margin: 6px 0 0;
}

.subtitle {
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 18px 20px;
  border-radius: var(--radius-xl);
  background: rgba(255, 247, 240, 0.9);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

body[data-theme="dark"] .topbar {
  background: rgba(22, 26, 33, 0.85);
  border: 1px solid #2b323d;
}

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

.mode-client .vendor-only {
  display: none !important;
}

.mode-vendor .client-only {
  display: none !important;
}

button {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(52, 30, 18, 0.06);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(46, 28, 15, 0.12);
}

.primary {
  background: var(--accent);
  color: #11140d;
  border-color: transparent;
}

.ghost {
  background: transparent;
}

.danger {
  background: #fce7e0;
  border-color: #f6c4b5;
  color: #a43c26;
}

body[data-theme="dark"] .danger {
  background: #402326;
  border-color: #5a2e33;
  color: #ffb1a3;
}

.layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 24px;
}


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

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body[data-theme="dark"] .stat-card {
  background: #1b212c;
  border: 1px solid #2f3643;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 6px 0 2px;
}

.stat-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.progress {
  height: 8px;
  background: #efe6dd;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-top: 10px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

body[data-theme="dark"] .progress {
  background: #12161d;
  border: 1px solid #2f3643;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(199, 240, 0, 0.08);
  pointer-events: none;
}

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

.counter-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

#countPill {
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

body[data-theme="dark"] #countPill {
  background: #1f242e;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section {
  padding: 10px 0 6px;
  border-top: 1px dashed var(--border);
}

.section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.action-row button,
.action-row a {
  min-width: 140px;
  text-align: center;
}

.field.inline {
  flex-direction: row;
  align-items: center;
}

.field.inline label {
  min-width: 160px;
}

.badge.small {
  font-size: 0.7rem;
  padding: 2px 6px;
}
.grow {
  flex: 1;
}

.file-btn {
  position: relative;
  overflow: hidden;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-btn input {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.check-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.field input,
.field textarea,
.field select {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

body[data-theme="dark"] .field input,
body[data-theme="dark"] .field textarea,
body[data-theme="dark"] .field select {
  background: #161a22;
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  min-height: 120px;
}

.pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination.hidden {
  display: none;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

body[data-theme="dark"] .card {
  background: #181d26;
}

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

.thumb-placeholder {
  width: 100%;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6ede4;
  color: var(--muted);
  font-weight: 600;
}

body[data-theme="dark"] .thumb-placeholder {
  background: #222734;
}

.card .meta {
  padding: 10px 12px 12px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  background: #f6ede4;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
}

body[data-theme="dark"] .badge {
  background: #222734;
}

.badge.warn {
  background: #ffe9d6;
  color: #a65a1b;
}

.card.selected {
  outline: 3px solid var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(224, 111, 79, 0.2);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 0 8px;
  display: none;
}

.preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-wrap {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body[data-theme="dark"] .preview-wrap {
  background: #151a22;
}

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

.preview-placeholder {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.pill {
  border-radius: 999px;
  padding: 6px 14px;
}

.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

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

.auth-panel {
  max-width: 520px;
  margin: 0 auto;
}

.auth-hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--panel);
}

.auth-left {
  background:
    radial-gradient(circle at 20% 20%, rgba(199, 240, 0, 0.25) 0%, transparent 55%),
    linear-gradient(135deg, #1b1f28 0%, #252c37 100%);
  color: #fff;
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

.auth-left .subtitle {
  color: rgba(255, 255, 255, 0.75);
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: #10140d;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.auth-right {
  padding: 32px;
  background: var(--panel);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tabs .active {
  background: var(--accent);
  color: #11140d;
  border-color: transparent;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.full {
  width: 100%;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 0;
  margin-top: 6px;
  align-self: flex-end;
}

.auth-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 10px 0;
}

@media (max-width: 900px) {
  .auth-card {
    grid-template-columns: 1fr;
  }
  .auth-left {
    min-height: 220px;
  }
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 12, 9, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body[data-theme="dark"] .modal {
  background: rgba(9, 11, 16, 0.6);
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 640px;
  width: 100%;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body[data-theme="dark"] .modal-card {
  background: #1b2029;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 12px;
  font-family: "DM Sans", sans-serif;
  resize: vertical;
  background: #fff;
  color: var(--text);
}

body[data-theme="dark"] textarea {
  background: #161a22;
  color: var(--text);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  body {
    padding: 16px 14px 96px;
  }

  .topbar {
    padding: 14px;
    gap: 12px;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .top-actions button {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .panel {
    padding: 16px;
  }

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

  .input-row,
  .filter-row {
    grid-template-columns: 1fr;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1 1 calc(50% - 8px);
  }

  .check-group {
    gap: 10px;
  }

  .pagination {
    gap: 8px;
  }

  .topbar {
    background: #151922;
    border-color: #262c36;
  }

  .panel {
    background: #151922;
    border-color: #262c36;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }

  .stat-card {
    background: #1b212c;
    border-color: #2f3643;
  }

  .field input,
  .field textarea,
  .field select,
  textarea {
    background: #10141b;
    color: #f5f6f8;
    border-color: #2f3643;
  }

  .card {
    background: #1b212c;
    border-color: #2f3643;
  }

  .badge {
    background: #222734;
  }

  .preview-wrap {
    background: #10141b;
    border-color: #2f3643;
  }

  .mobile-dock {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 14px;
    background: #151922;
    border: 1px solid #2f3643;
    border-radius: 18px;
    padding: 10px;
    display: flex;
    gap: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    z-index: 10;
  }

  .dock-btn {
    flex: 1;
    height: 44px;
    border-radius: 14px;
    background: var(--accent);
    border: none;
    font-weight: 700;
    color: #11140d;
  }

  .dock-btn.ghost {
    background: #242a36;
    color: #f5f6f8;
    border: 1px solid #2f3643;
  }
}
