/* ============================================================
   IMMO SLK — Stylesheet
   Light theme / grey & black / clean professional
   ============================================================ */

:root {
  --bg:        #f4f4f5;
  --bg2:       #ffffff;
  --bg3:       #f1f1f3;
  --border:    #e4e4e7;
  --border2:   #d1d1d6;
  --text:      #18181b;
  --text2:     #3f3f46;
  --text3:     #71717a;
  --accent:    #18181b;
  --accent2:   #3f3f46;
  --accent-bg: rgba(24,24,27,0.07);
  --green:     #16a34a;
  --green-bg:  rgba(22,163,74,0.08);
  --yellow:    #d97706;
  --yellow-bg: rgba(217,119,6,0.08);
  --blue:      #2563eb;
  --blue-bg:   rgba(37,99,235,0.08);
  --red:       #dc2626;
  --red-bg:    rgba(220,38,38,0.08);
  --radius:    8px;
  --radius2:   12px;
  --shadow:    0 2px 16px rgba(0,0,0,0.08);
  --shadow2:   0 1px 4px rgba(0,0,0,0.06);
  --nav-width: 240px;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ============================================================
   LAYOUT
   ============================================================ */

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

.sidebar {
  width: var(--nav-width);
  background: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: #ffffff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px; color: var(--text);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 15px; font-weight: 700; color: #ffffff;
}

.sidebar-logo-sub {
  font-size: 10px; color: rgba(255,255,255,0.4);
  font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }

.nav-section-label {
  padding: 12px 18px 4px;
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase; letter-spacing: 1px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.12s;
  cursor: pointer;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.06);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(255,255,255,0.1);
  border-left-color: #ffffff;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: #ffffff;
  color: var(--text);
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.7);
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.35); }

.btn-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.45);
  font-size: 13px; cursor: pointer;
  transition: all 0.12s; text-decoration: none;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}

.main-content {
  margin-left: var(--nav-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 90;
  box-shadow: var(--shadow2);
}

.topbar-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  flex: 1;
}

.search-bar {
  display: flex; align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px; gap: 8px;
  flex: 1; max-width: 380px;
  transition: border-color 0.12s;
}

.search-bar:focus-within {
  border-color: var(--text3);
}

.search-bar svg { color: var(--text3); width: 15px; height: 15px; flex-shrink: 0; }

.search-bar input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13px; width: 100%; padding: 8px 0;
}

.search-bar input::placeholder { color: var(--text3); }

.page-content { padding: 24px; flex: 1; }

.menu-toggle {
  display: none;
  background: transparent; border: none;
  color: var(--text); cursor: pointer; padding: 4px;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 20px;
  box-shadow: var(--shadow2);
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; text-decoration: none; transition: all 0.12s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: #ffffff;
}
.btn-primary:hover { background: var(--accent2); }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--border);
}
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }

.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn svg { width: 14px; height: 14px; }

/* Forms */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 12px; font-weight: 600; color: var(--text2);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px;
}

.form-label .required { color: var(--red); margin-left: 2px; }

.form-control {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 8px 11px;
  font-family: var(--font);
  transition: border-color 0.12s, box-shadow 0.12s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(24,24,27,0.08);
}

.form-control::placeholder { color: var(--border2); }

textarea.form-control { resize: vertical; min-height: 90px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 14px; color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--text);
  cursor: pointer;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-gray   { background: var(--bg3); color: var(--text3); border: 1px solid var(--border); }
.badge-purple { background: rgba(124,58,237,0.1); color: #7c3aed; border: 1.5px solid rgba(124,58,237,0.35); }
.badge-orange { background: rgba(234,88,12,0.1); color: #ea580c; border: 1.5px solid rgba(234,88,12,0.35); }

/* Barra de dificultad de programación */
.dificultad-bar-wrap { display: flex; align-items: center; gap: 8px; }
.dificultad-bar-track { flex: 1; height: 10px; background: var(--bg3); border-radius: 5px; overflow: hidden; min-width: 60px; }
.dificultad-bar-fill { height: 100%; border-radius: 5px; transition: width 0.3s ease; }
.dificultad-bar-label { font-size: 12px; font-weight: 600; color: var(--text3); min-width: 32px; white-space: nowrap; }

/* Tables */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left; padding: 9px 12px;
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  white-space: nowrap;
}

td {
  padding: 11px 12px; color: var(--text2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }
td a { color: var(--text); text-decoration: none; font-weight: 500; }
td a:hover { color: var(--text3); text-decoration: underline; }

/* Alerts */
.alert {
  padding: 11px 14px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; border: 1px solid;
}

.alert-success { background: var(--green-bg);  color: var(--green);  border-color: rgba(22,163,74,0.2); }
.alert-error   { background: var(--red-bg);    color: var(--red);    border-color: rgba(220,38,38,0.2); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); border-color: rgba(217,119,6,0.2); }
.alert-info    { background: var(--blue-bg);   color: var(--blue);   border-color: rgba(37,99,235,0.2); }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* Stat cards */
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 18px;
  box-shadow: var(--shadow2);
}

