:root {
  color-scheme: light;
  --bg: #f4f5f4;
  --panel: #ffffff;
  --panel-soft: #d9eeee;
  --ink: #303a44;
  --muted: #6f7a82;
  --line: #bdd4d6;
  --brand: #ff5428;
  --brand-2: #303a44;
  --accent: #79aeb0;
  --clay: #79aeb0;
  --danger: #c33a20;
  --shadow: 0 16px 42px rgba(48, 58, 68, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(121, 174, 176, 0.24), transparent 30rem),
    linear-gradient(225deg, rgba(255, 84, 40, 0.12), transparent 36rem),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

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

.login-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-brand {
  min-height: 560px;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(48, 58, 68, 0.9), rgba(121, 174, 176, 0.78)),
    url("https://images.unsplash.com/photo-1560518883-ce09059eeffa?auto=format&fit=crop&w=1400&q=80")
      center/cover;
  color: #fff;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.logo-reset {
  min-height: auto;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.logo-reset:hover .logo-mark {
  background: var(--panel-soft);
}

.logo-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 8px;
  font-weight: 900;
}

.brand-copy h1 {
  margin: 0 0 16px;
  max-width: 12ch;
  font-size: clamp(44px, 8vw, 82px);
  line-height: 0.96;
}

.brand-copy p,
.login-help,
.empty-state,
.muted {
  color: var(--muted);
}

.login-brand .brand-copy p,
.login-brand .muted {
  color: rgba(255, 255, 255, 0.78);
}

.login-panel {
  padding: 42px;
  align-self: center;
}

.section-label {
  margin: 0 0 10px;
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-brand .section-label {
  color: #f4f5f4;
}

h2,
h3,
p {
  margin-top: 0;
}

.login-panel h2 {
  margin-bottom: 10px;
  font-size: 32px;
}

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

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

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(121, 174, 176, 0.3);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: #dc4320;
}

.secondary-btn {
  background: var(--panel-soft);
  color: var(--brand);
}

.ghost-btn {
  background: transparent;
  color: var(--brand);
}

.danger-btn {
  background: rgba(195, 58, 32, 0.1);
  color: var(--danger);
}

.icon-btn {
  min-width: 42px;
  padding: 10px;
  background: var(--panel-soft);
  color: var(--ink);
}

.share-btn {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
  background: rgba(121, 174, 176, 0.2);
  color: var(--brand-2);
  font-weight: 900;
  white-space: nowrap;
}

.share-btn-active {
  background: rgba(255, 84, 40, 0.14);
  color: var(--brand);
}

.login-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-weight: 700;
}

.public-share-shell {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(121, 174, 176, 0.24), transparent 32rem),
    linear-gradient(225deg, rgba(255, 84, 40, 0.1), transparent 36rem),
    var(--bg);
}

.public-share-top {
  width: min(1180px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-weight: 800;
}

.public-share-top .logo-mark,
.public-share-state .logo-mark {
  color: var(--brand);
}

.public-listing {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 18px;
  margin: 0 auto;
}

.public-gallery,
.public-details,
.public-share-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.public-gallery {
  padding: 12px;
}

.public-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--panel-soft);
}

.public-thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.public-thumb-button {
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0;
}

.public-thumb-button img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--panel-soft);
}

.public-thumb-button:hover,
.public-thumb-active {
  border-color: var(--brand);
}

.public-details {
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 24px;
}

.public-details h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.02;
}

.public-price {
  color: var(--brand);
  font-size: 30px;
  font-weight: 950;
}

