/* ============================================================
   San Martín — Mantenimiento · Hoja de estilos completa
   ============================================================ */

:root {
  --brand: #0F1B2D;
  --brand-2: #1F3864;
  --brand-3: #2E75B6;
  --brand-accent: #E63027;
  --brand-accent-soft: #FBE9E8;
  --brand-soft: #EAF1F8;
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #FAFAFA;
  --border: #E5E5E3;
  --border-strong: #CECECC;
  --text: #1A1A1A;
  --text-muted: #5F5F5F;
  --text-light: #8A8A8A;
  --success: #3B6D11;
  --success-bg: #EAF3DE;
  --success-border: #639922;
  --warning: #854F0B;
  --warning-bg: #FAEEDA;
  --warning-border: #BA7517;
  --danger: #791F1F;
  --danger-bg: #FCEBEB;
  --danger-border: #A32D2D;
  --info: #0C447C;
  --info-bg: #E6F1FB;
  --info-border: #2E75B6;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg);
  line-height: 1.5; font-size: 14px; height: 100%;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: var(--brand-2); text-decoration: none; cursor: pointer; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

.boot-loader { padding: 80px; text-align: center; color: var(--text-muted); font-size: 16px; }

/* TOP BAR — sticky para que quede fijo en perfiles de oficina (Encargado, Responsable, Admin) */
.topbar {
  background: var(--brand); color: white;
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08); flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-logo {
  font-weight: 600; font-size: 13px; letter-spacing: 0.2px;
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,0.9);
}
.topbar-logo img {
  height: 38px; width: auto; display: block;
}
.topbar-logo-divider {
  height: 22px; width: 1px; background: rgba(255,255,255,0.18);
}
/* Logo grande para login y headers prominentes */
.brand-logo-lg { display: block; max-width: 320px; width: 100%; height: auto; margin: 0 auto; }
.brand-logo-md { display: block; max-width: 200px; width: 100%; height: auto; }
.brand-logo-sm { display: block; height: 28px; width: auto; }

/* Header de tablet del mecánico — logo + texto */
.tablet-h-logo {
  height: 28px; width: auto; background: white;
  padding: 3px 6px; border-radius: 4px; display: block;
}
.topbar-context {
  font-size: 12px; opacity: 0.85;
  padding-left: 16px; border-left: 1px solid rgba(255,255,255,0.2);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 18px;
  background: rgba(255,255,255,0.08); font-size: 12px;
}
.topbar-user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.btn-switch {
  background: rgba(255,255,255,0.12); color: white;
  padding: 6px 12px; border-radius: 6px; font-size: 12px;
  transition: background 0.15s;
}
.btn-switch:hover { background: rgba(255,255,255,0.2); }
.live-indicator { display: flex; align-items: center; gap: 6px; font-size: 11px; opacity: 0.85; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #5CB85C; animation: pulse 2s infinite; }
.live-dot.disconnected { background: #DC3545; animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* MAIN AREA */
#main { flex: 1; display: flex; min-height: 0; }
#content { flex: 1; padding: 24px; }

/* SIDEBAR — sticky para que acompañe el header fijo */
.sidebar {
  width: 220px; background: var(--surface);
  border-right: 1px solid var(--border); flex-shrink: 0;
  position: sticky; top: 56px;          /* arranca debajo de la topbar */
  align-self: flex-start;
  height: calc(100vh - 56px);            /* ocupa el alto restante */
  overflow-y: auto;
}
.sidebar-section { padding: 16px 0; border-bottom: 1px solid var(--border); }
.sidebar-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-light); padding: 0 16px 8px; font-weight: 600;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: var(--text); font-size: 13px;
  border-left: 3px solid transparent; transition: all 0.1s; cursor: pointer;
}
.sidebar a:hover { background: var(--surface-2); }
.sidebar a.active {
  background: var(--brand-soft); border-left-color: var(--brand-2);
  color: var(--brand); font-weight: 500;
}
.sidebar a .badge { margin-left: auto; }
.sidebar a svg {
  flex-shrink: 0;
  width: 18px !important;
  height: 18px !important;
  stroke-width: 2;
}
.sidebar a span { flex: 1; }

/* COMMON */
.page-header {
  margin-bottom: 20px;
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 600; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 600; margin-top: 4px; color: var(--text); line-height: 1.1; }
.kpi-detail { font-size: 11px; margin-top: 4px; color: var(--text-muted); }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

/* Timeline para seguimiento de pedidos de repuestos */
.parts-timeline {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 8px; padding: 8px 10px;
  background: var(--surface-2); border-radius: 8px;
  font-size: 11px; color: var(--text-muted);
}
.parts-timeline .ts { display: inline-flex; align-items: center; gap: 4px; }
.parts-timeline .ts.done { color: var(--success); font-weight: 600; }

