/* ── Tema (azul + acento cyan, aproximado a los mockups de Chesterton) ───── */
:root {
  --navy: #1b2a78;        /* nombres de equipo */
  --navy-dark: #15205c;
  --heading: #4d4d9c;     /* títulos morados de los mockups */
  --label: #3548b5;       /* azul de las etiquetas del form */
  --link-blue: #2649b6;   /* azul itálico del título de la landing */
  --accent: #29bdf0;      /* cyan de los botones */
  --accent-dark: #18a6d8;
  --ink: #2d2d33;
  --muted: #6b7280;
  --line: #e3e6ef;
  --bg: #f6f7fb;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --info-bg: #eef4ff;
  --radius: 10px;
  --maxw: 1080px;
  --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-head: 'Poppins', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* Honrar el atributo `hidden` aunque haya un display:flex/grid más específico
   (sin esto, .m-canvas-wrap y .m-row sobreescribían el `display: none` del
   atributo). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ── Header / footer ─────────────────────────────────────────────────────── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(20, 30, 80, 0.03);
}
.header-inner {
  display: flex; align-items: center;
  gap: 18px; min-height: 72px;
  padding: 12px 0;
}

.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--navy); flex-shrink: 0; }
.brand-logo { max-height: 52px; width: auto; display: block; border-radius: 10px; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--navy); color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 20px;
}
.brand-mark-al {
  /* Placeholder hasta que tengamos el PNG real del logo Active Learning */
  background: linear-gradient(135deg, #1a73e8 0%, #18a6d8 100%); color: #fff;
  font-size: 16px; letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small { font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.brand-text strong { font-family: var(--font-head); font-size: 17px; letter-spacing: 1.5px; color: var(--navy); }
.brand-lg { justify-content: center; margin-bottom: 18px; }
.brand-lg .brand-mark { width: 52px; height: 52px; font-size: 26px; }
.brand-lg .brand-text strong { font-size: 20px; }

/* Acciones primarias del header (CTA + links) */
.header-actions {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.header-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff;
  padding: 9px 18px; border-radius: 999px;
  font-family: var(--font-head); font-weight: 600; font-size: 14px;
  text-decoration: none; white-space: nowrap;
  transition: background .15s ease, transform .02s ease, box-shadow .15s ease;
  box-shadow: 0 1px 3px rgba(24, 166, 216, 0.25);
}
.header-cta:hover { background: var(--accent-dark); box-shadow: 0 2px 6px rgba(24, 166, 216, 0.32); }
.header-cta:active { transform: translateY(1px); }
.header-cta-icon { font-size: 18px; line-height: 1; margin-top: -1px; font-weight: 600; }

.header-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--navy); text-decoration: none; font-weight: 600; font-size: 14px;
  padding: 8px 12px; border-radius: 8px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.header-link:hover { background: #f2f4f8; color: var(--accent-dark); }
.header-link-icon { font-size: 16px; line-height: 1; display: none; }     /* oculto en desktop */
.header-link-strong { background: var(--info-bg); color: var(--navy); }
.header-link-strong:hover { background: #dbe6ff; color: var(--navy); }

/* Bloque del usuario (avatar + nombre + salir) */
.header-user-block {
  display: flex; align-items: center; gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.header-user-name {
  color: var(--ink); font-size: 14px; font-weight: 600;
  max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  background: #e5e5ea;
  flex-shrink: 0;
}
.user-avatar-initials {
  display: inline-grid; place-items: center;
  font-family: var(--font-head); font-weight: 700;
  font-size: 13px; letter-spacing: 0.5px;
  background: linear-gradient(135deg, #1a73e8 0%, #18a6d8 100%);
  color: #fff;
}

.header-icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 50%;
  background: #fff; color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1;
  padding: 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.header-icon-btn:hover { background: var(--danger-bg); color: var(--danger); border-color: #f3c2bc; }

.inline-form { margin: 0; display: inline-flex; }
.btn-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent-dark); font: inherit; text-decoration: underline;
}

.site-footer {
  margin-top: auto;
  background: var(--navy-dark); color: #c7cde8;
  font-size: 13px; padding: 16px 0; text-align: center;
}
.site-footer p { margin: 0; }

/* ── Layout de página ────────────────────────────────────────────────────── */
.page { flex: 1; padding: 36px 0 56px; }
.page-title { color: var(--heading); font-size: 30px; line-height: 1.25; margin: 0 0 14px; }
.page-sub { color: var(--muted); margin: 0 0 24px; max-width: 720px; }
.form-heading { color: var(--heading); margin-bottom: 24px; }
.landing-title {
  color: var(--link-blue); font-style: italic; font-weight: 600;
  text-align: center; font-size: 24px; line-height: 1.35;
  max-width: 820px; margin: 4px auto 30px;
}
.muted { color: var(--muted); }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  border: none; border-radius: 999px;
  padding: 11px 26px; font-family: var(--font-head); font-size: 15px; font-weight: 500;
  transition: background-color .15s ease, transform .02s ease;
}
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); }
.btn-block { display: block; width: 100%; text-align: center; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c2bc; }
.alert-info { background: var(--info-bg); color: var(--navy); border: 1px solid #cdd9f5; }

/* ── Card / login ────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(20,30,80,.06); }
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-mark {
  display: grid; place-items: center; width: 56px; height: 56px;
  margin: 0 auto 14px; border-radius: 16px; background: rgba(41,189,240,.12); font-size: 28px; line-height: 1;
}
.auth-logo {
  display: block; max-width: 220px; width: 100%; height: auto;
  margin: 0 auto 18px;
}
.auth-card h1 { color: var(--heading); font-size: 22px; margin: 0 0 6px; text-align: center; }
.auth-card .muted { text-align: center; font-size: 14px; margin: 0 0 20px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { margin-top: 14px !important; font-size: 12px !important; color: var(--muted); }

/* ── Formularios ─────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 18px; }
.form .field { display: flex; flex-direction: column; gap: 6px; }
.form .field > span { font-size: 14px; font-weight: 600; color: var(--navy); }
.req { color: var(--danger); font-weight: 700; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; background: #fbfbfd;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(41,189,240,.18); background: #fff; }
textarea { resize: vertical; min-height: 150px; }
input[type="file"] { font-family: var(--font-body); font-size: 14px; padding: 0; border: none; background: none; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.btn-sm { padding: 7px 16px; font-size: 13px; }

/* Form de ticket: etiquetas a la izquierda, campos a la derecha (como el mockup) */
.ticket-form { display: flex; flex-direction: column; gap: 22px; max-width: 880px; }
.ticket-form .field {
  display: grid; grid-template-columns: 220px 1fr; column-gap: 22px; align-items: start;
}
.ticket-form .field > label {
  padding-top: 9px; color: var(--label); font-size: 15px; font-weight: 600;
}
.ticket-form .form-actions { grid-column: 2; display: flex; justify-content: flex-start; margin-top: 4px; }

@media (max-width: 640px) {
  .ticket-form .field { grid-template-columns: 1fr; row-gap: 6px; }
  .ticket-form .field > label { padding-top: 0; }
  .ticket-form .form-actions { grid-column: 1; }
}

/* ── Grilla de equipos ───────────────────────────────────────────────────── */
.team-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.team-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px; }
.team-name { color: var(--navy); font-size: 18px; margin: 0; }
.team-desc { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.team-card .btn { margin-top: 8px; }
.team-card-maintenance { border: 1px solid #f1c0b9; border-radius: var(--radius); background: #fff7f5; padding: 16px; }

/* ── Form de Mantenimiento ───────────────────────────────────────────────── */
.m-photo-block { display: flex; flex-direction: column; gap: 10px; }
.m-canvas-wrap { display: flex; flex-direction: column; gap: 6px; }
.m-canvas {
  width: 100%; height: auto; max-height: 70vh;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  touch-action: none; cursor: crosshair;
}
.m-clear { align-self: flex-start; }
.m-radios { display: flex; gap: 22px; padding-top: 9px; }
.m-radio { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 400; cursor: pointer; }
.m-radio input[type="radio"] { width: auto; }
.m-geo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.m-geo .hint { margin: 0; }

/* ── "Abrí otro ticket" en la página de gracias ──────────────────────────── */
.thanks-teams { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.thanks-teams .muted { margin: 0 0 10px; }
.thanks-team-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ── Página de gracias ───────────────────────────────────────────────────── */
.thanks-page { text-align: center; }
.thanks-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; margin: 8px auto 18px;
  background: #e6f8ee; color: #1e9e57; font-size: 32px; font-weight: 700;
}
.ticket-ref { font-family: var(--font-head); font-size: 32px; font-weight: 700; color: var(--navy); margin: 8px 0; letter-spacing: 1px; }
.thanks-actions { margin-top: 24px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.page.narrow { max-width: 720px; }

.back-link { display: inline-block; margin-bottom: 14px; color: var(--accent-dark); text-decoration: none; font-size: 14px; }
.back-link:hover { text-decoration: underline; }
.back-links { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.back-links .back-link { margin-bottom: 14px; }

/* ── Breadcrumb ────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 13px; color: var(--muted); margin: 0 0 12px;
}
.breadcrumb-link { color: var(--muted); text-decoration: none; }
.breadcrumb-link:hover { color: var(--accent-dark); text-decoration: underline; }
.breadcrumb-sep { color: var(--muted); opacity: 0.6; }
.breadcrumb-current { color: var(--ink); font-weight: 600; }

/* ── Lista "Mis tickets" ─────────────────────────────────────────────────── */
.ticket-list { display: flex; flex-direction: column; gap: 14px; max-width: 880px; }
.ticket-row {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 1px 3px rgba(20,30,80,.05);
  text-decoration: none; color: inherit; transition: border-color .12s ease, box-shadow .12s ease;
}
.ticket-row:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(20,30,80,.10); }
.ticket-row-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ticket-row-id { font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: 15px; }
.ticket-row-name { color: var(--ink); font-weight: 600; font-size: 15px; line-height: 1.4; }
.ticket-row-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 2px; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: #eef0f6; color: var(--navy);
}
.badge-stage {
  /* color por defecto si no hay style inline (etapa sin nombre). El handler
     genera el color desde el nombre de la etapa y lo aplica con style. */
  background: #eef4ff; color: var(--navy); border: 1px solid #cdd9f5;
}
.badge-urgent { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c2bc; }

.attach-icon {
  display: inline-flex; align-items: center; font-size: 14px;
  color: var(--muted); line-height: 1; margin-left: 2px;
}

/* ── "Mis tickets": header + stats + filtros + paginación ──────────────── */
.mt-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.mt-header .page-title { margin-bottom: 4px; }
.mt-header .page-sub { margin: 0; }

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stats-card {
  background: #f2f4f8; color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px;
  text-align: center;
  text-decoration: none;
  display: block;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20,30,80,.10);
}
.stats-card-active {
  box-shadow: 0 0 0 3px rgba(20,30,80,.18) inset;
}
.stats-num { font-family: var(--font-head); font-size: 28px; font-weight: 700; line-height: 1.1; }
.stats-label { font-size: 13px; margin-top: 4px; opacity: 0.85; }
.stats-card-total { background: #f2f4f8; color: var(--ink); }
.stats-card-urgent { background: var(--danger-bg); color: var(--danger); border-color: #f3c2bc; }

.filters-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 20px;
}
.filter-item { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-item > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.filter-item select,
.filter-item input[type="number"] {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  cursor: pointer;
  box-sizing: border-box;
}
.filter-item select { padding-right: 32px; }
.filter-item input[type="number"] { cursor: text; }
.filter-item select:focus,
.filter-item input[type="number"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(41,189,240,.18);
}

.pagination {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 24px; flex-wrap: wrap;
}
.page-btn {
  display: inline-flex; align-items: center;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--accent-dark);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.page-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn-disabled { color: var(--muted); border-color: var(--line); opacity: 0.5; cursor: default; }
.page-btn-disabled:hover { background: #fff; color: var(--muted); border-color: var(--line); }
.page-info { color: var(--muted); font-size: 14px; }

/* ── Detalle de ticket ───────────────────────────────────────────────────── */
.ticket-ref a { color: inherit; text-decoration: none; border-bottom: 2px dotted rgba(27,42,120,.35); }
.ticket-ref a:hover { border-bottom-style: solid; }

.td-header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.td-title { margin: 0; font-size: 24px; }
.td-num { color: var(--navy); }
.td-badges { display: flex; gap: 8px; flex-wrap: wrap; }

.td-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 22px; margin: 0 0 22px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.td-meta div { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; }
.td-meta dt { font-size: 12px; color: var(--muted); }
.td-meta dd { margin: 0; color: var(--ink); }

.td-section { margin-bottom: 28px; }
.td-h2 { font-size: 16px; color: var(--navy); margin: 0 0 10px; }
.td-rich { color: var(--ink); line-height: 1.55; }
.td-rich p { margin: 0 0 8px; }
.td-rich p:last-child { margin-bottom: 0; }
.td-rich a { color: var(--accent-dark); }

.td-messages { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.td-msg { display: flex; gap: 12px; }
.td-avatar {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--navy); color: #fff;
  font-size: 13px; font-weight: 700; font-family: var(--font-head);
}
.td-msg-body { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.td-msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.td-msg-author { font-weight: 600; color: var(--navy); font-size: 14px; }
.td-msg-date { font-size: 12px; color: var(--muted); }
.td-msg-content { font-size: 14px; }

.td-comment { display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.td-comment label { font-size: 14px; font-weight: 600; color: var(--navy); }
.td-comment textarea { min-height: 80px; }
.td-comment-file { display: flex; flex-direction: column; gap: 4px; }
.td-comment-file label { font-size: 13px; font-weight: 400; color: var(--muted); }

.td-attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.td-msg-body .td-attachments { margin-top: 8px; }
.td-att {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  padding: 8px; width: 150px; max-width: 100%;
}
.td-att > a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.td-att-thumb { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; background: #f2f3f8; }
.td-att-icon {
  width: 100%; height: 100px; display: grid; place-items: center;
  background: #f2f3f8; border-radius: 6px; font-size: 32px;
}
.td-att-name { font-size: 13px; word-break: break-word; line-height: 1.3; }
.td-att > a:hover .td-att-name { color: var(--accent-dark); text-decoration: underline; }
.td-att-size { font-size: 11px; color: var(--muted); }

/* ── Form de Mantenimiento — rediseño 2026 ─────────────────────────────────
   Look "card" (tarjeta blanca + tipografía system + inputs redondeados).
   Scoped a .m-page/.m-card para no afectar el resto del portal.
   --brand-color se setea inline desde la vista con res.company.color; si la
   compañía no tiene color, queda el fallback del :root de abajo. */
.m-page {
  --brand-color: #1a73e8;
  --m-bg: #f5f5f7;
  --m-card: #ffffff;
  --m-border: #e5e5ea;
  --m-label: #6e6e73;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: #000;
  background: var(--m-bg);
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 40px 60px;
  flex: 1;
}
.m-page-title { font-size: 28px; font-weight: 600; margin: 30px 0 6px; line-height: 1.1; color: var(--brand-color); }
.m-page-sub {
  color: var(--ink);
  font-size: 20px;
  font-weight: 500;
  max-width: 720px;
  margin: 0 0 20px;
}

.m-card {
  background: var(--m-card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.m-card .m-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.m-card label,
.m-card .m-row-label { font-size: 13px; font-weight: 500; color: var(--m-label); margin-bottom: 4px; }

.m-card input[type="text"],
.m-card input[type="email"],
.m-card select,
.m-card textarea {
  width: 100%;
  border: 1px solid var(--m-border);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 15px;
  color: #000;
  background: #fff;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  font-family: inherit;
}
.m-card textarea { min-height: 105px; resize: vertical; }
.m-card input:focus,
.m-card select:focus,
.m-card textarea:focus { border-color: #000; box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.m-card input[readonly] {
  background: #f2f4f8; color: #4a4a52; cursor: not-allowed;
}
.m-card input[readonly]:focus { border-color: var(--m-border); box-shadow: none; }

.m-card .m-file-input { display: none; }
.m-file-button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 18px;
  border: none; border-radius: 20px;
  background: #d1d1d6; color: #000;
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .2s ease;
  align-self: flex-start;
  font-family: inherit;
}
.m-file-button:hover { background: #bfbfc4; }

.m-help { margin: 8px 0 0; font-size: 14px; color: #000; line-height: 1.4; }

.m-file-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.m-file-list li {
  font-size: 13px; color: #000;
  background: #f2f2f4;
  border-radius: 8px;
  padding: 6px 12px;
  word-break: break-word;
}
.m-file-list li::before {
  content: "📄 ";
}

/* ── Tooltip dinámico ("?" al lado de cada label) ──────────────────────── */
.m-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border: none; border-radius: 50%;
  background: #d1d1d6; color: #000;
  font-family: inherit;
  font-size: 11px; font-weight: 700; line-height: 1;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  padding: 0;
}
.m-info:hover, .m-info:focus, .m-info.open {
  background: #b1b1b6; outline: none;
}
.m-info::after {
  content: attr(data-info);
  display: none;
  position: absolute;
  left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: #1c1c1f; color: #fff;
  font-size: 12px; font-weight: 400; line-height: 1.4;
  text-align: left; white-space: normal;
  padding: 8px 10px; border-radius: 8px;
  width: 240px; max-width: 80vw;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 5;
}
.m-info::before {
  content: "";
  display: none;
  position: absolute;
  left: 50%; bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1c1c1f;
  z-index: 5;
}
.m-info:hover::after, .m-info:focus::after, .m-info.open::after,
.m-info:hover::before, .m-info:focus::before, .m-info.open::before {
  display: block;
}
/* Para botones "?" que no están dentro de un label (ej. al lado de "Sacar
   foto" o "Adjuntar fotos / archivos") — se ubican como ítem propio de la
   columna y necesitan separación. */
.m-info-standalone {
  align-self: flex-start;
  margin-left: 8px;
  margin-top: -32px;       /* sube al lado del botón anterior */
  margin-bottom: 8px;
}

.m-card .m-radios { display: flex; gap: 30px; margin-top: 8px; font-size: 15px; padding-top: 0; }
.m-card .m-radio {
  display: flex; align-items: center; gap: 10px;
  color: #000; font-weight: 400; cursor: pointer;
}
.m-card .m-radio input[type="radio"] {
  width: 18px; height: 18px; min-height: auto;
  accent-color: #000; box-shadow: none;
}

.m-card .m-canvas-wrap { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.m-card .m-canvas {
  width: 100%; height: auto; max-height: 70vh;
  border: 1px solid var(--m-border); border-radius: 12px; background: #fff;
  touch-action: none; cursor: crosshair;
}
.m-ghost-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--m-border); border-radius: 18px;
  background: #fff; color: #000;
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
  transition: background .2s ease;
}
.m-ghost-btn:hover { background: #f2f2f4; }

.m-card .m-geo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

.m-submit { margin-top: 36px; }
.m-card button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 180px; height: 44px; padding: 0 24px;
  border: none; border-radius: 8px;
  background: var(--brand-color); color: #fff;
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: filter .2s ease, box-shadow .2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  font-family: inherit;
}
.m-card button[type="submit"]:hover { filter: brightness(0.92); box-shadow: 0 2px 4px rgba(0,0,0,0.16); }
.m-card button[type="submit"]:disabled,
.m-card button[type="submit"]:disabled:hover {
  opacity: 0.6; cursor: not-allowed; filter: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

@media (max-width: 700px) {
  .m-page { padding: 20px 16px 40px; }
  .m-page-title { font-size: 22px; }
  .m-card { padding: 24px 18px; border-radius: 16px; }
  .m-card button[type="submit"] { width: 100%; height: 48px; font-size: 16px; }
}

/* "Sacar foto" usa la cámara del dispositivo (capture="environment") → solo
   tiene sentido en mobile. En desktop ocultamos el botón completo y su hint.
   El canvas se sigue mostrando si vino una foto (caso edge: form repostado). */
@media (min-width: 701px) {
  #m-photo-trigger,
  .m-row-photo > .m-photo-help { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — tablets y mobile
   ═══════════════════════════════════════════════════════════════════════ */

/* Tablet y mobile (≤ 768px) */
@media (max-width: 768px) {
  /* Container más pegado al borde */
  .container { padding: 0 14px; }
  .page { padding: 22px 0 40px; }
  .page-title { font-size: 24px; }
  .page-sub { font-size: 14px; }

  /* Header en mobile: TODO en una sola fila. Logo + botones circulares
     con iconos (Nuevo reporte = "+", Mis tickets = "📋", avatar, Salir = "↪"). */
  .site-header { padding: 0; }
  .header-inner {
    flex-wrap: nowrap;
    min-height: 60px; padding: 10px 0;
    gap: 8px;
    align-items: center;
  }
  .brand-logo { max-height: 40px; }

  /* CTA y link se vuelven botones circulares con solo icono */
  .header-actions { gap: 6px; }
  .header-cta {
    width: 38px; height: 38px;
    padding: 0; border-radius: 50%;
    justify-content: center;
  }
  .header-cta-icon { font-size: 22px; margin: 0; }
  .header-cta-label { display: none; }

  .header-link {
    width: 38px; height: 38px;
    padding: 0; border-radius: 50%;
    justify-content: center;
    background: #f2f4f8;
  }
  .header-link:hover { background: #e6e9f2; }
  .header-link-icon { display: inline; }
  .header-link-label { display: none; }
  .header-link-strong {
    width: auto; height: auto; padding: 7px 14px; border-radius: 999px;
  }

  /* Bloque del usuario sin separador (ya no hace falta visualmente) */
  .header-user-block {
    padding-left: 0;
    border-left: none;
    gap: 6px;
  }
  .header-user-name { display: none; }
  .user-avatar { width: 38px; height: 38px; }
  .header-icon-btn { width: 38px; height: 38px; font-size: 15px; }

  /* Stats cards: grid auto que adapta. */
  .stats-cards { gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .stats-card { padding: 14px 12px; border-radius: 12px; }
  .stats-num { font-size: 24px; }
  .stats-label { font-size: 12px; }

  /* Filtros: stack 2x2 con scroll horizontal opcional */
  .filters-bar { padding: 12px; gap: 10px; border-radius: 12px; align-items: stretch; }
  .filter-item { min-width: 0; flex: 1 1 calc(50% - 6px); }
  .filter-item select,
  .filter-item input[type="number"] { height: 42px; font-size: 15px; }

  /* "Mis tickets" header: stack y botón ancho */
  .mt-header { gap: 12px; }
  .mt-header > a.btn { width: 100%; text-align: center; }

  /* Lista de tickets: card con jerarquía clara
     - ID + badges arriba (línea 1)
     - Título a continuación con espacio propio
     - Meta (etapa, equipo, fecha) abajo
  */
  .ticket-row {
    padding: 18px 18px;
    gap: 12px;
    border-radius: 12px;
  }
  .ticket-row-main {
    align-items: center;
    gap: 10px;
  }
  .ticket-row-id {
    font-size: 13px;
    color: var(--muted);
    background: #f2f4f8;
    padding: 3px 10px;
    border-radius: 999px;
    font-family: var(--font-head);
  }
  .ticket-row-name {
    flex-basis: 100%;
    font-size: 15px;
    line-height: 1.4;
    color: var(--ink);
    order: 99;
    margin-top: 2px;
  }
  .ticket-row-meta { font-size: 12px; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

  /* Detalle de ticket */
  .td-title { font-size: 20px; }
  .td-meta { grid-template-columns: 1fr; padding: 12px 14px; }
  .back-links { gap: 12px; flex-direction: column; align-items: flex-start; }
  .back-links .back-link { margin-bottom: 0; }

  /* Adjuntos: tarjetas más chicas */
  .td-att { width: 130px; }
  .td-att-thumb, .td-att-icon { height: 80px; }

  /* Paginación */
  .pagination { gap: 10px; }
  .page-btn { padding: 8px 14px; font-size: 13px; }
  .page-info { font-size: 13px; width: 100%; text-align: center; order: -1; }

  /* Tooltips de ayuda: posicionarlos para que no se desborden */
  .m-info::after { width: min(240px, 70vw); }

  /* Touch target mínimo (Apple/Google guideline: 44px) */
  button[type="submit"], .btn { min-height: 44px; }

  /* Login: padding más chico */
  .auth-wrap { padding: 24px 14px; }
  .auth-card { padding: 24px 20px; }
  .auth-logo { max-width: 180px; }

  /* Form estándar (legacy): asegurar 1 columna */
  .ticket-form { gap: 16px; }
}

/* Mobile chico (≤ 480px) */
@media (max-width: 480px) {
  .page-title { font-size: 22px; }

  /* Header en mobile chico: botones circulares un toque más chicos */
  .header-cta, .header-link, .header-icon-btn, .user-avatar {
    width: 34px; height: 34px;
  }
  .header-cta-icon { font-size: 20px; }
  .header-link-icon { font-size: 15px; }
  .header-icon-btn { font-size: 14px; }
  .brand-logo { max-height: 36px; }
  .header-actions { gap: 4px; }
  .header-user-block { gap: 4px; }

  /* Stats: 2 columnas con formato horizontal (número grande a la izquierda,
     label a la derecha) — más legible y ocupa menos vertical. */
  .stats-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stats-card {
    display: flex; align-items: center; justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    text-align: left;
  }
  .stats-card:hover { transform: none; }
  .stats-num { font-size: 22px; flex-shrink: 0; }
  .stats-label { margin-top: 0; font-size: 12px; opacity: 0.9; line-height: 1.2; }

  /* Filtros: cada uno full width */
  .filter-item { flex: 1 1 100%; }

  /* Lista de tickets: el nombre tiene línea propia y se rompe si es muy largo */
  .ticket-row-main { gap: 6px; }
  .ticket-row-name { word-break: break-word; }

  /* Form de Mantenimiento: padding más chico de la card */
  .m-card { padding: 18px 14px; border-radius: 14px; }
  .m-page-title { font-size: 20px; }
  .m-page { padding: 12px 12px 32px; }

  /* Tooltip "?" alineado a la derecha para no salirse cuando el botón está al final del label */
  .m-info::after { left: auto; right: 0; transform: none; }
  .m-info::before { left: auto; right: 4px; transform: none; }

  /* Página de gracias */
  .thanks-actions { flex-direction: column; }
  .thanks-actions .btn { width: 100%; }
}
