:root { color-scheme: dark; --bg: #121212; --card: #1e1e1e; --line: #2a2a2a; --text: #f2f2f2; --dim: #a7a7a7; --accent: #1ed760; }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); }
.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; text-align: center; }
.card { background: var(--card); border-radius: 16px; padding: 28px 24px; max-width: 380px; width: 100%; }
.card h1 { margin-top: 0; }
.primary { background: var(--accent); color: #000; border: 0; border-radius: 999px; padding: 14px 28px; font-weight: 700; width: 100%; }
.secondary { background: transparent; color: var(--text); border: 1px solid #555; border-radius: 999px; padding: 10px 20px; }
input { font: inherit; width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
input:focus { outline: 2px solid var(--accent); border-color: transparent; }

#app { max-width: 640px; margin: 0 auto; padding-bottom: 40px; }
.now { position: sticky; top: 0; z-index: 2; display: flex; gap: 14px; align-items: center; padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); background: linear-gradient(#1f3a2a, var(--bg)); }
.now img { width: 64px; height: 64px; border-radius: 8px; background: var(--card); object-fit: cover; flex: none; }
.now img:not([src]) { visibility: hidden; }
.now-text { min-width: 0; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.title { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { padding: 8px 16px 4px; }

h2 { font-size: 15px; color: var(--dim); margin: 22px 16px 6px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 60px; }
.row img, .row .ph { width: 48px; height: 48px; border-radius: 6px; flex: none; object-fit: cover; background: var(--card); }
.row .text { flex: 1; min-width: 0; }
.row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; }
.row.link { width: 100%; background: none; border: 0; color: inherit; text-align: left; }
.row.link:active { background: var(--card); }
.add { flex: none; min-width: 84px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 700; }
.add:disabled { border-color: transparent; color: var(--dim); }
.back { margin: 12px 16px 0; }
.empty { color: var(--dim); padding: 16px; }

#toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: #f2f2f2; color: #000; padding: 12px 18px; border-radius: 12px; font-weight: 600; pointer-events: none; max-width: 90vw; text-align: center; z-index: 5; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Admin page */
.admin .wrap { max-width: 560px; margin: 0 auto; padding: 16px; }
.admin .card { max-width: none; margin-bottom: 16px; }
.admin .card h2 { margin: 0 0 8px; color: var(--text); font-size: 18px; }
.admin form { display: grid; gap: 12px; }
.btn { display: inline-block; text-align: center; text-decoration: none; width: auto; }
.hint, .msg { color: var(--dim); font-size: 14px; }
.qr-card { text-align: center; }
#qr svg { width: 100%; max-width: 420px; height: auto; background: #fff; border-radius: 12px; }
.url { word-break: break-all; font-size: 14px; color: var(--dim); }
.row-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.row-controls input { width: 80px; padding: 8px 10px; }
.row-controls .primary { width: auto; }
.print-title { display: none; }
@media print {
  html, body { background: #fff; color: #000; }
  .noprint { display: none !important; }
  .admin .card { background: none; padding: 0; }
  .print-title { display: block; font-size: 32px !important; color: #000 !important; margin: 40px 0 20px !important; }
  #qr svg { max-width: 14cm; }
  .url { color: #000; font-size: 12pt; }
}