/* Filas con estado crítico (km vencido / sin km) */
.table tr.row-danger { background: var(--danger-bg); }
.table tr.row-warn { background: var(--warning-bg); }
.table tr.row-danger:hover, .table tr.row-warn:hover { filter: brightness(0.97); }

/* Time bar (Tiempo operativo del día) */
.time-bar { display:flex; height:26px; border-radius:8px; overflow:hidden; background: var(--surface-2); border:1px solid var(--border); }
.time-bar .seg { display:flex; align-items:center; justify-content:center; color:white; font-size:11px; font-weight:600; transition:width .3s ease; }
.time-bar .seg.work { background: var(--info-border, #2563eb); }
.time-bar .seg.free { background: var(--success-border, #16a34a); }
.time-bar .seg.rest { background: var(--warning-border, #d97706); }
.time-bar .seg.out  { background: #6b7280; }
.time-bar .seg.none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--bg-soft, #e5e7eb) 6px, var(--bg-soft, #e5e7eb) 12px); color: var(--text-muted); }
.leg { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px; vertical-align:middle; }
.leg.work { background: var(--info-border, #2563eb); }
.leg.free { background: var(--success-border, #16a34a); }
.leg.rest { background: var(--warning-border, #d97706); }
.leg.out  { background: #6b7280; }
.leg.none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--bg-soft, #e5e7eb) 3px, var(--bg-soft, #e5e7eb) 6px); border:1px solid var(--border); }

/* Tarjeta de mecánico con tareas pendientes "Sigo mañana" */
.jt-mech-card.has-pending { border-left: 4px solid var(--warning-border, #d97706); }

/* Lista de items preventivos en card de OT por asignar */
.prev-items-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 700px) { .prev-items-list { grid-template-columns: 1fr; } }
.prev-item-card { padding: 8px 10px; border-radius: 6px; background: var(--surface-2); border-left: 3px solid var(--border); }
.prev-item-card.urgent  { background: var(--danger-bg, #fee2e2); border-left-color: var(--danger-border, #dc2626); }
.prev-item-card.critico { background: #fce7f3; border-left-color: #be185d; }
.prev-item-card.urgente { background: var(--warning-bg, #ffedd5); border-left-color: var(--warning-border, #d97706); }
.prev-item-card.warn    { background: #fef3c7; border-left-color: #a16207; }
.prev-item-card.muted   { background: var(--surface-2); }

/* Badges separados para crítico (distinto a urgent) — usado en preventivo */
.badge.critico { background: #fce7f3; color: #be185d; }
.badge.urgente { background: var(--warning-bg, #ffedd5); color: var(--warning, #c2410c); }

/* Preventivo overview */
.prev-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap:14px; }
.prev-card { border-left: 4px solid var(--success-border, #16a34a); }
.prev-card.urgent { border-left-color: var(--danger-border, #dc2626); }
.prev-card.critico { border-left-color: #be185d; }
.prev-card.warn   { border-left-color: var(--warning-border, #d97706); }
.prev-card.contrato { border-left-color: var(--info-border, #2563eb); background: linear-gradient(180deg, var(--info-bg, #dbeafe) 0%, var(--surface) 100%); }
.prev-card-h { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.prev-items { display:flex; flex-direction:column; gap:6px; }
.prev-item { display:flex; flex-direction:column; gap:2px; padding:8px 10px; background: var(--surface-2); border-radius:6px; font-size:12px; border-left: 3px solid var(--border); }
.prev-item.urgent  { background: var(--danger-bg, #fee2e2); border-left-color: var(--danger-border, #dc2626); }
.prev-item.critico { background: #fce7f3; border-left-color: #be185d; }
.prev-item.urgente { background: var(--warning-bg, #ffedd5); border-left-color: var(--warning-border, #d97706); }
.prev-item.warn    { background: #fef3c7; border-left-color: #a16207; }
.prev-item.success { background: #f0fdf4; border-left-color: var(--success-border, #16a34a); }
.prev-item-h { display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; }

/* Grid de 5 columnas para KPIs del preventivo */
.grid-5 { display:grid; grid-template-columns: repeat(5, 1fr); gap:10px; }
@media (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .grid-5 { grid-template-columns: repeat(2, 1fr); } }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
  background: var(--surface-2); color: var(--text-muted);
}
.badge.urgent { background: var(--danger-bg); color: var(--danger); }
.badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.muted { background: var(--surface-2); color: var(--text-light); }

.btn {
  padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: all 0.1s; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.success { background: var(--success-border); color: white; border-color: var(--success-border); }
.btn.warning { background: var(--warning-border); color: white; border-color: var(--warning-border); }
.btn.danger { background: var(--danger-border); color: white; border-color: var(--danger-border); }
.btn.ghost { border: none; }
.btn.sm { padding: 5px 10px; font-size: 11px; }
.btn.lg { padding: 12px 20px; font-size: 14px; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font-size: 13px;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(46,117,182,0.12);
}
.form-row { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px;
}

/* TABLE */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }

/* KANBAN */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kanban-col { background: var(--surface-2); border-radius: 10px; padding: 12px; min-height: 200px; }
.kanban-col-h {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.kanban-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--brand-2);
  border-radius: 8px; padding: 10px 12px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.1s;
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card.urgent { border-left-color: var(--danger-border); }
.kanban-card.preventive { border-left-color: var(--success-border); }
.kanban-card.completed { opacity: 0.7; }
.kanban-card-p { font-size: 14px; font-weight: 700; letter-spacing: 0.3px; }
.kanban-card-d { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.kanban-card-meta { font-size: 11px; color: var(--text-light); display: flex; align-items: center; gap: 6px; }

/* AVATAR */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: var(--info-bg); color: var(--info); flex-shrink: 0;
}
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.purple { background: #EEEDFE; color: #3C3489; }
.avatar.teal   { background: #E1F5EE; color: #085041; }
.avatar.amber  { background: #FAEEDA; color: #633806; }
.avatar.coral  { background: #FAECE7; color: #712B13; }
.avatar.pink   { background: #FBEAF0; color: #72243E; }
.avatar.green  { background: #EAF3DE; color: #27500A; }

/* INBOX */
.inbox-item {
  background: var(--surface-2); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 8px; border-left: 3px solid var(--brand-2);
  cursor: pointer; transition: all 0.1s;
}
.inbox-item:hover { background: white; box-shadow: var(--shadow); }
.inbox-item.urgent { border-left-color: var(--danger-border); background: #FFF7F7; }
.inbox-item.warn { border-left-color: var(--warning-border); background: #FDF9EF; }
.inbox-item-tag { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 8px; font-weight: 600; letter-spacing: 0.3px; margin-bottom: 6px; }
.inbox-item-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.inbox-item-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.inbox-item-actions { margin-top: 8px; display: flex; gap: 6px; }

/* MECÁNICO TABLET */
.tablet-shell {
  background: var(--brand);
  min-height: calc(100vh - 56px); padding: 24px;
  display: flex; align-items: flex-start; justify-content: center;
}
.tablet-screen {
  background: white; width: 100%; max-width: 720px;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2); min-height: 540px;
}
.tablet-h {
  background: var(--brand); color: white;
  padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 600;
}
.tablet-body { padding: 24px; }

.mech-grid-big { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.mech-card-big {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; transition: all 0.15s;
  min-height: 130px; justify-content: center;
}
.mech-card-big:hover { background: white; border-color: var(--brand-2); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mech-card-big-name { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }
@media (max-width: 700px) { .mech-grid-big { grid-template-columns: repeat(3, 1fr); } }

/* PIN PAD */
.pin-shell { display: flex; flex-direction: column; align-items: center; padding: 30px 0; max-width: 100%; }
.pin-display {
  font-size: 38px; letter-spacing: 18px;
  color: var(--brand); font-weight: 600; margin: 28px 0; height: 50px;
  white-space: nowrap;  /* impide que el último dígito caiga a la línea siguiente */
  text-align: center;
}
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 280px; max-width: 100%; }
.pin-key {
  padding: 18px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px;
  text-align: center; font-size: 22px; font-weight: 500;
  cursor: pointer; transition: all 0.1s; user-select: none;
}
.pin-key:hover { background: white; border-color: var(--brand-2); }
.pin-key:active { transform: scale(0.96); }
.pin-key.empty { visibility: hidden; }
.pin-error { color: var(--danger); font-size: 14px; margin-top: 12px; }

/* TASK CARDS */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card-big {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--brand-2); border-radius: 12px;
  padding: 14px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all 0.1s;
}
.task-card-big:hover { box-shadow: var(--shadow-lg); }
.task-card-big.urgent { border-left-color: var(--danger-border); background: #FFF8F8; }
.task-card-big.in-progress { border-left-color: var(--info-border); }
.task-card-big.completed { border-left-color: var(--success-border); background: #F8FCEF; }
.task-card-big.pending { border-left-color: var(--warning-border); background: #FEFAF1; }
.task-card-big.blocked { border-left-color: var(--danger-border); background: #FFF7F7; }
.task-truck-icon {
  width: 56px; height: 40px; border-radius: 6px;
  background: linear-gradient(135deg, #5F5E5A, #444441);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: white;
}
.task-info { flex: 1; min-width: 0; }
.task-patente { font-size: 18px; font-weight: 700; letter-spacing: 0.4px; }
.task-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.3; }
.task-arrow { color: var(--text-light); flex-shrink: 0; }

/* BIG ACTION BUTTONS */
.big-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.big-action {
  padding: 24px 8px; border: 2px solid; border-radius: 14px;
  text-align: center; cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
  min-height: 130px; justify-content: center;
}
.big-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.big-action.green { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.big-action.yellow { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.big-action.red { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.big-action-icon { width: 36px; height: 36px; }

/* JEFE - mech grid */
.jt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.jt-mech-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--brand-2); border-radius: 10px; padding: 12px 14px;
  cursor: pointer; transition: all 0.1s; position: relative;
}
.jt-mech-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.jt-mech-card.busy { border-left-color: var(--info-border); }
.jt-mech-card.free { border-left-color: var(--success-border); }
.jt-mech-card.blocked { border-left-color: var(--danger-border); }
.jt-mech-card.pause { border-left-color: var(--warning-border); }
.jt-mech-status {
  font-size: 9px; padding: 2px 7px; border-radius: 8px;
  font-weight: 600; letter-spacing: 0.3px;
}
.jt-mech-badges {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 8px; align-items: center;
}
.jt-mech-name { font-size: 13px; font-weight: 600; }
.jt-mech-spec { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.jt-mech-task { font-size: 12px; margin: 6px 0 4px; line-height: 1.3; }
.jt-mech-time { font-size: 11px; color: var(--text-light); }

/* CHOFER · vista mock con marco de iPhone para preview en desktop */
.phone-shell {
  background: linear-gradient(180deg, #1F3864, #0c2147);
  min-height: calc(100vh - 56px); padding: 24px;
  display: flex; justify-content: center;
}
.phone-screen {
  background: white; width: 100%; max-width: 380px;
  border-radius: 24px; overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  align-self: flex-start; min-height: 660px; position: relative;
}
.phone-notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 110px; height: 24px; background: black;
  border-radius: 0 0 14px 14px; z-index: 2;
}
.phone-h { padding: 36px 20px 16px; background: var(--brand); color: white; text-align: center; }
.phone-h-greeting { font-size: 13px; opacity: 0.85; }
.phone-h-context { font-size: 17px; font-weight: 600; margin-top: 4px; }
.phone-body { padding: 20px; }

/* Cuando el chofer abre la app desde un celular (≤768px), sacamos el marco
 * de iPhone, eliminamos paddings raros y usamos la pantalla completa para que
 * los botones y formularios sean más fáciles de tocar.
 * Importante: usamos !important para vencer reglas heredadas. */
@media (max-width: 768px) {
  .phone-shell {
    background: var(--surface) !important;
    min-height: 100vh !important;
    padding: 0 !important;
    display: block !important;
    margin: 0 !important;
  }
  .phone-screen {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-height: 100vh !important;
    align-self: stretch !important;
    position: relative;
  }
  /* Notch / isla dinámica fuera */
  .phone-notch { display: none !important; }
  .phone-h {
    padding: 18px 16px 14px !important;
    text-align: left !important;
    position: sticky; top: 0; z-index: 10;
  }
  .phone-h-greeting { font-size: 14px; }
  .phone-h-context { font-size: 18px; margin-top: 2px; }
  .phone-body { padding: 16px 14px 32px !important; }
  .phone-body .btn { padding: 14px; font-size: 15px; }
  .phone-body .btn.lg { padding: 18px; font-size: 16px; min-height: 56px; }
  .phone-cat-grid { gap: 10px; }
  .phone-cat-btn { padding: 22px 8px; min-height: 84px; }
  .phone-body .input, .phone-body .select, .phone-body textarea {
    font-size: 16px !important; padding: 12px !important;  /* evitar zoom de iOS */
  }
  .phone-body .card { border-radius: 10px; padding: 14px; }

  /* Topbar: en mobile no necesitamos la fecha completa ni el indicador "En vivo" para choferes.
   * Los compactamos al máximo. */
  .topbar { padding: 8px 12px !important; }
  .topbar-context, .live-indicator { display: none !important; }
  .topbar-user { font-size: 12px; gap: 6px; }
  .topbar-user-avatar { width: 28px; height: 28px; font-size: 12px; }
  .topbar-logo span { display: none; }
  .topbar-logo img { height: 26px; }
  .topbar-logo-divider { display: none; }
  .btn-switch { padding: 6px 10px; font-size: 12px; }

  /* Modales en mobile: full screen */
  .ui-modal-backdrop { padding: 8px !important; }
  .ui-modal { max-width: 100% !important; max-height: 95vh !important; }
  .ui-modal-body { padding: 14px !important; }
  .ui-modal-body .input, .ui-modal-body .select, .ui-modal-body textarea {
    font-size: 16px !important; padding: 12px !important;
  }

  /* PIN pad: ajustar para mobile sin que el último dígito se rompa */
  .pin-shell { padding: 14px 0 !important; }
  .pin-display {
    font-size: 30px !important;
    letter-spacing: 12px !important;
    height: 42px !important;
    margin: 14px 0 !important;
    padding-left: 12px;  /* compensa letter-spacing del lado izquierdo */
  }
  .pin-pad { width: 90vw !important; max-width: 320px !important; gap: 8px !important; }
  .pin-key { padding: 16px !important; font-size: 20px !important; }
  .login-form { padding: 18px 16px !important; max-width: 100% !important; }
  .login-shell { padding: 0 !important; min-height: calc(100vh - 56px); }
  .login-card { padding: 22px 16px !important; max-width: 100% !important; border-radius: 0 !important; box-shadow: none !important; }
  .login-h { margin-bottom: 16px !important; }
  .login-title { font-size: 22px !important; }

  /* Topbar: minimizamos al máximo en login también */
  .topbar { min-height: 48px; }

  /* Asegurar que cards y botones en chofer no excedan la pantalla */
  .phone-body .row { flex-wrap: wrap; }
  .phone-body .row.gap-sm { gap: 8px; }
  .phone-body img { max-width: 100%; }

  /* Tap targets mínimos 44px (recomendación Apple HIG) */
  .phone-body button, .phone-body .btn, .phone-body .pin-key, .phone-cat-btn {
    min-height: 44px;
  }
}
.phone-cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.phone-cat-btn {
  padding: 18px 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px;
  text-align: center; cursor: pointer; transition: all 0.1s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.phone-cat-btn:hover { background: white; border-color: var(--brand-2); }
.phone-cat-icon { width: 28px; height: 28px; color: var(--brand); }
.phone-cat-label { font-size: 12px; font-weight: 600; line-height: 1.2; }

.severity-selector { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.severity-btn { padding: 10px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 11px; font-weight: 600; cursor: pointer; }
.severity-btn:hover { background: var(--surface-2); }
.severity-btn.active.low { background: #EAF3DE; border-color: var(--success-border); color: var(--success); }
.severity-btn.active.med { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.severity-btn.active.high { background: #FCE5C8; border-color: #BA7517; color: #854F0B; }
.severity-btn.active.urg { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

/* TIMELINE */
.timeline { position: relative; padding-left: 4px; }
.timeline-item { position: relative; padding: 10px 0 12px 28px; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-item::before {
  content: ""; position: absolute; left: 6px; top: 16px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--info-border);
  box-shadow: 0 0 0 3px white, 0 0 0 4px var(--border);
}
.timeline-item::after {
  content: ""; position: absolute; left: 10px; top: 28px; bottom: -12px;
  width: 2px; background: var(--border);
}
.timeline-item:last-child::after { display: none; }
.timeline-item.success::before { background: var(--success-border); }
.timeline-item.urgent::before { background: var(--danger-border); }
.timeline-d { font-size: 13px; font-weight: 600; }
.timeline-t { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* TOAST */
#toasts {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 6500; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; max-width: calc(100vw - 40px);
}
.toast {
  background: var(--text); color: white;
  padding: 12px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 4.5s forwards;
  max-width: 360px; pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { background: var(--success-border); }
.toast.warning { background: var(--warning-border); }
.toast.danger { background: var(--danger-border); }
.toast.info { background: var(--brand-2); }
@keyframes toastIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateX(110%); opacity: 0; } }

/* MODAL */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white; border-radius: 12px;
  max-width: 540px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-h { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* CONFIRMATION */
.confirm-screen { text-align: center; padding: 60px 20px; }
.confirm-icon-big {
  width: 80px; height: 80px; margin: 0 auto 24px;
  background: var(--success-bg); color: var(--success-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.confirm-icon-big.warn { background: var(--warning-bg); color: var(--warning-border); }
.confirm-icon-big.danger { background: var(--danger-bg); color: var(--danger-border); }
.confirm-msg-big { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.confirm-sub-big { font-size: 14px; color: var(--text-muted); }

/* LOGIN */
.login-shell {
  min-height: calc(100vh - 56px);
  background: linear-gradient(135deg, var(--brand), #0a1f3f);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: white; border-radius: 16px;
  width: 100%; max-width: 720px; padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-h { text-align: center; margin-bottom: 28px; }
.login-title { font-size: 26px; font-weight: 600; color: var(--brand); }
.login-sub { font-size: 14px; color: var(--text-muted); margin-top: 8px; }
.role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.role-card {
  border: 2px solid var(--border); border-radius: 12px;
  padding: 22px 14px; text-align: center; cursor: pointer;
  transition: all 0.15s; background: var(--surface);
  display: flex; flex-direction: column; align-items: center;
  min-height: 200px; justify-content: flex-start;
}
.role-card:hover {
  border-color: var(--brand-2); background: var(--brand-soft);
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
}
.role-icon {
  width: 52px; height: 52px; margin: 0 auto 14px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.role-icon svg { width: 24px; height: 24px; }
.role-name { font-size: 13px; font-weight: 700; margin-bottom: 8px; line-height: 1.25; min-height: 32px; display: flex; align-items: center; justify-content: center; }
.role-desc { font-size: 11px; color: var(--text-muted); line-height: 1.45; }
@media (max-width: 1100px) {
  .role-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .role-grid { grid-template-columns: repeat(2, 1fr); }
}

/* LOGIN FORM (after role selection) */
.login-form {
  background: white; border-radius: 16px;
  width: 100%; max-width: 420px; padding: 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@media (max-width: 700px) {
  .role-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card, .login-form { padding: 24px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar-context { display: none; }
}

/* iPad / tablet — vista del Mecánico optimizada */
@media (min-width: 700px) and (max-width: 1180px) {
  .tablet-shell { padding: 18px; }
  .tablet-screen { max-width: 100%; }
  .tablet-h { padding: 20px 24px; font-size: 18px; }
  .tablet-body { padding: 20px; }
  .task-card-big { padding: 18px; }
  .task-truck-icon { width: 64px; height: 48px; }
  .task-patente { font-size: 22px; }
  .task-desc { font-size: 14px; }
  .big-action { min-height: 150px; font-size: 16px; padding: 28px 8px; }
  .big-action-icon { width: 44px; height: 44px; }
  .pin-pad { width: 360px; }
  .pin-key { padding: 22px; font-size: 26px; }
  .mech-grid-big { grid-template-columns: repeat(5, 1fr); gap: 16px; }
  .mech-card-big { min-height: 150px; }
  .mech-card-big-name { font-size: 13px; }
}

/* iPad portrait específicamente */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .mech-grid-big { grid-template-columns: repeat(3, 1fr); }
  .tablet-shell { padding: 16px; }
}

/* UTIL */
.row { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.gap-sm { gap: 6px; }
.mt-md { margin-top: 14px; }
.mt-lg { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-light { color: var(--text-light); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-light); font-size: 14px; }

/* UI MODALS — reemplazo de prompt/confirm/alert */
.ui-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 27, 45, 0.55);
  backdrop-filter: blur(2px);
  /* z-index ALTO para que aparezca por encima del overlay de pantalla completa de cubiertas (5000) */
  z-index: 6000; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.18s ease;
}
.ui-modal {
  background: white; border-radius: 14px;
  max-width: 460px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  animation: modalSlide 0.22s cubic-bezier(0.4,0,0.2,1);
}
.ui-modal.lg { max-width: 600px; }
.ui-modal.xl { max-width: 760px; }
@keyframes modalSlide { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ui-modal-header {
  padding: 22px 24px 6px;
  display: flex; align-items: flex-start; gap: 14px;
}
.ui-modal-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.ui-modal-icon.success { background: var(--success-bg); color: var(--success-border); }
.ui-modal-icon.warning { background: var(--warning-bg); color: var(--warning-border); }
.ui-modal-icon.danger  { background: var(--danger-bg); color: var(--danger-border); }
.ui-modal-icon svg { width: 22px; height: 22px; }
.ui-modal-title-block { flex: 1; min-width: 0; }
.ui-modal-title { font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.3; }
.ui-modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.ui-modal-body { padding: 14px 24px 6px; }
.ui-modal-footer {
  padding: 18px 24px 22px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
.ui-modal-footer .btn { min-width: 96px; justify-content: center; }
.ui-modal-options { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ui-modal-option {
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 12px; text-align: left;
}
.ui-modal-option:hover { background: white; border-color: var(--brand-2); transform: translateX(2px); }
.ui-modal-option-icon { font-size: 22px; flex-shrink: 0; }
.ui-modal-option-text { flex: 1; }
.ui-modal-option-title { font-weight: 500; font-size: 14px; }
.ui-modal-option-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Botón de cerrar (×) en la esquina del modal */
.ui-modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--surface-2); color: var(--text-muted);
  font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.ui-modal-close:hover { background: var(--danger-bg); color: var(--danger-border); }
.ui-modal { position: relative; }

/* Cubiertas: tabla de stock paginada */
.tires-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.tires-pager .pager-info { color: var(--text-muted); font-size: 13px; }
.tires-pager .pager-actions { display: flex; gap: 6px; align-items: center; }
.tires-pager .pager-btn { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: white; cursor: pointer; font-size: 13px; }
.tires-pager .pager-btn:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand-2); }
.tires-pager .pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Maqueta SVG de cubiertas — drag & drop */
.tire-svg-container { background: var(--surface-2); border-radius: 10px; padding: 14px; overflow: auto; }

/* === Cubiertas estilizadas como cubiertas reales (vista superior) === */
.tire-pos {
  position: absolute;
  width: 7.8%;
  height: 11%;
  min-width: 44px;
  min-height: 26px;
  max-width: 60px;
  max-height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 14px / 50%;          /* óvalo: bordes muy redondeados horizontalmente */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 800;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: grab;
  transition: transform 0.12s, box-shadow 0.15s;
  letter-spacing: 0.3px;
  box-sizing: border-box;
}
/* Empty: tamaño FIJO en pixeles (no porcentajes) para evitar superposición
 * cuando hay 4 posiciones cercanas en un eje doble. Círculo chiquito sin borde dasheado. */
.tire-pos.empty {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  max-width: 30px;
  max-height: 30px;
  border-radius: 50%;
}

/* Cubierta cargada — banda de rodamiento + sombreado cilíndrico */
.tire-pos.loaded {
  background-image:
    /* tread: líneas horizontales (ranuras de la banda) */
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.55) 0px, rgba(0, 0, 0, 0.55) 1.2px,
      transparent 1.2px, transparent 5px
    ),
    /* sombreado cilíndrico vertical: oscuro arriba/abajo, claro al medio */
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.45) 0%,
      rgba(0, 0, 0, 0.05) 35%,
      rgba(0, 0, 0, 0.05) 65%,
      rgba(0, 0, 0, 0.45) 100%
    ),
    /* color base: distinto según tipo */
    linear-gradient(180deg, var(--tire-color, #6D4C41), var(--tire-color, #6D4C41));
  border: 1px solid rgba(0, 0, 0, 0.5);
  color: #FFF8E1;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Tracción → marrón anaranjado (como en las imágenes) */
.tire-pos.tipo-traccion { --tire-color: #8B4513; }
/* Lineal → marrón más oscuro / negro */
.tire-pos.tipo-lineal   { --tire-color: #2C2018; }

/* Cubierta vacía — círculo blanco con + grande y prolijo (NO dashed para no mezclarse con vecinas) */
.tire-pos.empty {
  background: linear-gradient(180deg, #FFFFFF 0%, #F5F7FA 100%);
  border: 1.5px solid #B0BEC5;
  color: #546E7A;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  padding: 0;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.tire-pos.empty:hover {
  background: linear-gradient(180deg, #1976D2 0%, #1565C0 100%);
  border-color: #0D47A1;
  color: white;
  z-index: 10;
  transform: translate(-50%, -50%) scale(1.45);
  box-shadow: 0 6px 14px rgba(25, 118, 210, 0.45);
}
.tire-pos.empty .tire-empty-icon {
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
}

/* Auxilio vacío: mismo tamaño que dot pero con acento naranja */
.tire-pos.aux.empty {
  background: #FFF3E0;
  border: 1.5px dashed #FB8C00;
  color: #FB8C00;
}
.tire-pos.aux.loaded {
  /* mismo estilo de cubierta + acento naranja */
  outline: 2px dashed #FB8C00;
  outline-offset: 2px;
}

/* Texto interno (marca de fuego) — quitar truncado, dejar que se vea completo
 * Si no entra, hacer wrap a 2 líneas con font reducido */
.tire-mark {
  max-width: 100%;
  padding: 0 3px;
  font-size: 9px;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  word-break: break-all;
  text-align: center;
}
/* Label adicional debajo de la cubierta con la marca de fuego completa
 * (visible siempre, el texto interno es decorativo) */
.tire-pos.loaded::after {
  content: attr(data-mark);
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: #37474F;
  background: rgba(255,255,255,0.92);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  text-shadow: none;
  letter-spacing: 0.2px;
  z-index: 4;
}
/* En pantalla completa el label es más grande */
.tire-fullscreen-overlay .tire-pos.loaded::after {
  bottom: -20px;
  font-size: 12px;
  padding: 2px 7px;
}
.tire-empty-icon { font-size: 20px; line-height: 1; font-weight: 300; }

/* Badge de vida (Nueva / R1 / R2) en esquina inferior izquierda */
.tire-vida-badge {
  position: absolute;
  bottom: -7px;
  left: -7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  text-shadow: none;
}
/* Badge de warning (km excedido) */
.tire-warn-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #E53935;
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  border: 2px solid white;
  text-shadow: none;
  animation: tire-pulse 1.2s ease-in-out infinite;
}
@keyframes tire-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
/* Badge AUX */
.tire-aux-badge {
  position: absolute;
  top: -10px;
  right: -4px;
  font-size: 8px;
  background: #FB8C00;
  color: white;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: none;
}

/* Cubierta seleccionada en modo multi-select del Gomero */
.tire-pos.multi-selected {
  outline: 4px solid #1976D2;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px white, 0 4px 12px rgba(25, 118, 210, 0.55);
  z-index: 6;
}
.tire-pos.multi-selected::before {
  content: "✓";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background: #1976D2;
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  z-index: 7;
}

/* Estados de drag */
.tire-pos.dragging {
  cursor: grabbing;
  opacity: 0.55;
  transform: translate(-50%, -50%) scale(1.05);
}
.tire-pos.drag-over {
  outline: 3px dashed var(--brand) !important;
  outline-offset: 3px;
  background-color: rgba(25, 118, 210, 0.15);
}
.tire-pos.loaded:hover {
  transform: translate(-50%, -50%) scale(1.07);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Vista del Gomero · ajustes para iPad */
@media (min-width: 700px) {
  .gomero-screen { max-width: 100%; padding: 0; }
  .gomero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .gomero-unit-row { padding: 14px 18px; font-size: 14px; }
  .tire-detail-iPad { padding: 18px; }
  .tire-detail-iPad .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 699px) {
  .ui-modal { max-width: calc(100vw - 24px); }
  .gomero-grid { grid-template-columns: 1fr; }
}

/* Maqueta de cubiertas en pantalla completa (rotada landscape) */
.tire-fullscreen-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: linear-gradient(180deg, #1A1F2C 0%, #0F1B2D 100%);
  display: flex; flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.tire-fullscreen-overlay .tire-maqueta-html {
  max-width: none !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  border: none !important;
  background: linear-gradient(180deg, #FAFAFA 0%, #E0E0E0 100%) !important;
}
/* En portrait, rotamos la maqueta para que ocupe todo el ancho aprovechable */
@media (orientation: portrait) {
  .tire-fullscreen-overlay.rotated .tire-maqueta-html {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh !important;
    height: 100vw !important;
    position: absolute;
    top: 50%; left: 50%;
    margin-top: calc(-50vw);
    margin-left: calc(-50vh);
  }
}
.tire-fullscreen-overlay .fs-header {
  padding: 12px 20px;
  background: rgba(15, 27, 45, 0.95);
  color: white;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 10;
}
.tire-fullscreen-overlay .fs-header strong { font-size: 16px; }
.tire-fullscreen-overlay .fs-body {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.tire-fullscreen-overlay .fs-close {
  background: var(--danger-border);
  color: white; border: none; padding: 10px 20px;
  border-radius: 8px; font-weight: 700; font-size: 16px;
  cursor: pointer; min-height: 44px; min-width: 100px;
}
/* Cubiertas más grandes en pantalla completa */
.tire-fullscreen-overlay .tire-pos.loaded {
  min-width: 70px !important; min-height: 44px !important;
  max-width: 96px !important; max-height: 60px !important;
  font-size: 12px !important;
}
/* Empty dots más grandes en fullscreen para ser tappables (44×44 Apple HIG) */
.tire-fullscreen-overlay .tire-pos.empty {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important; min-height: 46px !important;
  max-width: 46px !important; max-height: 46px !important;
  font-size: 28px !important;
}
.tire-fullscreen-overlay .tire-pos.empty .tire-empty-icon {
  font-size: 28px !important;
}
.tire-fullscreen-overlay .tire-mark { font-size: 12px !important; }
.tire-fullscreen-overlay .tire-vida-badge { width: 22px !important; height: 22px !important; font-size: 12px !important; }
.tire-fullscreen-overlay .tire-warn-badge { width: 20px !important; height: 20px !important; font-size: 11px !important; }
.tire-fullscreen-overlay .tire-aux-badge { font-size: 10px !important; padding: 3px 7px !important; }

.flash {
  animation: flash 1.5s ease;
}
@keyframes flash {
  0% { background-color: var(--warning-bg); }
  100% { background-color: transparent; }
}
