:root {
  --bg: #0d0f12;
  --panel: #15181d;
  --panel-2: #101318;
  --text: #f3f4f6;
  --muted: #a2aab7;
  --line: rgba(255,255,255,0.08);
  --gold: #c9a96b;
  --gold-dark: #9c7a43;
  --danger: #d45b5b;
  --success: #7fdaa3;
  --radius: 22px;
  --shadow: 0 20px 55px rgba(0,0,0,.28);
  --sidebar-width: 290px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top right, rgba(201,169,107,.12), transparent 22%), var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.admin-toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 220;
  display: grid;
  gap: 12px;
  width: min(100%, 360px);
}

.admin-toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(15,18,22,.96);
  box-shadow: 0 24px 42px rgba(0,0,0,.28);
  transform: translateY(10px);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}

.admin-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.admin-toast.is-leaving {
  transform: translateY(6px);
  opacity: 0;
}

.admin-toast.success { border-color: rgba(127,218,163,.24); }
.admin-toast.error { border-color: rgba(212,91,91,.3); }
.admin-toast.info { border-color: rgba(201,169,107,.24); }

.admin-toast-copy {
  display: grid;
  gap: 4px;
}

.admin-toast-copy strong {
  font-size: .92rem;
}

.admin-toast-copy span {
  color: var(--muted);
  line-height: 1.55;
}

.admin-toast-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  flex: 0 0 auto;
}

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

.auth-card {
  width: min(100%, 460px);
  background: rgba(21,24,29,.96);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.back-to-site { color: var(--muted); }
.auth-brand, .admin-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #111;
  font-weight: 900;
}
.auth-brand span, .admin-brand span { display: grid; }
.auth-brand small, .admin-brand small { color: var(--muted); }
.auth-card h1, .admin-topbar h1 { margin: 18px 0 8px; }
.auth-card p, .admin-topbar p, .panel-subtitle { color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; word-break: break-word; }
.hint, .form-message { display: block; margin-top: 14px; min-height: 22px; }
.form-message.info, .field-hint.info { color: #d9dde5; }
.form-message.success, .field-hint.success { color: var(--success); }
.form-message.error, .field-hint.error { color: #ffaaaa; }
.form-message {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.03);
}
.form-message:empty {
  display: none;
}
.form-message.info {
  border-color: rgba(201,169,107,.18);
}
.form-message.success {
  border-color: rgba(127,218,163,.22);
}
.form-message.error {
  border-color: rgba(212,91,91,.24);
}

.admin-body { min-height: 100vh; display: flex; }
.admin-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  position: sticky;
  top: 0;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(16,19,24,.98);
}
.admin-nav { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.admin-nav a, .admin-btn.ghost {
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
}
.admin-nav a.active, .admin-nav a:hover, .admin-btn.ghost:hover {
  color: var(--text);
  background: rgba(201,169,107,.1);
  border-color: rgba(201,169,107,.16);
}
.admin-main { flex: 1; padding: 28px; min-width: 0; }
.admin-topbar {
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.admin-topbar .admin-btn { white-space: nowrap; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card, .admin-panel {
  background: rgba(21,24,29,.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-card { padding: 22px; }
.stat-card span { display: block; color: var(--muted); margin-bottom: 10px; }
.stat-card strong { font-size: 2rem; }
.admin-panel { padding: 22px; margin-bottom: 22px; }
.admin-panel h2 { margin-top: 0; }
.admin-panel-internal {
  border-color: rgba(201,169,107,.18);
  background: linear-gradient(180deg, rgba(201,169,107,.08), rgba(21,24,29,.96) 48%);
}
.admin-panel-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.admin-panel-copy {
  color: var(--muted);
  line-height: 1.7;
  margin: -4px 0 18px;
}

.admin-form-grid, .admin-form { display: block; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
.checks-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
.admin-field { display: flex; flex-direction: column; gap: 8px; }
.admin-field.col-2 { grid-column: span 2; }
.admin-field.align-end { justify-content: flex-end; }
.admin-field input,
.admin-field select,
.admin-field textarea {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 16px;
}
.admin-field textarea { min-height: 132px; padding: 14px 16px; resize: vertical; }
.admin-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.checkbox-card {
  align-items: flex-start;
  min-height: auto;
  padding: 16px;
}
.admin-check input { accent-color: var(--gold); margin-top: 2px; }

.field-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.field-inline input { flex: 1 1 220px; }
.inline-btn {
  min-height: 52px;
  white-space: nowrap;
}
.field-hint {
  display: block;
  min-height: 20px;
  color: var(--muted);
}
.field-error-message {
  display: block;
  color: #ffaaaa;
  min-height: 20px;
  line-height: 1.45;
}
.preview-box {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: #d9dde5;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.image-draft-status {
  color: var(--muted);
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
}

.image-draft-status.success {
  border-color: rgba(127,218,163,.24);
  color: var(--success);
}

.image-draft-status.error,
.image-draft-status.is-invalid {
  border-color: rgba(212,91,91,.24);
  color: #ffb3b3;
}

.image-draft-status.info {
  border-color: rgba(201,169,107,.18);
  color: #d9dde5;
}

.image-draft-status.is-processing {
  position: relative;
  overflow: hidden;
}

.image-draft-status.is-processing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: adminShimmer 1.2s linear infinite;
}

.image-draft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.image-draft-grid.is-invalid {
  border: 1px dashed rgba(212,91,91,.34);
  border-radius: 18px;
  padding: 12px;
}

.image-draft-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.03);
  padding: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}

.image-draft-card.is-cover {
  border-color: rgba(201,169,107,.38);
  box-shadow: 0 18px 36px rgba(0,0,0,.24);
}

.image-draft-thumb-wrap {
  position: relative;
}

.image-draft-thumb {
  width: 100%;
  aspect-ratio: 1.2;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

.image-draft-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(12,14,18,.84);
  border: 1px solid rgba(201,169,107,.3);
  color: var(--text);
  font-size: .78rem;
  font-weight: 700;
}

.image-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.image-draft-empty {
  display: grid;
  gap: 8px;
  align-content: center;
  min-height: 170px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(201,169,107,.22);
  background: rgba(255,255,255,.02);
}

.image-draft-empty strong {
  font-size: 1rem;
}

.image-draft-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-field input.is-invalid,
.admin-field select.is-invalid,
.admin-field textarea.is-invalid {
  border-color: rgba(212,91,91,.7);
  box-shadow: 0 0 0 3px rgba(212,91,91,.14);
}

.admin-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 12px;
  padding: 16px 0 0;
  border-top: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, rgba(13,15,18,0), rgba(13,15,18,.96) 30%);
}
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}
.admin-btn.small { min-height: 40px; padding: 0 14px; font-size: .9rem; }
.admin-btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}
.admin-btn.danger { background: var(--danger); }
.admin-btn.full { width: 100%; }
.admin-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0,0,0,.2);
}
.admin-btn:disabled,
.admin-btn.is-loading {
  cursor: progress;
  opacity: .75;
  box-shadow: none;
  transform: none;
}

