/* Mushcast · thème forêt, repris des maquettes Figma (page « Mushcast ») */
:root {
  --bg: #121b16; --card: #1b2921; --card2: #243529; --line: #2f4437;
  --text: #ece6d8; --muted: #9aab9e; --dim: #6c7f72;
  --accent: #e3a64a; --good: #6cc070; --low: #c9704a; --warn: #e0634f; --dark: #0d1410;
  --rain: #5aa5c8; --map: #18241d; --veil: rgba(10, 16, 12, .62);
  --r: 12px; --r-sm: 10px; --gutter: 16px;
  --f-body: 'Barlow', system-ui, sans-serif; --f-title: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: #0b100d; color: var(--text); font: 400 14px/1.4 var(--f-body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-title); font-weight: 700; margin: 0; line-height: 1.1; }
p { margin: 0; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .accent { color: var(--accent); } .good { color: var(--good); } .warn-t { color: var(--warn); }
.small { font-size: 12px; } .xs { font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative; padding-bottom: calc(24px + var(--safe-b)); }
.screen { display: flex; flex-direction: column; }
.pad { padding: 0 var(--gutter); }
.section { padding: 22px var(--gutter) 0; display: flex; flex-direction: column; gap: 10px; }
.section > h2 { font-size: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h2 { font-size: 20px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center-screen { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; gap: 14px; }
.center-screen .head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-bottom: 14px; }
.center-screen .head h1 { font-size: 30px; }
.logo { width: 60px; height: 60px; }

/* Barres de navigation */
.topbar { display: flex; align-items: center; gap: 8px; padding: 18px var(--gutter) 8px; }
.topbar h1 { font-size: 26px; }
.backbar { display: flex; align-items: center; justify-content: space-between; padding: 16px var(--gutter) 0 10px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 14px; }
.back svg { width: 20px; height: 20px; }
.back.big { color: var(--text); font: 700 22px var(--f-title); }
.back.big svg { width: 22px; height: 22px; color: var(--muted); }
.icon-btn { width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--card2); border: 0; display: grid; place-items: center; color: var(--text); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--dark); display: grid; place-items: center; font-weight: 600; font-size: 16px; }
.avatar.lg { width: 48px; height: 48px; font-size: 20px; }
.page-title { padding: 6px var(--gutter) 0; }
.page-title h1 { font-size: 28px; }
.page-title p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Cartes, listes */
.card { background: var(--card); border-radius: var(--r); padding: 12px 14px; }
.card.tight { padding: 4px 14px; }
.lines > * { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.lines > *:last-child { border-bottom: 0; }
.lines .k { flex: 1; min-width: 0; }
.lines .k small { display: block; color: var(--muted); font-size: 12px; }
.lines a { color: var(--text); }
.lines .v { font-weight: 600; }
.chev svg { width: 18px; height: 18px; color: var(--dim); }
.kv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.kv .k { font-size: 11px; color: var(--muted); }
.kv .v { font: 700 17px var(--f-title); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px var(--gutter) 0; }
.stats > div { background: var(--card); border-radius: var(--r); padding: 10px; text-align: center; }
.stats b { display: block; font: 700 26px var(--f-title); }
.stats span { font-size: 11px; color: var(--muted); }

/* Indices */
.badge { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); font: 700 22px var(--f-title); color: var(--dark); flex: none; }
.badge.sm { width: 36px; height: 36px; font-size: 18px; border-radius: 8px; }
.badge.lg { width: 60px; height: 60px; font-size: 30px; }
.s-good { background: var(--good); } .s-mid { background: var(--accent); } .s-low { background: var(--low); }
.t-good { color: var(--good); } .t-mid { color: var(--accent); } .t-low { color: var(--low); }

/* Chips */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 var(--gutter) 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding: 0; }
.chip { flex: none; border: 0; border-radius: 999px; padding: 7px 12px; background: var(--card2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--dark); }
.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.tag.good { color: var(--good); background: rgba(108, 192, 112, .14); }
.tag.mid { color: var(--accent); background: rgba(227, 166, 74, .14); }
.tag.bad { color: var(--warn); background: rgba(224, 99, 79, .14); }
.tag.neutral { color: var(--muted); background: rgba(154, 171, 158, .1); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px; border-radius: var(--r); border: 0; font: 700 17px var(--f-title); cursor: pointer; width: 100%; text-align: center; }
.btn.primary { background: var(--accent); color: var(--dark); }
.btn.secondary { background: var(--card2); color: var(--text); }
.btn.light { background: var(--text); color: var(--dark); }
.btn.danger { background: var(--warn); color: var(--text); }
.btn.outline { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-row { display: flex; gap: 10px; }
.cta { padding: 16px var(--gutter) 0; }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; }
.link-danger { background: none; border: 0; color: var(--warn); text-decoration: underline; font-size: 13px; cursor: pointer; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .field input, .field textarea, .field select { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px; color: var(--text); font: 400 15px var(--f-body); }
.sheet .field input { background: var(--bg); }
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.field.error input { border: 1.5px solid var(--warn); }
.field-error { color: var(--warn); font-size: 12px; }
.field-hint { color: var(--dim); font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: var(--muted); line-height: 1.35; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.form-error { color: var(--warn); font-size: 13px; text-align: center; }
textarea { resize: vertical; min-height: 80px; }

.toggle { position: relative; width: 44px; height: 26px; flex: none; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle span { position: absolute; inset: 0; border-radius: 13px; background: var(--line); transition: background .15s; }
.toggle span::after { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + span { background: var(--good); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent)) 0/var(--p, 50%) 100% no-repeat, var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 0; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 0; }
.slider { padding: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.slider .row b { font: 700 18px var(--f-title); color: var(--accent); }

.seg { display: flex; gap: 3px; background: var(--card); border-radius: var(--r-sm); padding: 3px; }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); padding: 9px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--text); color: var(--dark); }