.stat-value { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-icon { color: var(--text3); margin-bottom: 8px; }

/* Section title */
.section-title {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

.section-title svg { width: 14px; height: 14px; }

/* ============================================================
   FICHAS
   ============================================================ */

.ficha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.ficha-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px;
  text-decoration: none;
  transition: all 0.15s;
  display: block;
  box-shadow: var(--shadow2);
}

.ficha-card:hover {
  border-color: var(--text3);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.ficha-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px;
}

.ficha-matricula {
  font-size: 17px; font-weight: 800; color: var(--text);
  font-family: var(--font-mono); letter-spacing: 1px;
}

.ficha-marca-modelo { font-size: 13px; color: var(--text3); margin-top: 2px; }

.ficha-chip {
  font-size: 11px; font-weight: 700;
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border2);
  padding: 3px 8px; border-radius: 4px;
  font-family: var(--font-mono);
}

.ficha-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text3);
}

/* Avisos */
.aviso-box {
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 10px;
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid;
}

.aviso-advertencia {
  background: var(--yellow-bg);
  border-color: rgba(217,119,6,0.2);
  color: var(--yellow);
}

.aviso-no-hacer {
  background: var(--red-bg);
  border-color: rgba(220,38,38,0.2);
  color: var(--red);
}

.aviso-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.aviso-text { font-size: 13px; line-height: 1.5; color: var(--text2); }

/* Compatibilidad */
.maquina-compat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.maquina-compat-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}

.maquina-compat-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.maquina-compat-nota { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ============================================================
   MEDIA
   ============================================================ */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.media-item {
  position: relative; aspect-ratio: 1/1;
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg3); cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color 0.12s;
}

.media-item:hover { border-color: var(--text); }

.media-item img, .media-item video {
  width: 100%; height: 100%; object-fit: cover;
}

.media-play-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
}

.media-play-icon svg { width: 32px; height: 32px; color: #fff; }

.media-delete {
  position: absolute; top: 4px; right: 4px;
  background: rgba(220,38,38,0.9);
  border: none; border-radius: 50%;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 0.12s; color: #fff;
  font-size: 11px;
}

.media-item:hover .media-delete { opacity: 1; }

/* Lightbox */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.92);
  align-items: center; justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox-inner { max-width: 90vw; max-height: 90vh; position: relative; }

.lightbox-inner img, .lightbox-inner video {
  max-width: 90vw; max-height: 85vh;
  object-fit: contain; border-radius: var(--radius);
}

.lightbox-close {
  position: fixed; top: 20px; right: 20px;
  background: rgba(255,255,255,0.1); border: none;
  border-radius: 50%; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 18px;
  transition: background 0.12s;
}

.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ============================================================
   CHAT / ASISTENTE
   ============================================================ */

.chat-container {
  display: flex; flex-direction: column;
  height: calc(100vh - 120px); max-height: 800px;
}

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bg3);
  border-radius: var(--radius) var(--radius) 0 0;
}

.chat-msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--radius2);
  font-size: 14px; line-height: 1.6;
}

.chat-msg-user {
  background: var(--text);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant {
  background: var(--bg2);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow2);
}

.chat-msg-system {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid rgba(37,99,235,0.15);
  align-self: center;
  font-size: 12px; text-align: center;
  border-radius: var(--radius);
}

.chat-input-area {
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg2);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 10px;
  display: flex; gap: 8px; align-items: flex-end;
}

.chat-input-area textarea {
  flex: 1; min-height: 40px; max-height: 120px;
  resize: none; padding: 9px 12px;
}

.chat-typing {
  display: flex; gap: 4px; align-items: center; padding: 8px 0;
}

.chat-typing span {
  width: 6px; height: 6px; background: var(--border2);
  border-radius: 50%; animation: bounce 1.2s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  width: 100%; max-width: 360px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 36px 30px;
  box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 26px; }

.login-logo-box {
  width: 52px; height: 52px;
  background: var(--text);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff;
  margin: 0 auto 12px;
}

.login-title { font-size: 19px; font-weight: 800; color: var(--text); }
.login-sub { font-size: 13px; color: var(--text3); margin-top: 2px; }

/* ============================================================
   ADMIN
   ============================================================ */

.campo-tipo-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg3); color: var(--text3);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

/* ============================================================
   INVENTARIO
   ============================================================ */

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.item-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  box-shadow: var(--shadow2);
}

.item-img {
  width: 52px; height: 52px;
  object-fit: cover; border-radius: var(--radius);
  background: var(--bg3); flex-shrink: 0;
  border: 1px solid var(--border);
}

.item-img-placeholder {
  width: 52px; height: 52px;
  background: var(--bg3); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); flex-shrink: 0;
  border: 1px solid var(--border);
}

.item-name { font-size: 14px; font-weight: 700; color: var(--text); }
.item-sub  { font-size: 12px; color: var(--text3); margin-top: 1px; }

.licencia-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.licencia-row:last-child { border-bottom: none; }

