/* =========================================================
   PAINEL DE ESTOQUE — design tokens
   Conceito: ficha de veículo física (nota de estoque de
   concessionária) digitalizada. Selo/carimbo de status,
   numeração tipo "ficha", tipografia mono para dados
   objetivos (ano/km/preço), serifada só no essencial.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,500&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* cor */
  --graphite-0: #14110E;
  --graphite-1: #1D1914;
  --graphite-2: #26211A;
  --paper: #EDE7D9;
  --paper-dim: #D9D0BB;
  --ink: #17140F;
  --brass: #B8874B;
  --brass-bright: #E0AE68;
  --moss: #6B7A56;
  --moss-bg: #232619;
  --rust: #A65B3C;
  --rust-bg: #2B1D16;
  --line: rgba(237, 231, 217, 0.12);
  --line-strong: rgba(237, 231, 217, 0.22);

  /* tipografia */
  --f-display: 'Newsreader', serif;
  --f-body: 'Inter', sans-serif;
  --f-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--graphite-0);
  color: var(--paper);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; }

::selection { background: var(--brass); color: var(--graphite-0); }

/* focus visível — acessibilidade */
:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =========================================================
   LOGIN
   ========================================================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
}
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent 79px, var(--line) 79px, var(--line) 80px);
  opacity: 0.5;
  pointer-events: none;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 44px 36px 36px;
  background: var(--graphite-1);
  border: 1px solid var(--line-strong);
}
.login-mark {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 18px;
}
.login-title {
  font-family: var(--f-display);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.08;
  margin: 0 0 6px;
}
.login-sub {
  font-size: 13.5px;
  color: var(--paper-dim);
  margin: 0 0 32px;
  line-height: 1.5;
}
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 8px;
}
.field input {
  width: 100%;
  background: var(--graphite-0);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  padding: 12px 13px;
  font-size: 14.5px;
}
.field input:focus { border-color: var(--brass); }

.btn-primary {
  width: 100%;
  background: var(--brass);
  color: var(--graphite-0);
  border: none;
  padding: 13px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 6px;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--brass-bright); }

.login-hint {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--paper-dim);
  line-height: 1.7;
}
.login-hint b { color: var(--brass-bright); font-weight: 500; }
.login-error {
  font-size: 13px;
  color: var(--rust);
  margin: -6px 0 14px;
  display: none;
}
.login-error.show { display: block; }

/* =========================================================
   SHELL DO PAINEL
   ========================================================= */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--graphite-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
}
.brand {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 4px;
}
.brand-sub {
  font-size: 12px;
  color: var(--paper-dim);
  margin-bottom: 36px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--paper-dim);
  border-left: 2px solid transparent;
  margin-bottom: 2px;
}
.nav-item.active {
  color: var(--paper);
  background: var(--graphite-2);
  border-left-color: var(--brass);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.logout-btn {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--paper-dim);
  font-size: 12.5px;
  padding: 9px 12px;
  width: 100%;
  text-align: left;
}
.logout-btn:hover { border-color: var(--rust); color: var(--rust); }

.main {
  flex: 1;
  padding: 40px 44px 60px;
  min-width: 0;
}
.main-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 16px;
}
.main-title {
  font-family: var(--f-display);
  font-size: 30px;
  font-weight: 500;
  margin: 0 0 4px;
}
.main-count {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--paper-dim);
}
.btn-add {
  background: var(--brass);
  color: var(--graphite-0);
  border: none;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-add:hover { background: var(--brass-bright); }

/* =========================================================
   GRID DE FICHAS (veículos)
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 18px;
}

.ficha {
  background: var(--graphite-1);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.ficha:hover { border-color: var(--line-strong); }

.ficha-num {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--paper-dim);
  background: rgba(20,17,14,0.7);
  padding: 3px 7px;
  z-index: 2;
  letter-spacing: 0.04em;
}

.ficha-photo {
  aspect-ratio: 4/3;
  background: var(--graphite-2);
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ficha-photo-placeholder {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--paper-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stamp {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid currentColor;
  transform: rotate(3deg);
  z-index: 2;
}
.stamp.ativo { color: var(--moss); background: rgba(107,122,86,0.14); }
.stamp.vendido { color: var(--rust); background: rgba(166,91,60,0.14); }

.ficha-body { padding: 16px 16px 18px; }
.ficha-model {
  font-family: var(--f-display);
  font-size: 18.5px;
  font-weight: 500;
  margin: 0 0 10px;
  line-height: 1.2;
}
.ficha-data {
  display: flex;
  gap: 14px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--paper-dim);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ficha-data span b { color: var(--paper); font-weight: 500; }

.ficha-price {
  font-family: var(--f-mono);
  font-size: 19px;
  font-weight: 600;
  color: var(--brass-bright);
  margin-bottom: 14px;
}

.ficha-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.ficha-actions button {
  flex: 1;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--paper-dim);
  font-size: 12px;
  padding: 8px;
}
.ficha-actions button:hover { color: var(--paper); border-color: var(--paper-dim); }
.ficha-actions .danger:hover { color: var(--rust); border-color: var(--rust); }

/* empty state */
.empty {
  border: 1px dashed var(--line-strong);
  padding: 60px 30px;
  text-align: center;
}
.empty-title {
  font-family: var(--f-display);
  font-size: 22px;
  margin: 0 0 8px;
}
.empty-sub {
  color: var(--paper-dim);
  font-size: 14px;
  margin: 0 0 22px;
}

/* =========================================================
   DRAWER (adicionar/editar)
   ========================================================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,17,14,0.6);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 420px;
  max-width: 92vw;
  background: var(--graphite-1);
  border-left: 1px solid var(--line-strong);
  z-index: 11;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-title { font-family: var(--f-display); font-size: 21px; font-weight: 500; margin: 0; }
.drawer-close {
  background: none; border: none; color: var(--paper-dim);
  font-size: 20px; line-height: 1; padding: 4px;
}
.drawer-close:hover { color: var(--paper); }

.drawer-body { padding: 22px 28px; overflow-y: auto; flex: 1; }
.drawer-footer {
  padding: 18px 28px 24px;
  border-top: 1px solid var(--line);
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field textarea {
  width: 100%;
  background: var(--graphite-0);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  padding: 12px 13px;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
}
.field textarea:focus, .field select:focus { border-color: var(--brass); }
.field select {
  width: 100%;
  background: var(--graphite-0);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  padding: 12px 13px;
  font-size: 14px;
}

.upload-box {
  border: 1px dashed var(--line-strong);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  position: relative;
}
.upload-box:hover { border-color: var(--brass); }
.upload-box input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.upload-box-text { font-size: 12.5px; color: var(--paper-dim); }
.upload-preview {
  width: 100%;
  aspect-ratio: 4/3;
  background-size: cover;
  background-position: center;
  margin-bottom: 10px;
  display: none;
}
.upload-preview.show { display: block; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--graphite-2);
  border: 1px solid var(--brass);
  color: var(--paper);
  padding: 12px 20px;
  font-size: 13px;
  font-family: var(--f-mono);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 26px 18px 50px; }
}
