/* ============================================================
   CONCEPT CAR — Painel administrativo
   ============================================================ */

:root {
  --bg: #0B0B0C;
  --surface: #131315;
  --surface-2: #1A1A1D;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #EDEDEF;
  --muted: #9A9AA2;
  --faint: #5A5A62;
  --accent: #C7A468;
  --accent-bright: #E2C48D;
  --green: #4fd07a;
  --amber: #E2B84D;
  --danger: #E07070;
  --radius: 4px;
  --sidebar-w: 232px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ---------- Inputs / botões ---------- */

.input, .select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  transition: border-color .2s;
}

.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { border-color: var(--accent); outline: none; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239A9AA2' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

textarea.input { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all .2s;
  white-space: nowrap;
}

.btn-solid { background: var(--accent); color: #101010; }
.btn-solid:hover { background: var(--accent-bright); }
.btn-solid:disabled { opacity: .55; cursor: default; }

.btn-ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-bright); }

.btn-sm {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  transition: all .18s;
}
.btn-sm:hover { color: var(--text); border-color: var(--accent); }
.btn-sm.danger:hover { color: var(--danger); border-color: var(--danger); }
.btn-sm.ghost { border-color: transparent; }
.btn-sm.ghost:hover { border-color: var(--line-strong); }

.form-field { margin-bottom: 16px; }

.form-field > label {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.check-field { display: flex; align-items: flex-end; padding-bottom: 10px; }
.check-field label {
  display: flex; align-items: center; gap: 9px;
  text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text);
  cursor: pointer; margin: 0;
}
.check-field input { accent-color: var(--accent); width: 16px; height: 16px; }

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

.form-msg { font-size: 13.5px; margin-top: 10px; display: none; }
.form-msg.ok { display: block; color: var(--green); }
.form-msg.err { display: block; color: var(--danger); }

.hint-inline { color: var(--faint); text-transform: none; letter-spacing: 0; }

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 45% at 70% 20%, rgba(199, 164, 104, 0.06), transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 40px 36px;
  animation: login-rise .6s cubic-bezier(.2, .7, .25, 1) both;
}

@keyframes login-rise {
  from { opacity: 0; transform: translateY(22px); }
}

.login-logo { width: 250px; max-width: 100%; height: auto; margin: 0 auto 12px; }

.login-sub {
  text-align: center;
  font-family: 'Michroma', sans-serif;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 30px;
}

/* ---------- Layout do app ---------- */

.admin-app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #09090A;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.side-close {
  display: none;
  position: absolute;
  top: 14px;
  right: 12px;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
}
.side-close:hover { color: var(--text); border-color: var(--accent); }

.side-brand { padding: 4px 12px 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.side-brand img { width: 172px; max-width: 100%; height: auto; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: var(--radius);
  text-align: left;
  transition: all .18s;
}

.side-link svg { width: 17px; height: 17px; flex-shrink: 0; }

.side-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.side-link.active {
  color: var(--accent-bright);
  background: rgba(199, 164, 104, 0.09);
}

.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }

.pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  color: #101010;
  border-radius: 100px;
  padding: 1px 8px;
}

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

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(11,11,12,0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar h1 {
  font-size: 19px;
  font-weight: 700;
  font-stretch: 115%;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-chip {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  padding: 5px 14px;
}

.side-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  width: 38px; height: 38px;
  font-size: 16px;
}

.view { padding: 32px; }

.view-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }

/* ---------- Barra de alterações pendentes ---------- */

.save-bar {
  position: sticky;
  top: 86px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(199, 164, 104, 0.12);
  border: 1px solid rgba(199, 164, 104, 0.5);
  border-radius: 6px;
  padding: 12px 18px;
  margin-bottom: 18px;
  backdrop-filter: blur(8px);
}

.save-bar .txt {
  color: var(--accent-bright);
  font-size: 13.5px;
  font-weight: 600;
  margin-right: auto;
}

.data-table tr.dirty td { background: rgba(199, 164, 104, 0.05); }
.data-table tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- Painéis / stats ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 24px;
}

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px 24px;
}

.stat-card .k {
  font-family: 'Michroma', sans-serif;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}

.stat-card .v {
  font-size: 30px;
  font-weight: 750;
  font-stretch: 112%;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-card .v.gold { color: var(--accent-bright); }
.stat-card .v.green { color: var(--green); }
.stat-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Tabela ---------- */

.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }

.data-table th {
  font-family: 'Michroma', sans-serif;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(255,255,255,0.015); }

.data-table .thumb {
  width: 60px; height: 40px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.data-table .v-name { font-weight: 600; }
.data-table .v-ver { color: var(--muted); font-size: 12.5px; }
.data-table .num { font-variant-numeric: tabular-nums; }
.data-table .price { color: var(--accent-bright); font-weight: 600; font-variant-numeric: tabular-nums; }

.status-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  font-size: 12px;
  padding: 5px 26px 5px 12px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%239A9AA2' fill='none' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.status-select.available { color: var(--green); border-color: rgba(79,208,122,.4); }
.status-select.reserved { color: var(--amber); border-color: rgba(226,184,77,.4); }
.status-select.sold { color: var(--danger); border-color: rgba(224,112,112,.4); }

.star-btn {
  background: none;
  border: none;
  font-size: 19px;
  color: var(--faint);
  transition: color .15s, transform .15s;
  line-height: 1;
}
.star-btn.on { color: var(--accent-bright); }
.star-btn:hover { transform: scale(1.15); }

.row-actions { display: flex; gap: 6px; }

/* ---------- Leads ---------- */

.leads-list { display: flex; flex-direction: column; gap: 14px; }

.lead-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 6px;
  padding: 18px 22px;
}

.lead-card.new { border-left-color: var(--accent); }
.lead-card.contacted { border-left-color: var(--amber); }
.lead-card.closed { border-left-color: var(--faint); opacity: .75; }

.lead-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.lead-head .name { font-weight: 700; font-size: 15.5px; }
.lead-head .when { color: var(--faint); font-size: 12.5px; margin-left: auto; }

.lead-contact { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.lead-contact a { color: var(--accent-bright); }

.lead-vehicle {
  display: inline-block;
  font-size: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  padding: 3px 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.lead-msg { font-size: 14px; color: var(--text); }

.lead-foot { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.empty-note {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}

/* ---------- Configurações ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: start;
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal {
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal form { display: flex; flex-direction: column; min-height: 0; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-head h2 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-close {
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  width: 34px; height: 34px;
  font-size: 14px;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }

.modal-body { padding: 24px 26px; overflow-y: auto; }

.modal-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* gerenciador de imagens */

.img-manager {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

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

.img-tile {
  position: relative;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.img-tile img { width: 100%; height: 100%; object-fit: cover; }

.img-tile .rm {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}
.img-tile .rm:hover { background: var(--danger); }

.img-tile .cover-tag {
  position: absolute;
  left: 5px; bottom: 5px;
  font-family: 'Michroma', sans-serif;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.7);
  color: var(--accent-bright);
  padding: 3px 7px;
  border-radius: 2px;
}

/* autocomplete (marca, modelo, opcionais) */

.combo { position: relative; }

.combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  max-height: 236px;
  overflow-y: auto;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.combo-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.combo-item:hover,
.combo-item.hl {
  background: rgba(199, 164, 104, 0.13);
  color: var(--accent-bright);
}

/* seletor de opcionais */

.feat-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.feat-selected:empty { display: none; }

.feat-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 100px;
  background: rgba(199, 164, 104, 0.12);
  border: 1px solid rgba(199, 164, 104, 0.45);
  color: var(--accent-bright);
}

.feat-chip button {
  background: none;
  border: none;
  color: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  opacity: .7;
}
.feat-chip button:hover { opacity: 1; }

.feat-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  max-height: 196px;
  overflow-y: auto;
  padding-right: 4px;
}

/* campo de preço com prefixo R$ */

.price-wrap { position: relative; }

.price-wrap span {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.price-wrap .input { padding-left: 42px; font-variant-numeric: tabular-nums; }

.feat-suggest button {
  font-size: 12.5px;
  padding: 6px 13px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  transition: all .15s;
}

.feat-suggest button:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
}

.upload-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .2s;
}

.upload-drop:hover { border-color: var(--accent); color: var(--accent-bright); }

/* ---------- Responsivo ---------- */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: none; }
  .side-toggle { display: grid; place-items: center; }
  .side-close { display: grid; place-items: center; }
  .view { padding: 20px; }
  .admin-topbar { padding: 14px 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

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

@media (prefers-reduced-motion: reduce) {
  .login-card { animation: none !important; }
  * { transition-duration: .01ms !important; }
}