.recurso-password {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--bg3); padding: 3px 8px;
  border-radius: 4px; border: 1px solid var(--border);
  letter-spacing: 2px;
}

/* ============================================================
   PWA
   ============================================================ */

.install-banner {
  position: fixed; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); z-index: 500; font-size: 14px;
}

.install-banner.hidden { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */


@media (max-width: 480px) {
  .media-grid { grid-template-columns: repeat(3, 1fr); }
  .maquina-compat-grid { grid-template-columns: 1fr; }
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(0,0,0,0.4);
}

.sidebar-overlay.active { display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg3); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

.mono { font-family: var(--font-mono); }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.empty-state {
  text-align: center; padding: 56px 20px; color: var(--text3);
}

.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.3; }
.empty-state h3 { font-size: 15px; color: var(--text2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius2);
  padding: 28px 20px; text-align: center;
  cursor: pointer; transition: all 0.12s; color: var(--text3);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--text);
  background: var(--bg3);
  color: var(--text);
}

.upload-zone svg { width: 28px; height: 28px; margin-bottom: 8px; }
.upload-zone p { font-size: 14px; }
.upload-zone small { font-size: 12px; }

/* ============================================================
   FICHA FORM — Mobile single column
   ============================================================ */


/* Ficha ver layout */
/* Mobile first - single column */
.ficha-ver-grid { display: flex; flex-direction: column; gap: 16px; }
.ficha-ver-grid > div { min-width: 0; max-width: 100%; overflow: hidden; }

/* Desktop - two columns */
@media (min-width: 769px) {
  .ficha-ver-grid { display: grid; grid-template-columns: 1fr 200px; gap: 20px; align-items: start; }
}
.dato-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dato-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.dato-val { font-size: 14px; color: var(--text); }
.grid-mando { display: grid; grid-template-columns: 160px 1fr 140px 80px 32px; gap: 8px; align-items: end; }


/* Car brand logos */
.car-logo-wrap {
  width: 48px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.car-logo {
  max-width: 48px;
  max-height: 32px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ============================================================
   DASHBOARD V2
   ============================================================ */

.filtros-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.fichas-lista { display: flex; flex-direction: column; gap: 6px; }

.ficha-row {
  display: grid;
  grid-template-columns: 420px 1fr auto;
  gap: 24px;
  align-items: start;
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  text-decoration: none;
  transition: all 0.12s;
  box-shadow: var(--shadow2);
}

.ficha-row:hover { border-color: var(--text3); box-shadow: var(--shadow); }

.ficha-row-left {}
.ficha-row-marca { font-size: 12px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.ficha-row-modelo { font-size: 18px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.ficha-row-denom { font-size: 13px; font-weight: 600; color: var(--text3); background: var(--bg3); padding: 2px 7px; border-radius: 4px; font-family: var(--font-mono); max-width: 100%; overflow-wrap: break-word; word-break: break-all; }
.ficha-row-anio { font-size: 13px; color: var(--text3); margin-top: 3px; }
.ficha-row-center { display: flex; flex-direction: column; gap: 4px; align-self: start; padding-top: 2px; }
.ficha-row-right { display: flex; flex-direction: row-reverse; gap: 4px; align-items: center; justify-content: flex-start; align-self: center; }
.ficha-row-chip { font-size: 14px; font-weight: 700; color: var(--text); font-family: var(--font-mono); background: var(--bg3); padding: 4px 10px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }

.badge-tipo-llave { min-width: 110px; justify-content: center; padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; height: 32px; align-items: center; border-width: 1.5px; border-style: solid; }

/* ============================================================
   MOBILE — Responsive
   ============================================================ */

@media (max-width: 768px) {

  /* Sidebar */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .btn span { display: none; }
  .page-content { padding: 14px; }

  /* Search */
  .search-bar { max-width: 100% !important; flex: 1 !important; }

  /* Grids — todo a una columna */
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: 1fr 1fr !important; }
  .dato-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .filtros-grid { grid-template-columns: 1fr !important; gap: 8px; }
  .item-grid { grid-template-columns: 1fr !important; }
  .maquina-compat-grid { grid-template-columns: 1fr !important; }
  .grid-mando { grid-template-columns: 1fr !important; }

  /* Ficha row dashboard */
  .ficha-row { grid-template-columns: 1fr !important; gap: 10px; }
  .ficha-row-right { text-align: left; }

  /* Ficha ver */
  .ficha-ver-grid { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 200px"] { grid-template-columns: 1fr !important; display: flex !important; flex-direction: column !important; }

  /* Formularios */
  .ficha-form-grid,
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 300px"],
  [style*="grid-template-columns:260px 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Quitar sticky */
  [style*="position:sticky"],
  [style*="position: sticky"] { position: static !important; }

  /* Tabla scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Chat */
  .chat-container { height: calc(100vh - 100px); }
  .chat-msg { max-width: 95%; }

  /* Cards */
  .card { padding: 14px; }
  .media-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr !important; }
  .page-content { padding: 12px; }
}