/* ==========================================================
   Meridian Pro — Bibliothèque de schémas
   Thème clair
   ========================================================== */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --primary: #0f2a4a;          /* bleu nuit Meridian */
  --primary-ink: #ffffff;
  --accent: #e8a317;           /* ambre */
  --ok: #12b76a;
  --danger: #d92d20;
  --wa: #25d366;
  --c-tracker: #e8a317;
  --c-alarme: #d92d20;
  --c-sos: #1570ef;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: .3em 0 .6em; letter-spacing: -.02em; font-weight: 750; }
h1 small { color: var(--muted); font-weight: 500; font-size: .6em; margin-left: .3em; letter-spacing: 0; }
h2 { font-size: 1.05rem; margin: 1.6em 0 .8em; font-weight: 700; letter-spacing: -.01em; }
h2 small { font-weight: 400; color: var(--muted); }
.card h2 { margin-top: 0; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .82rem; margin: 0; }
.empty { color: var(--muted); padding: 3rem 1rem; text-align: center; background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.warn-text { color: #b54708; }

/* ---------- Marque Meridian ---------- */
.brand-mark { font-weight: 800; letter-spacing: .16em; font-size: 1.05rem; color: var(--primary); }
.brand-mark span { color: var(--accent); margin-left: .35em; }
.brand-mark.sm { font-size: .88rem; white-space: nowrap; }

/* ---------- Formulaires ---------- */
input, select, textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px;
  padding: .62rem .8rem; outline: none; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15, 42, 74, .1); }
