/* Click — console d'administration
   Tokens : encre violette, papier lavande, rose « like », sarcelle « actif ». */

:root {
  --ink: #1a1633;
  --ink-2: #2a2450;
  --ink-soft: #3b3566;
  --paper: #f4f3f8;
  --card: #ffffff;
  --line: #e3e1ec;
  --text: #1a1633;
  --muted: #6b6785;
  --signal: #ff2e63;
  --signal-soft: #ffe3ea;
  --pulse: #00a89f;
  --pulse-soft: #d9f5f3;
  --amber: #c77d00;
  --amber-soft: #fff1d6;
  --danger: #d1243f;
  --focus: #6b5cff;
  --ticket: #1a1633;
  --ticket-stub: #2a2450;
  --btn-ink-bg: #1a1633;
  --btn-ink-fg: #ffffff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(26, 22, 51, .06), 0 8px 24px -12px rgba(26, 22, 51, .18);
  --f-display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --f-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #110e22;
    --card: #1b1733;
    --line: #2d2850;
    --text: #ecebf5;
    --muted: #a19cc0;
    --signal-soft: #3a1426;
    --pulse: #2ee6d6;
    --pulse-soft: #0f2f33;
    --amber: #ffb547;
    --amber-soft: #36270c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --ticket: #2b2454;
    --ticket-stub: #3b3370;
    --btn-ink-bg: #ecebf5;
    --btn-ink-fg: #15122b;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.55 var(--f-body);
  font-feature-settings: "tnum" 1;
}
a { color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); letter-spacing: 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--ink);
  color: #d9d6ee;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; padding: 0 8px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--signal);
  display: grid; place-items: center;
}
.brand-name { font-family: var(--f-display); font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: #9a95bd; display: block; margin-top: -2px; letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  text-decoration: none; font-weight: 600; font-size: 14px;
  color: #c9c5e3;
}
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--ink-soft); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; }
.nav-cta {
  margin-top: 6px;
  background: var(--signal) !important; color: #fff !important;
}
.nav-cta:hover { filter: brightness(1.06); }
.side-foot { margin-top: auto; font-size: 13px; padding: 0 8px; color: #9a95bd; }
.side-foot form { margin: 6px 0 0; }
.side-foot button {
  background: none; border: 0; padding: 0; color: #d9d6ee; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

.main { padding: 32px clamp(16px, 4vw, 48px) 64px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 {
  font-family: var(--f-display); font-weight: 600; font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: -.02em; margin: 0; line-height: 1.15;
}
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 8px; }
.crumb:hover { color: var(--text); }

/* ---------- Building blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card h2 { font-size: 15px; margin: 0 0 14px; font-weight: 700; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px 22px 0; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13px; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.grid-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: 700 14px/1 var(--f-body); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:hover { filter: brightness(.98); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ink { background: var(--btn-ink-bg); border-color: var(--btn-ink-bg); color: var(--btn-ink-fg); }
.btn-danger { color: var(--danger); }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--paper); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-signal { background: var(--signal); color: #fff; }
.b-active { background: var(--pulse-soft); color: var(--pulse); }
.b-waiting { background: var(--amber-soft); color: var(--amber); }
.b-pending { background: var(--amber-soft); color: var(--amber); }
.b-approved { background: var(--pulse-soft); color: var(--pulse); }
.b-expired, .b-quota, .b-cancelled { background: var(--paper); color: var(--muted); }
.b-admin, .b-rejected { background: var(--signal-soft); color: var(--danger); }

/* Messages flash */
.flash { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; }
.flash li { padding: 12px 16px; border-radius: 11px; font-weight: 600; border: 1px solid var(--line); background: var(--card); }
.flash .success { border-color: transparent; background: var(--pulse-soft); color: var(--pulse); }
.flash .error { border-color: transparent; background: var(--signal-soft); color: var(--danger); }
.flash .warning { border-color: transparent; background: var(--amber-soft); color: var(--amber); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 18px 20px; }
.stat dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat dd { margin: 6px 0 0; font-family: var(--f-display); font-size: 28px; font-weight: 500; letter-spacing: -.02em; }
.stat a { text-decoration: none; }
.stat.hot dd { color: var(--signal); }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 150px; padding: 0 22px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-fill { width: 100%; max-width: 38px; border-radius: 8px 8px 3px 3px; background: var(--ink-soft); min-height: 3px; height: 0; transition: height .5s ease; }
.bar:last-child .bar-fill { background: var(--signal); }
.bar small { font-size: 11px; color: var(--muted); }
.bars-foot { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; padding: 8px 22px 20px; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- Tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 14px 16px; border-bottom: 1px solid var(--line); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--paper) 60%, transparent); }
td a.row-link { font-weight: 700; text-decoration: none; }
td a.row-link:hover { text-decoration: underline; }

