/* MIA Plaie — styles applicatifs (sur la charte EasyIDEL, module=plaie / rose) */

.app-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); color: var(--header-text); box-shadow: var(--shadow-md); }
.app-header-inner { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); align-self: center; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; opacity: .7; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.badge-status { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); }
.badge-status.ok { background: color-mix(in srgb, var(--success) 30%, transparent); }
.badge-status.demo { background: color-mix(in srgb, var(--amber-500) 35%, transparent); }
.btn-theme { color: var(--header-text); border-color: rgba(255,255,255,.3); }

.disclaimer-strip { max-width: 1040px; margin: 12px auto 0; padding: 9px 14px; background: var(--accent-soft); color: var(--accent-hover); border-radius: var(--r-sm); font-size: 11.5px; line-height: 1.5; }
[data-theme="dark"] .disclaimer-strip { color: var(--text); }

.crumbs { max-width: 1040px; margin: 10px auto 0; padding: 0 16px; font-size: 12.5px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 500; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { opacity: .5; }

.app-main { max-width: 1040px; margin: 14px auto 60px; padding: 0 16px; }
.loading { text-align: center; color: var(--text-muted); padding: 40px; }

/* ── Cards / sections ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.card h2 { font-size: 14px; color: var(--accent); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card h2 .n { width: 22px; height: 22px; background: var(--accent); color: var(--accent-text); border-radius: 50%; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-muted); font-size: 12.5px; }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }

/* ── Buttons ── */
button { font-family: var(--font-ui); cursor: pointer; }
.btn { background: var(--accent); color: var(--accent-text); border: none; padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 13.5px; }
.btn:hover { background: var(--accent-hover); }
.btn:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); border-radius: var(--r-xs); padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Forms ── */
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1.5px solid var(--border-strong); border-radius: var(--r-sm); font-size: 13.5px; font-family: inherit; background: var(--surface); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 620px){ .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.toggles { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0; }
.toggles label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }

/* ── Lists (patients / dossiers / analyses) ── */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, transform .05s; }
.list-item:hover { border-color: var(--accent); }
.list-item:active { transform: scale(.998); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-hover); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 600; font-size: 14px; }
.li-sub { font-size: 12px; color: var(--text-muted); }
.li-meta { font-size: 11.5px; color: var(--text-muted); text-align: right; white-space: nowrap; }
.pill { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-hover); }
.pill.green { background: var(--green-100); color: var(--green-700); }
.pill.amber { background: var(--amber-100); color: var(--amber-700); }
.pill.gray { background: var(--gray-100); color: var(--gray-600); }
.empty { text-align: center; color: var(--text-muted); padding: 30px 12px; }
.empty .ico { font-size: 34px; opacity: .5; }

