/* SetBook — single stylesheet */
:root {
  --bg: #0e0d12;
  --bg-2: #16141c;
  --surface: #1c1a24;
  --surface-2: #26232f;
  --border: #322e3d;
  --text: #f3f1f7;
  --muted: #a39fb0;
  --accent: #ff4d6d;
  --accent-2: #ffb347;
  --accent-soft: rgba(255, 77, 109, .14);
  --ok: #3ddc97;
  --warn: #ffcc4d;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --nav-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f4f9; --bg-2: #eeeaf3; --surface: #ffffff; --surface-2: #f1eef6; --border: #e0dbe8;
    --text: #1d1a24; --muted: #6c6779; --accent: #e3264b; --accent-2: #d97706;
    --accent-soft: rgba(227, 38, 75, .1); --warn: #8a5a00; --shadow: 0 6px 24px rgba(40, 20, 60, .1);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); letter-spacing: -.02em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- Layout ---------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--bg-2); border-right: 1px solid var(--border);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; padding: 0 8px 18px; text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--muted); font-weight: 600;
}
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-link svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-spacer { flex: 1; }
main { flex: 1; min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 60px; max-width: 1100px; }

.bottom-nav { display: none; }
@media (max-width: 760px) {
  .sidebar { display: none; }
  main { padding: 18px 16px calc(var(--nav-h) + 90px); }
  .bottom-nav {
    display: flex; position: fixed; z-index: 1000; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  }
  .bottom-nav .nav-link { flex: 1; flex-direction: column; gap: 2px; justify-content: center; font-size: .64rem; padding: 6px 0; border-radius: 0; }
  .bottom-nav .nav-link.active { background: none; }
  .bottom-nav .nav-checkin svg { width: 30px; height: 30px; padding: 5px; background: var(--accent); color: #fff; border-radius: 50%; }
}

/* ---- Components ------------------------------------------------------ */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.sub { color: var(--muted); font-size: .92rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card + .card, .section + .section { margin-top: 16px; }
.section { margin-top: 28px; }
.section > h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border);
  background: var(--surface-2); padding: 9px 16px; border-radius: 999px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: transform .1s, background .15s;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--accent); }