.list { list-style: none; margin: 0; padding: 6px 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.list small { color: var(--muted); }

.empty { padding: 38px 22px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 13px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
}
.tabs a[aria-current="page"] { background: var(--btn-ink-bg); border-color: var(--btn-ink-bg); color: var(--btn-ink-fg); }
.tabs .count { opacity: .7; margin-left: 4px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.search { display: flex; gap: 8px; }
.search input { width: min(280px, 60vw); }

.pager { display: flex; gap: 8px; justify-content: center; padding: 16px; font-size: 14px; }

/* Barre d'utilisation */
.meter { height: 8px; border-radius: 999px; background: var(--paper); overflow: hidden; min-width: 90px; }
.meter > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--pulse); transition: width .5s ease; }
.meter.warn > span { background: var(--amber); }
.meter.full > span { background: var(--muted); }
.meter-lg { height: 12px; }
.list .meter { margin-top: 6px; height: 6px; }
.b-deleted { background: var(--paper); color: var(--muted); text-decoration: line-through; }
td.num, th.num { text-align: right; }
.online { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--pulse); white-space: nowrap; }
.online::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px var(--pulse-soft); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Forms ---------- */
label { font-weight: 700; font-size: 13px; display: block; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--card); color: var(--text); font: 15px var(--f-body);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--danger); font-size: 13px; font-weight: 600; }
.form-errors { padding: 12px 16px; border-radius: 11px; background: var(--signal-soft); color: var(--danger); font-weight: 600; margin-bottom: 16px; }
.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.checkbox input { width: 18px; height: 18px; }

details.more { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 14px; }
details.more summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); list-style: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "– "; }
details.more[open] summary { margin-bottom: 14px; }
details.more + .btn { margin-top: 20px; }

/* Sélecteur Durée / Likes */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); padding: 5px; border-radius: 14px; gap: 5px; margin-bottom: 18px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  margin: 0; padding: 12px; border-radius: 10px; text-align: center; cursor: pointer;
  font-size: 15px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px;
}
.segmented input:checked + label { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + label { outline: 3px solid var(--focus); }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  margin: 0; padding: 14px 12px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer;
  background: var(--card); text-align: center; transition: border-color .12s, background .12s;
}
.chips label strong { display: block; font-family: var(--f-display); font-weight: 500; font-size: 16px; letter-spacing: -.01em; }
.chips label small { color: var(--muted); font-weight: 600; }
.chips input:checked + label { border-color: var(--signal); background: var(--signal-soft); }
.chips input:focus-visible + label { outline: 3px solid var(--focus); }
[data-kind-panel][hidden] { display: none; }

