/* Yapson Liens — identité framboise sur gris neutres, thèmes clair et sombre. */
/* Couleurs : thème clair par défaut, thème sombre automatique ou choisi. */
:root {
  --bg: #f7f6f5;
  --panel: #ffffff;
  --panel-2: #f1efed;
  --line: #e4e1de;
  --field: #ffffff;
  --text: #1d1a19;
  --muted: #6e6865;
  --accent: #d6195f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(214, 25, 95, .09);
  --link: #c0124f;
  --coral: #f2803a;
  --red: #c62828;
  --red-soft: rgba(198, 40, 40, .10);
  --green: #16834f;
  --green-soft: rgba(22, 131, 79, .11);
  --orange: #b25f00;
  --orange-soft: rgba(178, 95, 0, .11);
  --header: rgba(247, 246, 245, .88);
  --shadow: 0 1px 2px rgba(29, 26, 25, .05), 0 4px 16px rgba(29, 26, 25, .05);
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141414;
  --panel: #1e1d1d;
  --panel-2: #272525;
  --line: #353232;
  --field: #171616;
  --text: #f4f1f0;
  --muted: #a8a19e;
  --accent: #ff3d84;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 61, 132, .13);
  --link: #ff7aa9;
  --coral: #ffa05c;
  --red: #ff7676;
  --red-soft: rgba(255, 118, 118, .13);
  --green: #4cd38c;
  --green-soft: rgba(76, 211, 140, .13);
  --orange: #ffb057;
  --orange-soft: rgba(255, 176, 87, .13);
  --header: rgba(20, 20, 20, .88);
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; color: var(--muted); font-weight: 600; margin-top: 1.2em; }
.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 5; background: var(--header); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 6px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.05rem; text-decoration: none !important; }
.brand b { color: var(--accent); }
.logo { width: 30px; height: 30px; }
.nav { color: var(--muted); padding: 6px 10px; border-radius: 10px; font: inherit; font-size: .9rem; }
.nav:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.linklike { background: none; border: 0; cursor: pointer; }
.top form { margin: 0; }
main { padding-top: 18px; min-height: 70vh; }
footer { color: var(--muted); font-size: .8rem; padding-top: 36px; padding-bottom: 28px; text-align: center; }

/* Blocs */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 40px auto; }
.card.done { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--panel)); }
.hero { text-align: center; padding: 70px 0 40px; }
.hero h1 { font-size: 1.9rem; }
.hero.small h1 { font-size: 1.5rem; }
.flash { border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.err { background: var(--red-soft); color: var(--red); }

/* Formulaires */
.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
input, select { width: 100%; font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; min-width: 0; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); }
details { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
details[open] { display: grid; gap: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.prefix { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--field); }
.prefix span { padding: 11px 0 11px 12px; color: var(--muted); white-space: nowrap; font-size: .85rem; align-self: center; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.prefix input { border: 0; border-radius: 0; padding-left: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 650; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px; padding: 11px 18px; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn.small { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red); margin-top: 14px; }
.btn.copied { background: var(--green); color: #fff; }
.copyrow { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.copyrow input { flex: 1 1 220px; }
.big { font-size: 1.05rem; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; overflow-x: auto; font-size: .8rem; }
code { font-family: var(--mono); font-size: .85em; color: var(--coral); }
.doc { padding-left: 18px; color: var(--muted); }
.doc li { margin-bottom: 6px; }

/* Totaux */
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stats3 div { box-shadow: var(--shadow); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 2px; }
.stats3 b { color: var(--accent); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stats3 span { color: var(--muted); font-size: .8rem; }

/* Liste des liens */
.search input { margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.tab { padding: 6px 12px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); font-size: .85rem; }
.tab.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.on:hover { color: var(--accent-ink); }
.link { box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.link.new { border-color: var(--accent); }
.link-main { flex: 1; min-width: 0; }
.short { font-weight: 650; font-size: 1rem; word-break: break-all; }
.title { font-size: .9rem; }
.dest { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .dest { white-space: normal; word-break: break-all; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .78rem; margin-top: 4px; }
.link-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.clicks { display: grid; text-align: right; color: var(--text); line-height: 1.1; }
.clicks b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.clicks span { color: var(--muted); font-size: .75rem; }
.empty { text-align: center; padding: 30px 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--orange-soft); color: var(--orange); }
.badge.off { background: var(--red-soft); color: var(--red); }

/* Détail */
.head h1 { word-break: break-all; font-size: 1.25rem; }
.chart { width: 100%; height: auto; display: block; margin: 4px 0 6px; }
.chart .bar { fill: var(--accent); }
.chart .bar0 { fill: var(--line); }
.chart text { fill: var(--muted); font-size: 20px; font-family: var(--font); }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: minmax(70px, 40%) 1fr auto; gap: 8px; align-items: center; font-size: .85rem; }
.bars .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--coral)); border-radius: 99px; }
.qrcard { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qrcard .btn { margin: 4px 6px 4px 0; }
.qr { width: 170px; flex: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
.preview { max-width: 560px; margin: 40px auto; text-align: center; }
.preview .dest { font-size: .95rem; color: var(--text); }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .stats3 b { font-size: 1.05rem; }
  .hero { padding-top: 40px; }
  .nav { padding: 6px 7px; font-size: .82rem; }
  .link { align-items: flex-start; }
}

/* Bouton de thème */
.theme { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 10px; width: 36px; height: 34px; display: inline-grid; place-items: center; cursor: pointer; margin-left: 4px; padding: 0; }
.theme:hover { background: var(--panel-2); }
.theme svg { width: 18px; height: 18px; }
.theme .i-sun, .theme .i-moon, .theme .i-auto { display: none; }
:root[data-pref="clair"] .theme .i-sun, :root[data-pref="sombre"] .theme .i-moon, :root[data-pref="auto"] .theme .i-auto { display: block; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; }
