:root {
  --beige: #b6aca0;
  --beige-dark: #9f9284;
  --ink: #1e1e1e;
  --muted: #766f68;
  --line: #e5ded6;
  --paper: #fffdf9;
  --white: #ffffff;
  --danger: #a83b32;
  --success: #286846;
  --heading: "Playfair Display", serif;
  --body: "Albert Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6f1eb;
  color: var(--ink);
  font-family: var(--body);
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.login-hero {
  background: linear-gradient(rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.28)), url("/site-images/bg image.png") center/cover;
  color: white;
  padding: 72px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.login-hero h1,
.page-title h1,
.panel-title,
.preview-title {
  font-family: var(--heading);
  font-weight: 500;
  letter-spacing: 0;
}

.login-hero h1 {
  max-width: 620px;
  font-size: 68px;
  line-height: 1.03;
  margin: 0 0 18px;
}

.login-hero p {
  max-width: 560px;
  font-size: 20px;
  line-height: 1.7;
  margin: 0;
}

.login-panel {
  background: var(--paper);
  padding: 56px;
  display: flex;
  align-items: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.eyebrow {
  color: var(--beige-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h2 {
  font-family: var(--heading);
  font-size: 42px;
  font-weight: 500;
  margin: 12px 0 10px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field label {
  color: #3a332e;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
}

.field textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--beige);
  box-shadow: 0 0 0 3px rgba(182, 172, 160, 0.22);
}

.image-picker {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  min-width: 0;
}

.image-picker-label {
  color: #3a332e;
  font-weight: 700;
}

.image-picker-box {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f3;
  padding: 10px;
}

.image-picker-box img {
  width: 140px;
  height: 104px;
  max-width: 100%;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  background: #ddd;
}

.image-picker-meta {
  min-width: 0;
}

.image-picker-meta strong,
.image-picker-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-picker-meta strong {
  margin-bottom: 6px;
}

.image-picker-meta span {
  color: var(--muted);
}

.image-picker select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px 14px;
  color: var(--ink);
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 800;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--beige);
  color: #111;
}

.btn-primary:hover {
  background: var(--beige-dark);
}

.btn-dark {
  background: var(--ink);
  color: white;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-danger {
  background: #f8e7e4;
  color: var(--danger);
}

.message {
  min-height: 24px;
  color: var(--danger);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.mobile-header {
  display: none;
}

.sidebar {
  background: var(--ink);
  color: white;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.brand img {
  width: 110px;
  filter: brightness(0) invert(1);
}

.brand span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
  margin-top: 12px;
}

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

.nav button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
}

.nav button.active,
.nav button:hover {
  background: rgba(182, 172, 160, 0.18);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
}

.sidebar-logout {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.08);
}

.content {
  padding: 32px;
  overflow: auto;
}

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

.page-title h1 {
  font-size: 44px;
  margin: 0 0 6px;
}

.page-title p {
  color: var(--muted);
  margin: 0;
}

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

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.panel,
.preview-card,
.item-card,
.upload-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(30, 30, 30, 0.06);
}

.panel {
  padding: 24px;
}

.panel + .panel {
  margin-top: 18px;
}

.panel-title {
  font-size: 28px;
  margin: 0 0 18px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

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

.item-head strong {
  font-family: var(--heading);
  font-size: 24px;
  font-weight: 500;
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

.preview-card {
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.preview-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(100%);
  background: #ddd;
}

.preview-body {
  padding: 20px;
}

.preview-title {
  font-size: 30px;
  margin: 0 0 8px;
}

.preview-body p {
  color: var(--muted);
  line-height: 1.6;
}

.price {
  font-size: 32px;
  font-weight: 800;
}

.price span {
  color: var(--muted);
  font-size: 15px;
  margin-left: 4px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.image-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
  min-width: 0;
}

.image-tile img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.image-tile code {
  display: block;
  padding: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-tile strong {
  display: block;
  padding: 10px 10px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-card {
  padding: 18px;
  margin-bottom: 20px;
}

.json-box {
  width: 100%;
  min-height: 520px;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
}

.status {
  color: var(--success);
  font-weight: 800;
}

.warning {
  background: #fff8e6;
  border: 1px solid #f0d7a5;
  border-radius: 8px;
  color: #70531c;
  padding: 12px 14px;
  margin: 14px 0;
}

.muted-copy {
  color: var(--muted);
  line-height: 1.6;
  margin: -6px 0 22px;
}

.profile-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.profile-card {
  padding: 24px;
  text-align: center;
}

.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--heading);
  font-size: 42px;
  margin-top: 8px;
}

@media (max-width: 980px) {
  .login-shell,
  .grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: block;
    padding-top: 72px;
  }

  .mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    background: var(--ink);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0 22px;
  }

  .mobile-header img {
    width: 84px;
    filter: brightness(0) invert(1);
  }

  .mobile-nav-toggle {
    display: inline-grid;
    gap: 5px;
    width: 44px;
    height: 44px;
    place-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 999px;
  }

  .login-hero {
    min-height: 360px;
    padding: 36px;
  }

  .login-hero h1 {
    font-size: 44px;
  }

  .sidebar {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    width: 100vw;
    height: calc(100vh - 72px);
    min-height: 0;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }

  .app-shell.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .brand {
    text-align: center;
  }

  .brand img {
    width: 128px;
  }

  .brand span {
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .sidebar-footer {
    position: sticky;
    bottom: 0;
    background: var(--ink);
    padding-bottom: 4px;
  }

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

  .preview-card {
    position: static;
  }

  .image-picker-box {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .image-picker-box img {
    width: 96px;
    height: 76px;
  }
}

@media (max-width: 640px) {
  .login-hero {
    min-height: 300px;
    padding: 28px 22px;
  }

  .login-hero h1 {
    font-size: 38px;
  }

  .login-panel,
  .content,
  .sidebar {
    padding: 22px;
  }

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

  .nav button {
    padding: 16px;
    text-align: center;
  }

  .page-title h1 {
    font-size: 34px;
  }

  .actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .actions .status {
    flex: 1 0 100%;
  }

  .actions .btn {
    flex: 1 1 150px;
  }

  .panel,
  .item-card,
  .upload-card,
  .preview-body {
    padding: 18px;
  }

  .item-head,
  .feature-row {
    grid-template-columns: 1fr;
  }

  .item-head {
    display: grid;
    align-items: start;
  }

  .feature-row .btn,
  .item-head .btn {
    width: 100%;
  }

  .image-picker-box {
    grid-template-columns: 1fr;
  }

  .image-picker-box img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .json-box {
    min-height: 360px;
  }
}