.public-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.public-contact {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.public-contact span {
  color: var(--muted);
  font-weight: 800;
}

.public-share-state {
  width: min(540px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 18vh auto 0;
  padding: 36px;
  text-align: center;
}

.public-share-state h1 {
  margin: 0;
  font-size: 34px;
}

.demo-logins {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #eef8f8;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar .logo-mark {
  color: var(--brand);
}

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

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.workspace {
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.portfolio-area {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat strong {
  display: block;
  margin-bottom: 5px;
  font-size: 26px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-panel {
  position: sticky;
  top: 104px;
  max-height: calc(100vh - 128px);
  max-height: calc(100dvh - 128px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.search-panel::-webkit-scrollbar {
  width: 8px;
}

.search-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--accent);
}

.search-panel::-webkit-scrollbar-track {
  background: transparent;
}

.search-head {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.search-head .secondary-btn {
  justify-self: start;
}

.search-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.08;
}

.search-input-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 14px;
  border: 2px solid var(--brand);
  border-radius: 8px;
  background: #fff;
}

.search-input-wrap input {
  min-height: 54px;
  border: 0;
  padding: 0;
  font-size: 20px;
  box-shadow: none;
}

.search-input-wrap input:focus {
  box-shadow: none;
}

.search-icon {
  color: var(--brand);
  font-size: 22px;
}

.result-count {
  grid-column: 1 / -1;
  justify-self: start;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.quick-toggle-row {
  margin: 12px 0 0;
}

.quick-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  padding: 8px 12px;
  font-weight: 900;
}

.quick-toggle::before {
  content: "▾";
  display: inline-block;
  transition: transform 0.16s ease;
}

.quick-toggle[aria-expanded="false"]::before {
  transform: rotate(-90deg);
}

.quick-toggle strong {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.quick-chips-collapsed {
  display: none;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  min-height: 34px;
  padding: 7px 12px;
  font-weight: 800;
}

.filter-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.filter-toggle,
.clear-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 12px;
  font-weight: 900;
}

.filter-toggle {
  color: var(--brand);
}

.clear-filters-btn {
  color: var(--danger);
}

.clear-filters-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.filter-toggle::before {
  content: "▾";
  display: inline-block;
  transition: transform 0.16s ease;
}

.filter-toggle[aria-expanded="false"]::before {
  transform: rotate(-90deg);
}

.filter-toggle strong {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

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

.filters-collapsed {
  display: none;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 0;
}

.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
}

.listings {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.listing-card {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.listing-card:hover {
  border-color: rgba(255, 84, 40, 0.56);
}

.listing-photo-panel {
  min-width: 0;
}

.photo-main,
.thumb-button {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0;
}

.photo-main {
  aspect-ratio: 4 / 3;
}

.photo-main img,
.thumb-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.18s ease;
}

.photo-main:hover img,
.thumb-button:hover img {
  transform: scale(1.04);
}

.photo-main span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(48, 58, 68, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.photo-thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.thumb-button {
  aspect-ratio: 1;
}

.listing-main h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.price {
  color: var(--brand);
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
  text-align: right;
}

.listing-side {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 10px;
}

.status {
  display: inline-flex;
  justify-content: center;
  min-width: 86px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status.active {
  background: rgba(121, 174, 176, 0.28);
  color: var(--brand-2);
}

.status.pending {
  background: rgba(255, 84, 40, 0.14);
  color: var(--brand);
}

.status.passive {
  background: rgba(48, 58, 68, 0.08);
  color: var(--muted);
}

.listing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.match-line {
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 800;
}

mark {
  border-radius: 4px;
  background: rgba(255, 84, 40, 0.2);
  color: inherit;
  padding: 0 2px;
}

.editor-form {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.listing-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.listing-form-grid .span-2 {
  grid-column: span 2;
}

.listing-form-grid label {
  gap: 5px;
}

.listing-form-grid input,
.listing-form-grid select {
  min-height: 40px;
  padding: 8px 10px;
}

.listing-form-grid textarea {
  min-height: 54px;
  padding: 8px 10px;
}

.editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.photo-upload-field {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.photo-drop-zone {
  min-height: 118px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  color: var(--ink);
  padding: 18px;
  text-align: center;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.editor-form .photo-drop-zone {
  min-height: 76px;
  padding: 10px;
}

.editor-form .photo-drop-zone strong {
  font-size: 16px;
}

.editor-form .photo-drop-zone small,
.editor-form .upload-help,
.editor-form .upload-server-warning {
  font-size: 11px;
}

.photo-drop-zone strong {
  color: var(--brand);
  font-size: 18px;
}

.photo-drop-zone span {
  color: var(--muted);
  font-weight: 800;
}

.photo-drop-zone small {
  color: var(--muted);
  font-weight: 700;
}

.photo-drop-zone:hover,
.photo-drop-zone:focus,
.photo-drop-zone-active {
  border-color: var(--brand);
  background: rgba(255, 84, 40, 0.06);
  box-shadow: 0 0 0 4px rgba(255, 84, 40, 0.12);
}

.photo-file-input {
  display: none;
}

.photo-upload-list,
.photo-upload-group {
  display: grid;
  gap: 8px;
}

.photo-upload-group {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.photo-upload-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-clear-btn {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.photo-upload-item,
.photo-upload-empty {
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.photo-upload-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  padding: 7px 8px;
  border-radius: 8px;
  background: var(--panel-soft);
  overflow-wrap: anywhere;
}

.photo-upload-item img {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  background: #fff;
}

.photo-upload-item div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.photo-upload-item strong {
  color: var(--ink);
  font-size: 12px;
}

.photo-upload-item div span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.cover-choice {
  min-height: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.cover-choice input {
  width: auto;
  min-height: auto;
  accent-color: var(--brand);
  box-shadow: none;
}

.photo-upload-empty {
  display: flex;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.upload-help {
  margin: 0;
  font-size: 12px;
}

.upload-server-warning {
  margin: 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 84, 40, 0.1);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.empty-state {
  padding: 34px 18px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(48, 58, 68, 0.62);
}

.editor-modal {
  width: min(1180px, 100%);
  max-height: min(820px, calc(100vh - 24px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.26);
}

.editor-modal .panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 14px;
  background: var(--panel);
}

.editor-modal .gallery-close {
  background: var(--brand);
  color: #fff;
}

.admin-backdrop {
  position: fixed;
  inset: 0;
  z-index: 47;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(48, 58, 68, 0.62);
}

.admin-modal {
  width: min(1120px, 100%);
  max-height: min(880px, 92vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.26);
}

.admin-modal .panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.admin-modal .gallery-close {
  background: var(--brand);
  color: #fff;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.user-form,
.user-list-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.user-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-section-head h4 {
  margin: 0;
  font-size: 16px;
}

.admin-section-head span,
.admin-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-row > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.user-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.user-badges,
.user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.gallery-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(48, 58, 68, 0.86);
}

.gallery-window {
  width: min(1080px, 100%);
  max-height: min(880px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 8px;
  background: #303a44;
  color: #fff;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
}

.gallery-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.gallery-top div {
  display: grid;
  gap: 3px;
}

.gallery-top span,
.gallery-caption {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.gallery-close,
.gallery-arrow {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 900;
}

.gallery-close {
  min-width: 42px;
  min-height: 42px;
}

.gallery-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.gallery-stage img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
}

.gallery-arrow {
  min-height: 64px;
  font-size: 28px;
}

.gallery-caption {
  padding: 0 16px 16px;
}

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

@media (max-width: 1080px) {
  .public-listing {
    grid-template-columns: 1fr;
  }

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

  .search-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .search-head {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .search-head h1 {
    font-size: clamp(28px, 3vw, 44px);
  }

  .search-input-wrap {
    grid-template-columns: auto 1fr auto;
  }

  .result-count {
    grid-column: auto;
    justify-self: auto;
    margin-bottom: 0;
  }

  .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .listing-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .login-card,
  .workspace,
  .summary-grid,
  .form-grid,
  .search-head,
  .filters {
    grid-template-columns: 1fr;
  }

  .public-share-shell {
    padding: 14px;
  }

  .public-share-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .public-details {
    padding: 18px;
  }

  .public-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-brand {
    min-height: 360px;
    padding: 28px;
  }

  .login-panel,
  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: center;
    flex-wrap: wrap;
    padding: 14px;
  }

  .user-box {
    margin-left: auto;
    gap: 8px;
  }

  .user-box > div {
    display: none;
  }

  .search-input-wrap {
    grid-template-columns: auto 1fr;
  }

  .result-count {
    grid-column: 1 / -1;
    justify-self: start;
    margin-bottom: 10px;
  }

  .listing-card {
    grid-template-columns: 1fr;
  }

  .listing-photo-panel {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 8px;
  }

  .photo-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
  }

  .price {
    text-align: left;
  }

  .listing-side {
    justify-items: start;
  }

  .gallery-backdrop {
    padding: 10px;
  }

  .editor-backdrop {
    padding: 10px;
  }

  .admin-backdrop {
    padding: 10px;
  }

  .admin-layout,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-badges,
  .user-actions {
    justify-content: flex-start;
  }

  .listing-form-grid .span-2 {
    grid-column: 1 / -1;
  }

  .gallery-stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
    padding: 10px;
  }

  .gallery-arrow {
    min-height: 54px;
  }
}

/* Public portfolio view */
.public-portfolio-shell {
  min-height: 100vh;
  background: var(--bg);
}

.public-portfolio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.public-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.public-listing-card {
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(48,58,68,0.08);
  display: flex;
  flex-direction: column;
}

.public-listing-photo {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.public-listing-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.public-listing-photo .photo-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
}

.public-listing-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.public-listing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.public-listing-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.listing-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}

/* Portfolio link controls */
.portfolio-link-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

@media (max-width: 640px) {
  .public-portfolio-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .portfolio-link-controls {
    order: 4;
    width: 100%;
  }
}

/* Sort controls */
.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.sort-group {
  display: flex;
  gap: 2px;
}

.sort-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.sort-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.sort-btn-active {
  background: var(--brand-2);
  color: #fff;
  border-color: var(--brand-2);
}

@media (max-width: 640px) {
  .sort-controls {
    order: 3;
    width: 100%;
  }
  .panel-head {
    flex-wrap: wrap;
  }
}