.btn-sm { padding: 5px 11px; font-size: .85rem; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn svg { width: 18px; height: 18px; }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: .82rem; text-decoration: none; color: var(--text);
}
a.chip:hover { border-color: var(--accent); }
.chip-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip-planned { background: rgba(255, 179, 71, .15); color: var(--accent-2); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Forms */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.input, input[type=text], input[type=search], input[type=date], input[type=password], input[type=number], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 100px; resize: vertical; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.field { position: relative; }
.suggest {
  position: absolute; z-index: 50; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 280px; overflow: auto;
}
.suggest button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; cursor: pointer; }
.suggest button:hover, .suggest button:focus, .suggest button.active { background: var(--surface-2); }
.segmented { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.segmented button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.segmented button.on { background: var(--surface-2); color: var(--text); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters input[type=search] { flex: 1 1 220px; width: auto; }
.filters select { width: auto; }

/* Concert list */
.concert-list { display: flex; flex-direction: column; gap: 8px; }
.concert-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; transition: border-color .15s, transform .1s;
}
.concert-item:hover { border-color: var(--accent); }
.date-badge {
  width: 56px; flex-shrink: 0; text-align: center; background: var(--bg-2); border-radius: var(--radius-sm); padding: 6px 0; line-height: 1.1;
}
.date-badge .d { font-size: 1.35rem; font-weight: 800; }
.date-badge .m { font-size: .72rem; text-transform: uppercase; color: var(--accent); font-weight: 700; letter-spacing: .05em; }
.date-badge .y { font-size: .7rem; color: var(--muted); }
.concert-item .info { min-width: 0; flex: 1; }
.concert-item .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.concert-item .meta { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.concert-item .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

/* Hero (concert / artist page) */
.hero {
  position: relative; border-radius: calc(var(--radius) + 4px); overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  min-height: 220px; display: flex; align-items: flex-end;
}
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 25%; opacity: .55; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 10%, var(--surface) 92%); }
.hero-content { position: relative; padding: 22px; width: 100%; }
.hero h1 { margin-bottom: 6px; }
.hero-nav { position: absolute; top: 12px; right: 12px; z-index: 1; display: flex; gap: 6px; }
.hero-nav .btn { background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(6px); }
.hero-nav .btn:hover { background: var(--border); }
.hero-nav .btn[aria-disabled] { opacity: .4; pointer-events: none; }
.hero .row { margin-top: 10px; }
.avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); background: var(--surface-2); }
.avatar-sm { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.initials { display: inline-grid; place-items: center; font-weight: 800; color: var(--muted); background: var(--surface-2); }

/* Setlist */
.setlist { list-style: none; padding: 0; margin: 0; counter-reset: song; }
.setlist li {
  display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); counter-increment: song;
}
.setlist li:last-child { border-bottom: 0; }
.setlist li::before { content: counter(song); width: 26px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.setlist .song { flex: 1; min-width: 0; }
.setlist .song small { color: var(--muted); display: block; font-size: .78rem; }
/* Support acts (concert page) */
.opener { border-top: 1px solid var(--border); padding: 10px 0; }
h2 + .opener { border-top: 0; padding-top: 2px; }
.opener > summary, .opener-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.opener > summary { list-style: none; }
.opener > summary::-webkit-details-marker { display: none; }
.opener > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.opener[open] > summary::before { transform: rotate(90deg); }
.opener-name { font-weight: 700; flex: 1; min-width: 0; }
.opener-name a { text-decoration: none; }
.opener .setlist { margin-top: 6px; }
.set-title { margin: 16px 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); width: 70px; overflow: hidden; flex-shrink: 0; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.play-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer;
  display: grid; place-items: center; flex-shrink: 0; padding: 0;
}
.play-btn:hover { border-color: var(--accent); color: var(--accent); }
.play-btn.playing { background: var(--accent); color: #fff; border-color: var(--accent); }
.play-btn svg { width: 14px; height: 14px; }

/* Members */
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.member { padding: 10px 12px; background: var(--bg-2); border-radius: var(--radius-sm); }
.member .n { font-weight: 700; }
.member .r { font-size: .82rem; color: var(--muted); }
.member.past { opacity: .6; }

/* Deezer tracks */
.tracks { display: flex; flex-direction: column; gap: 6px; }
.track { display: flex; align-items: center; gap: 10px; }
.track img { width: 40px; height: 40px; border-radius: 6px; }
.track .t { flex: 1; min-width: 0; }
.track .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 2px; }
.tl-year { position: relative; margin: 26px 0 12px; font-size: 1.6rem; font-weight: 800; }
.tl-year::before { content: ""; position: absolute; left: -25px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-year small { font-size: .85rem; font-weight: 600; color: var(--muted); margin-left: 8px; }
.tl-item { position: relative; margin-bottom: 8px; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 26px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }

/* Stats */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.kpi .v { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.years-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 18px; overflow-x: auto; }
.years-chart .col { flex: 1 0 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.years-chart .b { width: 100%; max-width: 34px; background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.years-chart .b span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: .72rem; font-weight: 700; }
.years-chart .y { font-size: .7rem; color: var(--muted); }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.rank li:last-child { border: 0; }
.rank a { text-decoration: none; }
.rank a:hover { color: var(--accent); }

/* Map */
.map { height: calc(100vh - 190px); min-height: 380px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); z-index: 0; }
.map-sm { height: 220px; border-radius: var(--radius); overflow: hidden; z-index: 0; }
.leaflet-popup-content { font-family: var(--font); }
.leaflet-popup-content a { color: #e3264b; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(255, 77, 109, .3) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: rgba(255, 77, 109, .85) !important; color: #fff !important; font-weight: 700; }
.pin { width: 18px; height: 18px; border-radius: 50%; background: #ff4d6d; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.pin.planned { background: #ffb347; }
.pin-edit { width: 26px; height: 26px; border-width: 4px; cursor: grab; box-shadow: 0 0 0 6px var(--accent-soft), 0 2px 8px rgba(0,0,0,.5); }

/* Venues */
.venues-layout { display: grid; gap: 16px; grid-template-columns: minmax(260px, 340px) 1fr; align-items: start; }
.venues-list { padding: 6px; max-height: calc(100vh - 220px); overflow: auto; position: sticky; top: 16px; }
.venue-side { min-width: 0; }
.venue-map { height: 52vh; min-height: 320px; margin-bottom: 16px; }
.venue-items { list-style: none; margin: 0; padding: 0; }
.venue-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; background: none; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 9px 10px; cursor: pointer; color: var(--text);
}
.venue-item:hover { background: var(--surface-2); }
.venue-item.active { background: var(--accent-soft); border-color: var(--accent); }
.venue-name { font-weight: 700; }
.venue-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.venue-meta .chip { font-size: .72rem; padding: 1px 8px; }
.geo-results:not(:empty) { margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.geo-results button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 8px 12px; cursor: pointer; font-size: .88rem; color: var(--text); }
.geo-results button:last-child { border-bottom: 0; }
.geo-results button:hover { background: var(--surface-2); }
.warn { color: var(--warn); }
@media (max-width: 900px) {
  .venues-layout { grid-template-columns: 1fr; }
  .venues-list { max-height: 40vh; position: static; }
  .venue-map { height: 45vh; }
}

/* Check-in */
.checkin-hero { text-align: center; padding: 34px 18px; }
.pulse { width: 110px; height: 110px; margin: 0 auto 18px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: #fff; position: relative; border: 0; cursor: pointer; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--accent); animation: pulse 2s infinite; }
.pulse svg { width: 48px; height: 48px; }
@keyframes pulse { from { transform: scale(1); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } }

/* Mini player */
.player {
  position: fixed; z-index: 1100; right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; display: flex; align-items: center; gap: 10px;
}
.player img { width: 44px; height: 44px; border-radius: 6px; }
.player .t { flex: 1; min-width: 0; font-size: .88rem; }
.player .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player progress { width: 100%; height: 3px; accent-color: var(--accent); display: block; margin-top: 4px; }
@media (max-width: 760px) { .player { bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); } }

/* Misc */
.toast-wrap { position: fixed; z-index: 2000; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 600; font-size: .92rem; animation: toast .25s ease-out; }
.toast.error { background: var(--accent); color: #fff; }
@keyframes toast { from { opacity: 0; transform: translateY(-8px); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 40px 0; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; opacity: .4; margin-bottom: 10px; }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255, 204, 77, .12); color: var(--warn); font-size: .9rem; }
.offline-badge { position: fixed; z-index: 1500; top: 10px; right: 10px; background: var(--warn); color: #000; font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.stars { color: var(--accent-2); letter-spacing: 2px; }
.stars-input button { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--border); padding: 0 2px; }
.stars-input button.on { color: var(--accent-2); }
.bio { white-space: pre-line; }
.openers-edit .row { margin-bottom: 6px; }
.openers-edit .row input { flex: 1; }
details summary { cursor: pointer; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
pre { background: var(--bg-2); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-wrap { overflow-x: auto; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); }
.login-card .brand { justify-content: center; font-size: 1.4rem; padding-bottom: 24px; }
.login-card .brand-logo { width: 44px; height: 44px; }

/* Briefing print styles */
@media print {
  .sidebar, .bottom-nav, .player, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; }
}

/* Inline icons in text, bullets and headings (.btn svg, .nav-link svg… rules take precedence) */
:where(.chip, h1, h2, h3, p, a, li, .kpi .v) > svg { width: 1em; height: 1em; vertical-align: -.125em; flex-shrink: 0; }
.kpi .v > svg { width: 1.6rem; height: 1.6rem; }