/* Sécurité */
.safety-line { display: flex; gap: 8px; padding: 16px var(--gutter) 0; font-size: 11px; color: var(--muted); line-height: 1.3; }
.safety-line svg, .banner svg { width: 16px; height: 16px; color: var(--warn); flex: none; }
.banner { display: flex; gap: 10px; padding: 10px var(--gutter); background: rgba(224, 99, 79, .16); font-size: 11px; line-height: 1.35; position: sticky; top: 0; z-index: 5; }
.notice { display: flex; gap: 10px; border-radius: var(--r); padding: 12px; background: rgba(224, 99, 79, .12); border: 1px solid rgba(224, 99, 79, .7); }
.notice svg { width: 18px; height: 18px; color: var(--warn); flex: none; }
.notice b { display: block; font-size: 14px; }
.ok-box { border-radius: var(--r); padding: 12px; background: rgba(108, 192, 112, .12); color: var(--good); font-size: 12px; }

/* Accueil */
.frise { display: flex; gap: 4px; padding: 6px 12px 10px; }
.day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: var(--r-sm); border: 1px solid transparent; background: none; cursor: pointer; min-width: 0; }
.day.on { background: var(--card2); border-color: var(--accent); }
.day .d { font-size: 12px; font-weight: 600; color: var(--muted); }
.day.on .d { color: var(--accent); }
.day .n { font-size: 11px; color: var(--dim); }
.day .bar { height: 62px; width: 30px; display: flex; align-items: flex-end; justify-content: center; }
.day .bar i { display: block; width: 20px; border-radius: 5px; }
.day .v { font: 700 18px var(--f-title); }
.day .sp { font-size: 9px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.map-wrap { padding: 0 var(--gutter); position: relative; }
.map { height: 330px; border-radius: 14px; overflow: hidden; background: var(--map); position: relative; z-index: 0; }
.map.dark-tiles .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.9) saturate(.45); }
.map-tools { position: absolute; top: 10px; right: calc(var(--gutter) + 10px); display: flex; flex-direction: column; gap: 8px; z-index: 500; }
.map-legend { position: absolute; top: 10px; left: calc(var(--gutter) + 10px); z-index: 500; background: rgba(13, 20, 16, .85); border-radius: 8px; padding: 5px 8px; font-size: 11px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.map-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.zm { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--dark); display: grid; place-items: center; font: 700 15px var(--f-title); color: var(--dark); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.zm.sel { outline: 2px solid var(--accent); outline-offset: 4px; }
.zm.txt { width: auto; min-width: 32px; padding: 0 6px; border-radius: 16px; font-size: 12px; }
.leaflet-container { font-family: var(--f-body); background: var(--map); }
.leaflet-popup-content-wrapper { background: var(--text); color: var(--dark); border-radius: 14px; }
.leaflet-popup-tip { background: var(--text); }
.leaflet-popup-content { margin: 12px; width: 240px !important; }
.pop { display: flex; flex-direction: column; gap: 6px; }
.pop h3 { font-size: 17px; color: var(--dark); }
.pop .sub { font-size: 11px; color: #4b574f; }
.pop .also { font-size: 11px; color: #5f6b63; }
.pop .btn { min-height: 40px; font-size: 15px; background: var(--dark); color: var(--text); }
.leaflet-control-attribution { background: rgba(13, 20, 16, .7) !important; color: var(--dim) !important; font-size: 9px; }
.leaflet-control-attribution a { color: var(--muted); }
.weather { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.weather > div { background: var(--card); border-radius: var(--r-sm); padding: 8px; }
.weather span { font-size: 10px; color: var(--muted); display: block; }
.weather b { font: 700 15px var(--f-title); }
.zone-card { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: var(--r); padding: 12px; color: var(--text); }
.zone-card h3 { font-size: 17px; }
.zone-card .z { color: var(--accent); font-size: 12px; }
.zone-card .r { color: var(--muted); font-size: 12px; }

/* Zone, fiche */
.score-card { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: 14px; padding: 14px; }
.score-card h2 { font-size: 19px; }
.mini-frise { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mini-frise button { border: 1px solid transparent; background: var(--card); border-radius: 8px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.mini-frise button.on { background: var(--card2); border-color: var(--accent); }
.mini-frise span { font-size: 11px; font-weight: 600; color: var(--muted); }
.mini-frise button.on span { color: var(--accent); }
.mini-frise b { font: 700 16px var(--f-title); }
.reason { background: var(--card); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.reason .row b { font: 700 15px var(--f-title); color: var(--good); }
.gauge { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.gauge i { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.chart { background: var(--card); border-radius: var(--r); padding: 12px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bars i { flex: 1; border-radius: 3px; background: var(--line); min-height: 2px; }
.bars i.on { background: var(--rain); }
.bars.months { height: 80px; }
.bars.months i.hi { background: var(--good); } .bars.months i.mid { background: var(--accent); }
.axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: 6px; }
.axis.months { display: grid; grid-template-columns: repeat(12, 1fr); text-align: center; gap: 4px; }
.axis.months .cur { color: var(--accent); font-weight: 600; }
.sp-row { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: var(--r-sm); padding: 10px; color: var(--text); }
.sp-row b { font-size: 15px; font-weight: 600; display: block; }
.sp-row small { color: var(--muted); font-size: 12px; }
.habitat .lines > * { align-items: flex-start; }
.habitat .lines .lab { width: 80px; flex: none; color: var(--muted); font-size: 12px; }
.habitat .lines .val b { font-weight: 500; display: block; }
.habitat .lines .val small { color: var(--dim); font-size: 10px; }
.lookalike { border: 1px solid rgba(224, 99, 79, .5); background: var(--card); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.lookalike h3 { font-size: 16px; }
.photo-ph { height: 90px; border-radius: 8px; background: var(--card2); display: grid; place-items: center; color: var(--dim); font-size: 11px; }
.tabs { padding: 14px var(--gutter) 0; }

/* Cueillette */
.qty { display: flex; align-items: baseline; gap: 6px; }
.qty b { font: 700 44px var(--f-title); line-height: 1; }
.dropzone { border: 1px dashed var(--line); border-radius: var(--r); padding: 22px; display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; position: relative; }
.dropzone svg { width: 20px; height: 20px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.big-qty { font: 700 56px var(--f-title); color: var(--accent); }

/* Carnet */
.entry { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: var(--r); padding: 12px; color: var(--text); }
.entry .ic { width: 40px; height: 40px; border-radius: 8px; background: var(--card2); display: grid; place-items: center; font: 700 16px var(--f-title); color: var(--accent); flex: none; }
.entry .ic.none { background: var(--bg); border: 1px solid var(--line); color: var(--dim); }
.entry h3 { font-size: 16px; display: inline; }
.entry .q { color: var(--muted); font-size: 13px; margin-left: 4px; }
.entry .w { font-size: 12px; color: var(--muted); }
.entry .i { font-size: 11px; font-weight: 600; }
.month-title { font: 700 15px var(--f-title); color: var(--muted); }
.reliability { display: flex; gap: 12px; align-items: center; }
.reliability .pct { width: 52px; height: 44px; border-radius: var(--r-sm); background: var(--good); color: var(--dark); display: grid; place-items: center; font: 700 20px var(--f-title); flex: none; }
.photo-big { height: 200px; border-radius: 14px; background: var(--card2); display: grid; place-items: center; color: var(--muted); gap: 8px; overflow: hidden; }
.photo-big img { width: 100%; height: 100%; object-fit: cover; }
.mini-map { height: 140px; border-radius: var(--r); overflow: hidden; }

/* Alertes, compte */
.species-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.species-grid label { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; font-weight: 500; }
.species-grid label span:first-child { flex: 1; }
.alert-card { background: var(--card); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.alert-card h3 { font-size: 17px; }
.dashed { border: 1px dashed var(--line); border-radius: var(--r); padding: 12px; text-align: center; color: var(--accent); font-weight: 600; background: none; width: 100%; cursor: pointer; }
.email-preview { background: var(--text); color: var(--dark); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.email-preview .meta { font-size: 11px; color: #5d6b61; }
.email-preview h3 { font-size: 16px; }
.email-preview p { font-size: 12px; color: #3a463e; line-height: 1.3; }
.email-preview .w { background: rgba(224, 99, 79, .14); color: #8a2d20; border-radius: 8px; padding: 8px; font-size: 11px; }
.zone-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legal h3 { font: 700 17px var(--f-title); color: var(--accent); margin-top: 4px; }
.legal p { color: var(--muted); font-size: 13px; line-height: 1.45; }

/* Feuilles */
.sheet-wrap { position: fixed; inset: 0; z-index: 1000; display: flex; justify-content: center; align-items: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--veil); opacity: 0; transition: opacity .2s; }
.sheet { position: relative; width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; background: var(--card); border-radius: 20px 20px 0 0; padding: 10px var(--gutter) calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; transform: translateY(100%); transition: transform .2s ease-out; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; }
.sheet-title { font-size: 22px; }
.sheet-title.danger { color: var(--warn); }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; padding-top: 6px; }
.opt { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; cursor: pointer; }
.opt:last-child { border-bottom: 0; }
.opt .k { flex: 1; } .opt small { display: block; color: var(--muted); font-size: 12px; }
.opt .ck { width: 20px; height: 20px; color: var(--accent); visibility: hidden; }
.opt.on .ck { visibility: visible; } .opt.on .k > span { font-weight: 600; }
.radio-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; }
.radio-row.on { background: var(--card2); border-color: var(--accent); }
.radio-row .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--dim); flex: none; }
.radio-row.on .dot { border: 5px solid var(--accent); }
.radio-row b { display: block; font-size: 15px; } .radio-row small { color: var(--muted); font-size: 12px; }
.gradient { height: 8px; border-radius: 4px; margin-top: 8px; }
.code { font: 700 26px var(--f-title); color: var(--accent); }
.list-item { background: var(--card2); border-radius: var(--r-sm); padding: 11px 12px; font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--text); color: var(--dark); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 2000; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 481px) { #app { box-shadow: 0 0 0 1px var(--line); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