input[type=file] { padding: .45rem; background: var(--panel-2); }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin: 1rem 0 .4rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text-2); box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--panel-2); }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { background: #163a63; }
.btn-danger { color: var(--danger); border-color: #fda29b; }
.btn-danger:hover { background: #fef3f2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-wa { background: var(--wa); color: #fff; border-color: var(--wa); }
.btn-sm { padding: .38rem .72rem; font-size: .83rem; border-radius: 8px; }
.btn-block { width: 100%; margin-top: 1.3rem; padding: .85rem; font-size: 1rem; }
.file-btn { margin: 0; }
.error { color: var(--danger); margin: .7rem 0; font-size: .9rem; font-weight: 500; }

.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row > .grow { flex: 1 1 200px; width: auto; }
.row > select { width: auto; }
.stack { display: grid; gap: .6rem; margin-bottom: .6rem; }
form { margin: 0; }

/* ---------- Connexion ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #e6edf6 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 20px; padding: 2.2rem 1.7rem;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 1.4rem; margin: 1.4rem 0 .25rem; }
.code-input {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.2rem;
  letter-spacing: .08em; text-align: center; padding: .75rem;
}
.code-input::placeholder { letter-spacing: 0; text-transform: none; font-family: inherit; font-size: 1rem; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .75rem max(16px, calc((100% - 1100px) / 2));
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .search { flex: 1 1 240px; max-width: 460px; }
.topbar .search input { padding: .5rem .85rem .5rem 2.2rem; background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") .75rem center no-repeat; box-shadow: none; }
.who { font-size: .85rem; color: var(--muted); display: flex; gap: .9rem; align-items: center; margin-left: auto; }
.link-quiet { color: var(--muted); }
.link-quiet:hover { color: var(--text); }
.tabs { display: flex; gap: .25rem; flex: 1; }
.tabs a { color: var(--muted); padding: .42rem .8rem; border-radius: 8px; font-weight: 600; font-size: .9rem; }
.tabs a:hover { color: var(--text); background: var(--panel-2); }
.tabs a.on { background: var(--primary); color: #fff; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.2rem 16px 5rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin: .4rem 0 .2rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumb-cat { font-weight: 600; }

/* ---------- Accueil ---------- */
.hero { padding: 1.6rem 0 .6rem; }
.hero h1 { font-size: 2rem; margin: .2rem 0 .3rem; }
.eyebrow { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

/* ---------- Types de schémas ---------- */
.cats { display: grid; gap: .8rem; margin-top: 1rem; }
.cats-home { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cat {
  display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.cat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--cc); }
.cats-home .cat { flex-direction: column; align-items: flex-start; padding: 1.5rem; gap: 1.1rem; }
.cats-home .cat-go { display: none; }
.cat-tracker { --cc: var(--c-tracker); } .cat-alarme { --cc: var(--c-alarme); } .cat-sos { --cc: var(--c-sos); }
.cat-off { opacity: .5; box-shadow: none; }
.cat-icon { width: 46px; height: 46px; flex: none; border-radius: 12px; background: color-mix(in srgb, var(--cc) 14%, #fff); position: relative; }
.cat-icon::after { content: ""; position: absolute; inset: 11px; background: var(--cc); -webkit-mask: var(--ico) center/contain no-repeat; mask: var(--ico) center/contain no-repeat; }
.cat-tracker .cat-icon { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5 7 13 7 13s7-8 7-13a7 7 0 0 0-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E"); }
.cat-alarme .cat-icon { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 4 5v6c0 5 3.4 9.7 8 11 4.6-1.3 8-6 8-11V5l-8-3z'/%3E%3C/svg%3E"); }
.cat-sos .cat-icon { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-2h2zm0-4h-2V7h2z'/%3E%3C/svg%3E"); }
.cat-off .cat-icon { --cc: var(--muted); }
.cat-text { display: grid; flex: 1; gap: .1rem; }
.cat-text strong { font-size: 1.08rem; }
.cat-text small { font-size: .88rem; }
.cat-go { font-size: 1.5rem; color: var(--line-2); }
.title-cat { border-left: 5px solid var(--cc); padding-left: .6rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--cc); background: color-mix(in srgb, var(--cc) 12%, #fff); padding: .2rem .6rem; border-radius: 99px; }

.cat-switch { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cat-switch a { padding: .45rem .9rem; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-sm); }
.cat-switch a:hover { border-color: var(--primary); color: var(--primary); }
.cat-switch a.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Marques ---------- */
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.2rem 0 .9rem; }
.section-bar h2 { margin: 0; }
.filter { max-width: 260px; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.brand-tile {
  display: flex; flex-direction: column; align-items: center; gap: .55rem; text-align: center;
  padding: 1.2rem .8rem 1rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.brand-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.brand-tile[hidden] { display: none; }
.brand-logo { width: 100%; height: 64px; display: grid; place-items: center; }
.brand-logo img { max-width: 110px; max-height: 60px; object-fit: contain; }
.brand-name { font-weight: 650; font-size: .95rem; }
.monogram {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #eef2f7, #dde4ee); color: var(--primary);
  font-weight: 800; font-size: 1.15rem; letter-spacing: .02em;
}

/* ---------- Modèles ---------- */
.page-head { display: flex; align-items: center; gap: 1rem; margin: .3rem 0 1rem; }
.page-head h1 { margin: 0; }
.head-logo { width: 72px; height: 56px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.head-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.head-logo .monogram { width: 42px; height: 42px; font-size: .95rem; }
.head-photo { width: 120px; aspect-ratio: 16/10; flex: none; border-radius: 12px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; }
.head-photo img { width: 100%; height: 100%; object-fit: cover; }

.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.model-card {
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.model-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.model-photo { aspect-ratio: 16/10; background: linear-gradient(180deg, #f2f4f7, #e9edf2); display: grid; place-items: center; overflow: hidden; }
.model-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.model-card:hover .model-photo img { transform: scale(1.04); }
.model-info { display: grid; padding: .8rem 1rem .95rem; gap: .15rem; }
.model-info strong { font-size: 1.05rem; }
.model-info small { font-size: .85rem; font-variant-numeric: tabular-nums; }
.car-ph { width: 46%; color: #c5ccd6; }
.head-photo .car-ph { width: 60%; }

/* ---------- Années ---------- */
.years { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .5rem; }
.years a, .years span { text-align: center; padding: .8rem 0; border-radius: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.years a { background: var(--panel); border: 1px solid var(--line-2); color: var(--text); box-shadow: var(--shadow-sm); transition: all .12s; }
.years a:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.years span { color: #c5ccd6; background: transparent; border: 1px dashed var(--line); }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.list li + li { border-top: 1px solid var(--line); }
.list a, .list .act {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .9rem 1.1rem; color: var(--text);
}
.list a:hover { background: var(--panel-2); }
.list.compact a, .list.compact .act { padding: .62rem .95rem; font-size: .93rem; }
.card .list { margin-top: .8rem; box-shadow: none; }
.count { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.count.warn { color: #b54708; font-weight: 600; }

/* ---------- Fiche ---------- */
.sheet-head { display: flex; gap: 1.1rem; align-items: center; margin: .5rem 0 1.2rem; }
.sheet-head h1 { margin: .35rem 0 .35rem; }
.sheet-head .head-photo { width: 150px; }
.vehicle { margin: -.4rem 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pill-years { display: inline-block; background: var(--panel); border: 1px solid var(--line-2); border-radius: 99px; padding: .15rem .7rem; font-size: .85rem; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.notes {
  background: #fffaeb; border: 1px solid #fedf89; border-left: 4px solid var(--accent);
  padding: .85rem 1.1rem; border-radius: 10px; margin-bottom: 1rem; color: #7a2e0e; font-size: .95rem;
}
.diagram { margin: 0 0 1.6rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.diagram figcaption { padding: .8rem 1.1rem; font-weight: 650; border-bottom: 1px solid var(--line); }
.diagram .hint { margin: 0; padding: .55rem 1.1rem; font-size: .8rem; color: var(--muted); background: var(--panel-2); border-top: 1px solid var(--line); }
.sub { margin: -.6rem 0 1rem; }

/* ---------- Visionneuse protégée ---------- */
.schema-wrap { position: relative; background: #fff; min-height: 200px; }
.schema-wrap canvas { display: block; width: 100%; height: auto; cursor: zoom-in; }
.schema-wrap:not(.ready) canvas { visibility: hidden; height: 200px; }
.schema-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.schema-wrap.ready .schema-loading { display: none; }
canvas.schema, #viewer { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#viewer { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; }
#viewer[hidden] { display: none; }
.v-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem 16px; border-bottom: 1px solid var(--line); font-weight: 650; background: var(--panel); }
.v-stage { flex: 1; position: relative; overflow: hidden; touch-action: none; cursor: grab; background: #f2f4f7; }
.v-stage canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: var(--shadow-lg); background: #fff; }
body.veiled canvas.schema, body.veiled #v-canvas { filter: blur(28px); }
@media print { body { display: none !important; } }

/* ---------- Pastilles ---------- */
.dots { display: flex; gap: .3rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.dot.on.dot-tracker { background: var(--c-tracker); border-color: var(--c-tracker); }
.dot.on.dot-alarme { background: var(--c-alarme); border-color: var(--c-alarme); }
.dot.on.dot-sos { background: var(--c-sos); border-color: var(--c-sos); }
.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin: .4rem 0 1rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }

/* ---------- Admin ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
details.card summary { cursor: pointer; font-weight: 650; }
details.card[open] summary { margin-bottom: .9rem; }
.two-col { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 1rem; }
.two-col .card { margin: 0; }
.brand-input { font-weight: 700; width: auto; max-width: 220px; }
.brand-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.brand-head .brand-logo { width: 84px; height: 54px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.brand-head .brand-logo img { max-width: 100%; max-height: 100%; }
.brand-head .monogram { width: 38px; height: 38px; font-size: .85rem; }
.model-row { display: flex; align-items: center; gap: .75rem; }
.mini-photo { width: 56px; aspect-ratio: 16/10; border-radius: 6px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; flex: none; }
.mini-photo img { width: 100%; height: 100%; object-fit: cover; }
.mini-photo .car-ph { width: 70%; }
.photo-edit { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.photo-preview { width: 220px; aspect-ratio: 16/10; border-radius: 12px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-edit .stack { flex: 1; min-width: 200px; }

.new-code { border: 2px solid var(--ok); text-align: center; background: #f6fef9; }
.new-email { margin: .2rem 0 0; font-weight: 600; }
.code-big { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 2rem; font-weight: 700; letter-spacing: .12em; color: var(--primary); margin: .3rem 0 1rem; }
.new-code .row { justify-content: center; }
.code-list { display: grid; gap: .7rem; }
.code-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.code-row.status-revoked, .code-row.status-expired { background: var(--panel-2); }
.code-row.status-revoked .code-main, .code-row.status-expired .code-main { opacity: .6; }
.code-main { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.code-main code { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--primary); background: #eef2f7; padding: .1rem .45rem; border-radius: 6px; letter-spacing: .06em; font-size: .9rem; }
.code-email { font-size: .9rem; margin-top: .25rem; color: var(--text-2); }
.code-meta { font-size: .8rem; margin: .35rem 0 .7rem; }
.code-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.code-edit { margin-top: .7rem; }
.code-edit summary { cursor: pointer; font-size: .85rem; color: var(--primary); font-weight: 600; }
.code-edit form { margin-top: .7rem; max-width: 440px; }
.code-edit label { margin: .2rem 0 0; font-weight: 500; }
.code-field { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em; }
.code-field::placeholder { letter-spacing: 0; font-family: inherit; }
.pill { font-size: .7rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
.pill-active { background: #ecfdf3; color: #027a48; }
.pill-revoked { background: #fef3f2; color: #b42318; }
.pill-expired { background: #f2f4f7; color: var(--muted); }

.cat-block { border-top: 4px solid var(--cc); }
.cat-block h2 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.cat-block .list { margin-top: .7rem; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin: .9rem 0; }
.thumb { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem; display: grid; gap: .5rem; }
.thumb img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #fff; border-radius: 8px; display: block; border: 1px solid var(--line); }
.upload-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line-2); }
.sheet-add { display: grid; grid-template-columns: 100px 140px 1fr auto; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line-2); }

/* ---------- Messages ---------- */
.flash {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 60;
  max-width: calc(100% - 32px); padding: .75rem 1.1rem; border-radius: 12px; font-weight: 600; font-size: .92rem;
  animation: flash 4.5s forwards; box-shadow: var(--shadow-lg);
}
.flash-ok { background: #fff; color: #027a48; border: 1px solid #a6f4c5; }
.flash-err { background: #fff; color: #b42318; border: 1px solid #fda29b; }
@keyframes flash { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  h1 { font-size: 1.45rem; }
  .hero h1 { font-size: 1.6rem; }
  .topbar { gap: .6rem; }
  .topbar .search, .tabs { order: 3; flex-basis: 100%; max-width: none; }
  .brand-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: .6rem; }
  .brand-tile { padding: .9rem .5rem .8rem; }
  .brand-logo { height: 48px; }
  .brand-logo img { max-width: 80px; max-height: 44px; }
  .model-grid { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .model-info { padding: .6rem .7rem .7rem; }
  .model-info strong { font-size: .95rem; }
  .head-photo { width: 90px; }
  .sheet-head .head-photo { width: 100px; }
  .code-big { font-size: 1.6rem; }
  .upload-row { grid-template-columns: 1fr; }
  .sheet-add { grid-template-columns: 1fr 1fr; }
  .sheet-add input[name=engine], .sheet-add .btn { grid-column: 1 / -1; }
  .filter { max-width: none; }
}
.version { font-size: .72rem; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: .1rem .5rem; }
