:root {
  --bg: #f3efe6;
  --bg-accent: #e4ece4;
  --surface: #fffdf8;
  --ink: #1f2a24;
  --muted: #5f6f66;
  --line: #d5ddd4;
  --brand: #2f5d50;
  --brand-deep: #24483e;
  --accent: #c4a35a;
  --danger: #9b3d3d;
  --shadow: 0 10px 30px rgba(31, 42, 36, 0.08);
  --radius: 14px;
  --font-display: "Rubik", "Heebo", sans-serif;
  --font-body: "Heebo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(47, 93, 80, 0.12), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(196, 163, 90, 0.16), transparent 35%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
}

body {
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(243, 239, 230, 0.88);
  border-bottom: 1px solid var(--line);
}

.top-bar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0.75rem;
}

.top-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.brand-icon {
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand p,
.muted,
.browse-meta,
.eyebrow {
  color: var(--muted);
}

.auth-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}


.brand p {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-user-picture {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-user-name {
  margin: 0;
  font-weight: 600;
}

.auth-user-email {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.app-nav {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.app-nav-link {
  text-decoration: none;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.app-nav-link:hover,
.app-nav-link.active {
  color: var(--brand-deep);
  background: rgba(47, 93, 80, 0.08);
  border-color: rgba(47, 93, 80, 0.15);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem;
}

.form-card,
.editor-card,
.category-panel,
.products-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-card {
  padding: 1.5rem;
  max-width: 520px;
}

.card-header h2,
.editor-header h2,
.category-panel h2 {
  margin: 0;
  font-family: var(--font-display);
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.browse-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 140px;
}

.field.grow {
  flex: 1;
  min-width: 220px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
}

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

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

textarea {
  resize: vertical;
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.6rem 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
}

.btn-primary,
.btn-ghost,
.btn-logout,
.btn-danger,
.remove-cat {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.btn-tiny {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.toolbar-btn {
  margin-bottom: 0.1rem;
  white-space: nowrap;
}

.browse-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
}

.category-panel {
  padding: 1rem;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.cat-item {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  padding-inline-start: calc(0.7rem + var(--depth, 0) * 0.9rem);
  color: var(--ink);
  cursor: pointer;
}

.cat-item:hover,
.cat-item.active {
  background: rgba(47, 93, 80, 0.1);
  color: var(--brand-deep);
}

.products-panel {
  padding: 1rem;
}

.browse-meta {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
}

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

.product-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.product-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e8efe9;
}

.product-thumb.placeholder {
  background:
    linear-gradient(135deg, #d7e4da, #f0ebe0);
}

.product-card-body {
  padding: 0.75rem;
}

.product-card-body h3 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--font-display);
}

.product-brand {
  margin: 0.2rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag-chip {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(196, 163, 90, 0.18);
  color: #6d5524;
}

.empty-state {
  color: var(--muted);
  margin: 1rem 0;
}

.editor-card {
  padding: 1.25rem;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.editor-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.editor-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.35rem;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.4rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 400;
}

.category-multiselect {
  width: 100%;
  min-height: 8rem;
  padding: 0.4rem;
  line-height: 1.6;
}

.category-multiselect option {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

@media (hover: none), (pointer: coarse) {
  .category-multiselect-hint {
    display: none;
  }
}

.image-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.image-tile {
  width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.image-tile img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.image-upload-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.file-picker-btn {
  position: relative;
  cursor: pointer;
}

.file-picker-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.file-picker-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

.cat-table th,
.cat-table td {
  text-align: start;
  padding: 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.cat-table th {
  text-align: center;
}

.cat-table input,
.cat-table select {
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  z-index: 50;
  max-width: min(90vw, 420px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-error {
  background: var(--danger);
}

.toast-success {
  background: var(--brand);
}

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

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

  .top-bar-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