/* ---------- Ticket (élément signature) ---------- */
.ticket {
  --notch: 14px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  background: var(--ticket);
  color: #fff;
  border-radius: 18px;
  overflow: hidden;
  -webkit-mask: radial-gradient(circle var(--notch) at calc(100% - 132px) 0, #0000 98%, #000) top / 100% 51% no-repeat,
                radial-gradient(circle var(--notch) at calc(100% - 132px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle var(--notch) at calc(100% - 132px) 0, #0000 98%, #000) top / 100% 51% no-repeat,
                radial-gradient(circle var(--notch) at calc(100% - 132px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
}
.ticket-main { padding: 24px 26px; display: grid; gap: 16px; }
.ticket-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #a8a3cc; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ticket-eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.cred { display: grid; gap: 2px; }
.cred span { font-size: 12px; color: #a8a3cc; font-weight: 600; }
.cred-value { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cred code { font-family: var(--f-mono); font-size: clamp(18px, 2.2vw, 24px); font-weight: 600; letter-spacing: .02em; word-break: break-all; }
.copy {
  border: 1px solid #4a4380; background: transparent; color: #d9d6ee; border-radius: 8px;
  font: 700 12px var(--f-body); padding: 5px 10px; cursor: pointer;
}
.copy:hover { background: var(--ink-2); }
.copy[data-done] { color: var(--pulse); border-color: var(--pulse); }
.ticket-stub {
  border-left: 2px dashed #4a4380;
  background: var(--ticket-stub);
  padding: 24px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px;
}
.stub-value { font-family: var(--f-display); font-weight: 600; font-size: 22px; letter-spacing: -.02em; line-height: 1.1; }
.stub-label { font-size: 11px; color: #a8a3cc; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.ticket-preview .cred code { color: #6f6a99; }

.reveal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.notice { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* ---------- Définitions ---------- */
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; font-size: 14px; }
.defs dt { color: var(--muted); font-weight: 600; }
.defs dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.defs.spaced { margin-top: 18px; }
.stack-gap { margin-bottom: 18px; }
.stack-gap .ticket { max-width: 620px; }

.big-figure { font-family: var(--f-display); font-size: clamp(24px, 2.4vw, 32px); font-weight: 500; letter-spacing: -.02em; line-height: 1; }
.big-figure small { font-family: var(--f-body); font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }

.danger-zone { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }

/* ---------- Pages publiques (connexion, mot de passe) ---------- */
.solo { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.solo-art {
  background: var(--ink);
  color: #fff;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden; position: relative;
}
.solo-art h2 {
  font-family: var(--f-display); font-weight: 600; font-size: clamp(30px, 3.6vw, 52px);
  letter-spacing: -.03em; line-height: 1.05; margin: 0; max-width: 12ch;
}
.solo-art h2 em { font-style: normal; color: var(--signal); }
.solo-art p { color: #a8a3cc; max-width: 40ch; }
.solo-art .ticket { max-width: 420px; transform: rotate(-4deg); margin: 40px 0; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); }
.solo-art .ticket { background: var(--ink-2); }
.solo-art .ticket-stub { background: var(--ink-soft); }
.solo-form { display: grid; place-items: center; padding: 40px 20px; }
.solo-card { width: min(400px, 100%); }
.solo-card h1 { font-family: var(--f-display); font-weight: 600; font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; }
.solo-card > p { color: var(--muted); margin: 0 0 26px; }
.solo-links { margin-top: 18px; font-size: 14px; text-align: center; }
.public-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.public-card { width: min(440px, 100%); }
.public-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-family: var(--f-display); font-weight: 600; font-size: 18px; }

/* ---------- Mobile ---------- */
.menu-toggle { display: none; }
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 14px 16px; gap: 0; }
  .side-top { display: flex; justify-content: space-between; align-items: center; }
  .menu-toggle {
    display: inline-flex; background: var(--ink-2); color: #fff; border: 0; border-radius: 10px;
    padding: 9px 14px; font: 700 14px var(--f-body); cursor: pointer;
  }
  .side .nav, .side .side-foot { display: none; }
  .side[data-open] .nav, .side[data-open] .side-foot { display: flex; }
  .side[data-open] .nav { margin-top: 14px; }
  .side[data-open] .side-foot { flex-direction: column; margin-top: 14px; }
  .main { padding: 22px 16px 48px; }
  .solo { grid-template-columns: 1fr; }
  .solo-art { padding: 28px 20px; }
  .solo-art .ticket, .solo-art p { display: none; }
  .solo-art h2 { font-size: 28px; }
  .field-row { grid-template-columns: 1fr; }
  .ticket { grid-template-columns: minmax(0, 1fr) 96px;
    -webkit-mask: radial-gradient(circle var(--notch) at calc(100% - 96px) 0, #0000 98%, #000) top / 100% 51% no-repeat,
                  radial-gradient(circle var(--notch) at calc(100% - 96px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
            mask: radial-gradient(circle var(--notch) at calc(100% - 96px) 0, #0000 98%, #000) top / 100% 51% no-repeat,
                  radial-gradient(circle var(--notch) at calc(100% - 96px) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat; }
  .ticket-main { padding: 20px; }
  .stub-value { font-size: 17px; }
  td, th { padding: 12px 10px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