/* ── Capture ── */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--accent); color: var(--accent); background: transparent; font-size: 12.5px; font-weight: 600; }
.tab.active, .tab:hover { background: var(--accent); color: var(--accent-text); }
.dropzone { border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--r-md); padding: 26px 18px; text-align: center; cursor: pointer; background: var(--accent-soft); }
.dropzone:hover, .dropzone.drag { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.dropzone .ico { font-size: 32px; }
.dropzone small { color: var(--text-muted); }
#cam-video { width: 100%; max-height: 320px; border-radius: var(--r-md); background: #000; object-fit: contain; }
.preview { margin-top: 12px; }
.preview img { width: 100%; max-height: 340px; object-fit: contain; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.preview-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.link-x { color: var(--danger); cursor: pointer; font-weight: 600; }

/* ── Résultat analyse ── */
.resume-head { background: linear-gradient(135deg, var(--accent-hover), var(--accent)); color: #fff; border-radius: var(--r-md); padding: 16px 18px; }
.resume-type { font-size: 20px; font-weight: 700; }
.resume-sub { opacity: .92; font-size: 13px; margin-top: 2px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.chip { background: rgba(255,255,255,.2); border-radius: var(--r-pill); padding: 3px 11px; font-size: 11px; font-weight: 600; }

.bed-bar { display: flex; height: 24px; border-radius: var(--r-sm); overflow: hidden; margin: 6px 0 8px; border: 1px solid var(--border); }
.bed-seg { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; min-width: 0; }
.bed-seg.necrose { background: #2c2c2c; } .bed-seg.fibrine { background: #c9a227; } .bed-seg.bourg { background: #c0392b; } .bed-seg.epider { background: #e78fa8; color:#5b2336; }
.bed-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-muted); }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px){ .kv-grid { grid-template-columns: 1fr; } }
.kv { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 11px; }
.kv .k { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.kv .v { font-size: 13px; font-weight: 500; margin-top: 2px; }

.msg { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 7px; font-size: 13px; line-height: 1.5; }
.msg.ok { background: var(--green-100); color: var(--green-700); }
.msg.warn { background: var(--amber-100); color: var(--amber-700); }
.msg.info { background: var(--blue-100); color: var(--blue-700); }
.msg.bloc { background: var(--red-100); color: var(--red-700); }

.proto-step { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.proto-step:last-child { border: none; }
.proto-num { width: 22px; height: 22px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-hover); border-radius: 50%; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.proto-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.proto-v { font-size: 13.5px; font-weight: 500; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { background: var(--accent-soft); color: var(--accent-hover); border-radius: var(--r-xs); padding: 3px 9px; font-size: 11.5px; font-weight: 600; }
.tag.avoid { background: var(--red-100); color: var(--red-700); }

/* matériel table */
.mat-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mat-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); padding: 6px 8px; border-bottom: 2px solid var(--border); }
.mat-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.mat-table .lpp { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.presc-ide { color: var(--green-700); font-weight: 600; }
.presc-md { color: var(--red-600); font-weight: 600; }

.export-block { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 8px; }
.export-block .k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 6px; }
.export-text { font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; font-family: var(--font-ui); }

.ngap-main { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--r-sm); padding: 12px 14px; }
.ngap-code { font-size: 22px; font-weight: 700; font-family: var(--font-mono); color: var(--accent-hover); }

.redflags { background: var(--red-100); border: 1.5px solid var(--danger); border-radius: var(--r-md); padding: 14px 18px; margin-bottom: 14px; }
.redflags h3 { color: var(--red-700); font-size: 14px; margin-bottom: 6px; }
.redflags li { color: var(--red-700); font-size: 13px; margin-left: 18px; line-height: 1.5; }

.disclaimer-hard { background: var(--red-100); border-left: 3px solid var(--danger); padding: 8px 12px; font-size: 11.5px; color: var(--red-700); border-radius: 0 var(--r-xs) var(--r-xs) 0; margin-bottom: 10px; line-height: 1.5; }

/* ── Évolution (timeline) ── */
.evo { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; }
.evo-col { flex: 0 0 86px; text-align: center; }
.evo-stack { height: 120px; width: 40px; margin: 0 auto; border-radius: var(--r-xs); overflow: hidden; display: flex; flex-direction: column-reverse; border: 1px solid var(--border); }
.evo-seg { width: 100%; }
.evo-seg.necrose { background: #2c2c2c; } .evo-seg.fibrine { background: #c9a227; } .evo-seg.bourg { background: #c0392b; } .evo-seg.epider { background: #e78fa8; }
.evo-date { font-size: 10.5px; color: var(--text-muted); margin-top: 5px; }
.evo-tag { font-size: 10px; margin-top: 3px; }
.evo-empty { color: var(--text-muted); font-size: 13px; padding: 16px; }

/* thumbnails dans la liste d'analyses */
.thumb { width: 46px; height: 46px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; }

/* ── Toast ── */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy-900); color: #fff; padding: 10px 18px; border-radius: var(--r-pill); font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.source-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); margin-bottom: 10px; }
.source-tag.llm { background: var(--green-100); color: var(--green-700); }
.source-tag.demo { background: var(--amber-100); color: var(--amber-700); }

/* ── Authentification (overlay, charte MIA Plaie) ───────────────────────────── */
#mia-auth{position:fixed; inset:0; z-index:10000; display:flex; align-items:center; justify-content:center; padding:20px; background:var(--bg)}
#mia-auth .mia-auth-card{width:100%; max-width:380px; text-align:center}
#mia-auth .mia-auth-logo{font-size:30px; font-weight:800; letter-spacing:.5px; color:var(--text); line-height:1}
#mia-auth .mia-auth-logo .mod{color:var(--accent); font-weight:600; font-size:.5em; margin-left:9px; vertical-align:middle}
#mia-auth .mia-auth-tag{margin-top:3px; font-size:12px; color:var(--text-muted); letter-spacing:.4px}
#mia-auth .mia-auth-sub{margin-top:12px; font-weight:600; color:var(--accent)}
#mia-auth .mia-auth-rgpd{margin:10px 0 18px; font-size:12px; color:var(--text-muted); line-height:1.5}
#mia-auth .mia-auth-spin{margin-top:16px; font-size:13px; color:var(--text-muted)}
#mia-auth .field-label{text-align:left}
#mia-auth .mia-auth-err{min-height:18px; margin-top:10px; font-size:13px; color:var(--danger,#dc2626); text-align:left}
