:root {
  color-scheme: light;
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-muted: #f5f6f7;
  --text: #1d1f23;
  --muted: #6d7885;
  --line: #dce1e6;
  --accent: #2688eb;
  --accent-hover: #1e78d6;
  --accent-soft: #e9f2fc;
  --on-accent: #ffffff;
  --success: #2d9b5f;
  --success-soft: #e5f5ec;
  --shadow: 0 16px 45px rgba(28, 31, 36, .08);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-header {
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
  padding: max(22px, env(safe-area-inset-top)) 22px 18px;
  background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line);
}
.eyebrow, .section-kicker { font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.eyebrow { color: var(--accent); }
h1 { margin: 5px 0 0; font-family: Georgia, serif; font-size: clamp(27px, 7vw, 42px); font-weight: 500; }
h2 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
h3 { margin: 0 0 16px; }
.badge { padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 12px; }
.badge.connected { color: var(--success); border-color: transparent; background: var(--success-soft); }

.tabs {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 4px;
  padding: 8px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.tab { flex: 1; border: 0; border-radius: 8px; padding: 10px; background: transparent; color: var(--muted); font-weight: 700; }
.tab:hover { color: var(--text); background: var(--surface-muted); }
.tab.active { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 28px 18px 70px; }
.view { display: none; }
.view.active { display: block; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-kicker { margin: 0; color: var(--accent); }

.lot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.lot-card, .panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.lot-card { display: flex; flex-direction: column; min-height: 330px; overflow: hidden; border-radius: 4px; }
.lot-image { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; background: #dad6cc; }
.lot-image.placeholder { display: grid; place-items: center; font-family: Georgia, serif; font-size: 44px; color: #8a867d; }
.lot-body { display: flex; flex: 1; flex-direction: column; padding: 17px; }
.lot-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.lot-title { margin: 13px 0 6px; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.lot-description { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.lot-price { margin-top: auto; font-size: 25px; font-weight: 800; }
.lot-actions { display: flex; gap: 8px; margin-top: 13px; }

.panel { padding: 20px; border-radius: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; color: #484e57; font-size: 13px; font-weight: 700; }
.field input, .field textarea {
  width: 100%; border: 1px solid #c8c7c1; border-radius: 5px; padding: 12px;
  background: var(--surface); color: var(--text); outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.wide { grid-column: 1 / -1; }
.toggle { display: flex; align-items: center; gap: 10px; color: #41464e; }
.toggle input { width: 20px; height: 20px; }

.button { border: 0; border-radius: 5px; padding: 11px 14px; font-weight: 800; }
.button.primary, .button.secondary { background: var(--accent); color: var(--on-accent); }
.button.primary:hover, .button.secondary:hover { background: var(--accent-hover); }
.button.ghost { border: 1px solid var(--line); background: transparent; color: var(--text); }
.button.ghost:hover { background: var(--surface-muted); }
.button.small { padding: 8px 10px; font-size: 12px; }
.button:disabled { opacity: .55; cursor: wait; }

.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-icon { margin: auto; display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 50%; font-size: 26px; }
.empty h3 { margin: 18px 0 5px; color: var(--text); }
.empty p { margin: 0; }
.admin-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; }
.pending-list { display: grid; gap: 10px; }
.pending-item { padding: 14px 0; border-top: 1px solid var(--line); }
.pending-item:first-child { border-top: 0; }
.pending-actions { display: flex; gap: 8px; margin-top: 10px; }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; translate: -50% 20px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 6px; background: var(--text); color: var(--bg); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; translate: -50% 0; }

@media (max-width: 650px) {
  .app-header { align-items: start; }
  .form-grid, .admin-layout { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  main { padding-inline: 12px; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #19191a;
  --surface: #232324;
  --surface-muted: #2c2d2e;
  --text: #e1e3e6;
  --muted: #909499;
  --line: #363738;
  --accent: #71aaeb;
  --accent-hover: #5c9ddd;
  --accent-soft: rgba(113, 170, 235, .16);
  --on-accent: #ffffff;
  --success: #63c98a;
  --success-soft: rgba(74, 201, 126, .14);
  --shadow: none;
}

:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field textarea {
  background: var(--bg);
  border-color: #454647;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #19191a;
    --surface: #232324;
    --surface-muted: #2c2d2e;
    --text: #e1e3e6;
    --muted: #909499;
    --line: #363738;
    --accent: #71aaeb;
    --accent-hover: #5c9ddd;
    --accent-soft: rgba(113, 170, 235, .16);
    --on-accent: #ffffff;
    --success: #63c98a;
    --success-soft: rgba(74, 201, 126, .14);
    --shadow: none;
  }
}
