:root {
  --gold: #9a8256;
  --dark: #1a1a1a;
  --txt: #1a1a1a;
  --txt2: #4a4a4a;
  --muted: #888;
  --bg: #fff;
  --bg2: #fafafa;
  --bd: #eaeaea;
  --bd2: #d5d5d5;
  --disp: 'Inter', sans-serif;
  --body: 'Zen Kaku Gothic New', sans-serif;
  --ok: #2d7a4a;
  --err: #c44545;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--body);
  background: var(--bg2);
  color: var(--txt);
  line-height: 1.8;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  background: var(--dark);
  color: #fff;
  padding: 0.9rem 0;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--disp);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand small {
  color: #bbb;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.topbar-nav a,
.topbar-nav button {
  font-family: var(--disp);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: #ddd;
  background: transparent;
  border: 1px solid #444;
  padding: 0.5rem 1rem;
  border-radius: 2px;
  cursor: pointer;
  transition: 0.2s;
  text-decoration: none;
}

.topbar-nav a:hover,
.topbar-nav a.active,
.topbar-nav button:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
  text-decoration: none;
}

.main {
  padding: 2.5rem 0 4rem;
}

.view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.view-title {
  font-family: var(--disp);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--txt);
}

.view-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

select,
input,
textarea {
  font-family: var(--body);
  font-size: 0.88rem;
  color: var(--txt);
  background: #fff;
  border: 1px solid var(--bd);
  padding: 0.6rem 0.8rem;
  border-radius: 3px;
  outline: none;
  transition: 0.2s;
  width: 100%;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--gold);
  background: var(--bg2);
}

.filters select {
  width: auto;
  min-width: 150px;
}

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

.card {
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 4px;
  overflow: hidden;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
    border-color: var(--bd2);
  }
}

.card-img {
  aspect-ratio: 16 / 10;
  background: #f0eee8;
  background-size: cover;
  background-position: center;
  position: relative;
}

.card-img .ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 0.75rem;
  font-family: var(--disp);
  letter-spacing: 0.1em;
}

.card-badges {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.6rem;
  font-family: var(--disp);
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  background: rgba(26, 26, 26, 0.82);
  color: #fff;
}

.badge.deal {
  background: var(--gold);
}

.card-imgcount {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(26, 26, 26, 0.78);
  color: #fff;
  font-size: 0.6rem;
  font-family: var(--disp);
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.card-body {
  padding: 1.1rem 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card-price {
  font-family: var(--disp);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--txt);
}

.card-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--txt);
}

.card-loc {
  font-size: 0.78rem;
  color: var(--txt2);
}

.card-meta {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--bd2);
  border-radius: 6px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 860px) {
  .admin-grid {
    grid-template-columns: 380px 1fr;
  }
}

.panel {
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 6px;
  padding: 1.5rem;
}

.panel h3 {
  font-family: var(--disp);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--txt);
}

.fld {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.fld label {
  font-size: 0.75rem;
  color: var(--txt2);
  font-weight: 500;
}

.fld .req {
  color: var(--gold);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

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

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.toggle-row input[type='checkbox'] {
  width: auto;
}

.btn {
  font-family: var(--disp);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  padding: 0.7rem 1.3rem;
  border-radius: 3px;
  border: 1px solid var(--dark);
  background: var(--dark);
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
}

.btn:hover {
  background: var(--gold);
  border-color: var(--gold);
}

.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn.ghost {
  background: transparent;
  color: var(--txt);
  border-color: var(--bd2);
}

.btn.ghost:hover {
  background: var(--dark);
  color: #fff;
  border-color: var(--dark);
}

.btn.sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.68rem;
}

.btn.danger {
  border-color: var(--err);
  color: var(--err);
  background: transparent;
}

.btn.danger:hover {
  background: var(--err);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.status {
  font-size: 0.8rem;
  min-height: 1.2rem;
  margin-top: 0.6rem;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--err);
}

.img-hint {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

input[type='file'] {
  padding: 0.5rem 0.6rem;
  font-family: var(--disp);
  font-size: 0.78rem;
  cursor: pointer;
}

.img-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.img-previews:empty {
  display: none;
}

.img-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 4px;
  background: #f0eee8;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--bd);
}

.img-thumb .rm {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--err);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-thumb .cover {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(26, 26, 26, 0.72);
  color: #fff;
  font-size: 0.55rem;
  font-family: var(--disp);
  letter-spacing: 0.05em;
  text-align: center;
  padding: 0.12rem 0;
}

.list-item {
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem;
  border: 1px solid var(--bd);
  border-radius: 5px;
  margin-bottom: 0.75rem;
  align-items: center;
}

.list-thumb {
  width: 64px;
  height: 48px;
  border-radius: 3px;
  background: #f0eee8;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-main .t {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-main .s {
  font-size: 0.74rem;
  color: var(--muted);
}

.pill {
  display: inline-block;
  font-size: 0.62rem;
  font-family: var(--disp);
  padding: 0.1rem 0.45rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.pill.pub {
  background: #e6f3ea;
  color: var(--ok);
}

.pill.hid {
  background: #f1efe8;
  color: var(--muted);
}

.pill.sched {
  background: #eef3fa;
  color: #3a6ea8;
}

.list-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.icon-btn {
  border: 1px solid var(--bd2);
  background: #fff;
  color: var(--txt2);
  cursor: pointer;
  border-radius: 3px;
  padding: 0.35rem 0.55rem;
  font-size: 0.7rem;
  transition: 0.2s;
}

.icon-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}

.modal-bg.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 8px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}

.modal-img {
  aspect-ratio: 16 / 9;
  background: #f0eee8;
  background-size: cover;
  background-position: center;
}

.modal-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--txt);
  z-index: 1;
}

.modal-close:focus-visible {
  outline: 2px solid var(--gold);
}

.modal .price {
  font-family: var(--disp);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0.5rem 0;
}

.modal-thumbs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.modal-thumbs .mt {
  width: 58px;
  height: 44px;
  border-radius: 3px;
  background: #f0eee8;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: 0.2s;
}

.modal-thumbs .mt.active {
  border-color: var(--gold);
}

.modal dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.modal dt {
  color: var(--muted);
}

.modal dd {
  color: var(--txt);
}

.modal .desc {
  margin-top: 1.25rem;
  font-size: 0.86rem;
  color: var(--txt2);
  white-space: pre-wrap;
  line-height: 1.9;
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.legal-note {
  margin-top: 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--bd);
  border-radius: 4px;
  background: var(--bg);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.7;
}

.legal-note strong {
  color: var(--txt2);
  font-weight: 500;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-panel {
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 6px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.login-panel h1 {
  font-family: var(--disp);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.login-panel .sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.auth-denied {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

@media (max-width: 640px) {
  .list-item {
    flex-wrap: wrap;
  }

  .list-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