.table-wrap { overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.admin-table th, .admin-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: top;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.table-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.table-private {
  color: #e6c98f;
}
.admin-thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
}
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-status {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
}
.status-disponivel { background: rgba(63, 185, 121, .14); color: #7fdaa3; }
.status-reservado { background: rgba(236, 178, 55, .14); color: #ffd88d; }
.status-vendido { background: rgba(212, 91, 91, .15); color: #ffb3b3; }
.status-oculto { background: rgba(255,255,255,.08); color: #cfd5de; }

.admin-empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 18px 10px;
}

.admin-empty-state strong {
  font-size: 1rem;
}

.admin-empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.72);
}
.admin-modal-overlay.hidden { display: none !important; }
.admin-modal {
  width: min(1100px, 100%);
  max-height: 92vh;
  overflow: hidden;
  background: #111419;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}
.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 0;
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(17,20,25,.96);
}
.admin-modal form {
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

.hidden { display: none !important; }

@keyframes adminShimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (max-width: 1180px) {
  .stats-grid, .checks-grid, .checkbox-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 960px) {
  .admin-body { flex-direction: column; }
  .admin-sidebar { width: 100%; min-height: auto; position: relative; }
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .admin-main { padding: 18px; }
  .admin-grid, .stats-grid, .checks-grid, .checkbox-grid { grid-template-columns: 1fr; }
  .admin-field.col-2 { grid-column: auto; }
  .admin-topbar { flex-direction: column; }
}

@media (max-width: 640px) {
  .auth-card, .admin-panel { padding: 18px; }
  .admin-modal form { padding: 18px; }
  .admin-modal-header { padding: 18px 18px 16px; }
  .admin-main { padding: 14px; }
  .admin-modal-header { flex-direction: column; }
  .table-actions, .admin-actions, .field-inline { flex-direction: column; }
  .admin-btn, .admin-btn.small, .inline-btn { width: 100%; }
  .image-draft-grid { grid-template-columns: 1fr; }
  .image-draft-actions {
    flex-direction: column;
  }
  .sticky-actions {
    position: static;
    padding-top: 12px;
    background: transparent;
  }
  .admin-nav a,
  .admin-btn.ghost {
    width: 100%;
  }
  .admin-toast-stack {
    right: 14px;
    left: 14px;
    width: auto;
    bottom: 14px;
  }
}
