/* Aghani — admin, sign-in and installer pages. Same tokens as the player (app.css). */

:root {
  --bg: #101010;
  --surface: #181818;
  --surface-2: #202020;
  --surface-3: #2a2a2a;
  --line: #2e2e2e;
  --text: #f4f4f4;
  --muted: #a3a3a3;
  --accent: #a78bfa;
  --accent-ink: #101010;
  --ok: #5ee08a;
  --warn: #f9b54d;
  --bad: #ff6b6b;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 18px 60px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="graphite"]) {
    --bg: #f5f5f3; --surface: #fff; --surface-2: #f0f0ee; --surface-3: #e6e6e3; --line: #dcdcd8;
    --text: #141414; --muted: #5c5c5c; --accent: #4f7d00; --accent-ink: #fff; color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 20px; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 14px; }
h3 { font-size: 14px; margin: 22px 0 8px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.break { word-break: break-all; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 10; }
.skip:focus { left: 8px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); margin-bottom: 24px; }
.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.01em; }
.brand span { display: block; color: var(--muted); font-size: 13px; }
.brand--small { margin: 0; gap: 10px; }
.brand--small strong { font-size: 15px; }
.brand--small .pill { margin-left: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: 600 14px var(--font); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }

/* Forms */
.form { display: grid; gap: 14px; }
.form--wide { max-width: 760px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.check { display: flex; align-items: flex-start; gap: 10px; color: var(--text); font-weight: 500; font-size: 14px; flex-wrap: wrap; }
label.check .hint { flex-basis: 100%; padding-left: 28px; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: 15px var(--font);
}
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
input[type="file"] { padding: 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input:disabled { opacity: .6; }
.hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }

/* Alerts */
.alert { border-radius: var(--radius); padding: 12px 14px; margin: 0 0 18px; border: 1px solid; }
.alert p { margin: 0; }
.alert p + p { margin-top: 4px; }
.alert-error { border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.alert-success { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }

/* Checklists */
.checklist { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.checklist li { position: relative; padding-left: 26px; display: grid; gap: 2px; }
.checklist li span { color: var(--muted); font-size: 13px; word-break: break-word; }
.checklist li::before { position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--bg); }
.checklist .ok::before { content: "✓"; background: var(--ok); }
.checklist .warn::before { content: "!"; background: var(--warn); }
.checklist .bad::before { content: "✕"; background: var(--bad); }

/* Sign-in / installer — base card (the animated glass look is at the end of this file) */
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.auth-card--wide { max-width: 560px; }
.auth-card h1 { font-size: 24px; margin-bottom: 8px; }
.auth-card > .muted { margin-bottom: 20px; }

/* Admin shell */
.admin-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.admin-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.admin-nav a { color: var(--muted); padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.admin-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.admin-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.admin-me { display: flex; gap: 4px; }
.admin-me form { margin: 0; }
.admin-main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 700; }
.pill--owner { background: var(--accent); color: var(--accent-ink); }
.pill--admin { background: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); color: var(--text); }
.pill--bad { background: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card h2 + .muted { margin-top: -6px; }
.danger-title { color: var(--bad); margin-top: 28px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2--wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat strong { display: block; font-size: 26px; letter-spacing: -.02em; margin-top: 2px; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { margin: 0; display: inline; }
.table a { color: var(--text); }

.activity { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; font-size: 14px; }
.activity .mono { color: var(--muted); font-size: 12px; }
.list { padding-left: 18px; margin: 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.log { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; overflow: auto; max-height: 420px; font: 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-all; margin: 0; }
.scope { margin-bottom: 20px; }
.scope label { min-width: 280px; }
.scan-status { color: var(--muted); font-size: 13px; min-height: 20px; margin-bottom: 10px; }
.scan-status progress { width: 100%; height: 6px; accent-color: var(--accent); }

@media (max-width: 860px) {
  .grid-2, .grid-2--wide-left { grid-template-columns: 1fr; }
  .admin-top { padding: 10px 16px; gap: 10px; }
  .admin-nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .admin-nav a { white-space: nowrap; }
  .admin-me { margin-left: auto; }
  .admin-main { padding: 20px 16px 48px; }
  .auth-card { padding: 24px; }
  h1 { font-size: 24px; }
}


/* Small centred note under a sign-in form, with breathing room above it. */
.auth-note { text-align: center; margin: 16px 0 0; }

/* ───────────────── Animated glass sign-in (sign-in, error and installer pages) ───────────────── */
.auth-page {
  /* Always the night look, whatever the system theme. */
  --bg: #0b0a17; --text: #f5f3ff; --muted: rgba(235, 230, 255, .66); --line: rgba(255, 255, 255, .14);
  --surface: rgba(255, 255, 255, .06); --surface-2: rgba(255, 255, 255, .07); --surface-3: rgba(255, 255, 255, .12);
  --accent: #a78bfa; --accent-ink: #fff; --violet: #7c3aed; --blue: #2563eb; --pink: #db2777;
  color-scheme: dark; color: var(--text);
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(900px 600px at 50% 120%, #1e1240 0%, transparent 70%), var(--bg);
  position: relative; overflow-x: hidden;
}

/* Background: three drifting glowing orbs and music notes floating up. */
.auth-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform; }
.orb-a { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: var(--violet); animation: orb-a 22s ease-in-out infinite alternate; }
.orb-b { width: 40vmax; height: 40vmax; right: -14vmax; bottom: -16vmax; background: var(--blue); animation: orb-b 26s ease-in-out infinite alternate; }
.orb-c { width: 26vmax; height: 26vmax; left: 55%; top: 8%; background: var(--pink); opacity: .32; animation: orb-c 19s ease-in-out infinite alternate; }
@keyframes orb-a { to { transform: translate(14vmax, 10vmax) scale(1.12); } }
@keyframes orb-b { to { transform: translate(-12vmax, -9vmax) scale(1.08); } }
@keyframes orb-c { to { transform: translate(-22vmax, 30vmax) scale(.85); } }

.notes span {
  position: absolute; bottom: -60px; color: rgba(255, 255, 255, .5); font-size: 26px; line-height: 1;
  text-shadow: 0 0 18px rgba(167, 139, 250, .8); opacity: 0; animation: note-rise 16s linear infinite;
}
.notes span:nth-child(1)  { left: 6%;  font-size: 22px; animation-duration: 15s; animation-delay: 0s; }
.notes span:nth-child(2)  { left: 14%; font-size: 34px; animation-duration: 19s; animation-delay: -6s; }
.notes span:nth-child(3)  { left: 23%; font-size: 20px; animation-duration: 14s; animation-delay: -11s; }
.notes span:nth-child(4)  { left: 31%; font-size: 28px; animation-duration: 21s; animation-delay: -3s; }
.notes span:nth-child(5)  { left: 42%; font-size: 18px; animation-duration: 17s; animation-delay: -14s; }
.notes span:nth-child(6)  { left: 52%; font-size: 30px; animation-duration: 20s; animation-delay: -8s; }
.notes span:nth-child(7)  { left: 61%; font-size: 22px; animation-duration: 16s; animation-delay: -1s; }
.notes span:nth-child(8)  { left: 69%; font-size: 36px; animation-duration: 23s; animation-delay: -12s; }
.notes span:nth-child(9)  { left: 77%; font-size: 20px; animation-duration: 15s; animation-delay: -5s; }
.notes span:nth-child(10) { left: 85%; font-size: 28px; animation-duration: 18s; animation-delay: -9s; }
.notes span:nth-child(11) { left: 92%; font-size: 24px; animation-duration: 22s; animation-delay: -16s; }
.notes span:nth-child(12) { left: 47%; font-size: 40px; animation-duration: 25s; animation-delay: -19s; }
.notes span:nth-child(3n)   { color: rgba(147, 197, 253, .55); text-shadow: 0 0 18px rgba(37, 99, 235, .9); }
.notes span:nth-child(4n+1) { color: rgba(249, 168, 212, .5); text-shadow: 0 0 18px rgba(219, 39, 119, .8); }
@keyframes note-rise {
  0%   { transform: translate(0, 0) rotate(-10deg); opacity: 0; }
  10%  { opacity: .9; }
  50%  { transform: translate(28px, -55vh) rotate(12deg); }
  85%  { opacity: .6; }
  100% { transform: translate(-18px, -112vh) rotate(-8deg); opacity: 0; }
}

/* Frosted glass card. */
.auth-page .auth-card {
  position: relative; z-index: 1; overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 30px 80px rgba(5, 3, 20, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
  border-radius: 24px; padding: 36px 32px 28px;
  animation: card-in .9s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-page .auth-card::before { /* soft light sweep across the glass */
  content: ""; position: absolute; inset: -40% -60% auto auto; width: 70%; height: 120%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .14), transparent); transform: rotate(25deg);
}
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.97); } }

.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-logo { width: 84px; height: 84px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 24px; position: relative; }
.auth-logo::before { content: ""; position: absolute; inset: -10px; border-radius: 32px; z-index: -1;
  background: conic-gradient(from 0deg, var(--violet), var(--blue), var(--pink), var(--violet)); filter: blur(18px); opacity: .7;
  animation: halo 8s linear infinite, pulse 2.4s ease-in-out infinite; }
.auth-logo img { width: 72px; height: 72px; border-radius: 18px; animation: bob 4s ease-in-out infinite; }
@keyframes halo { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes bob { 50% { transform: translateY(-4px); } }

.eq { display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: 22px; margin: 4px 0 14px; }
.eq i { width: 4px; height: 100%; border-radius: 3px; transform-origin: bottom;
  background: linear-gradient(to top, var(--violet), var(--blue)); animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; animation-duration: .9s; }
.eq i:nth-child(3) { animation-delay: -.7s; animation-duration: 1.3s; background: linear-gradient(to top, var(--pink), var(--violet)); }
.eq i:nth-child(4) { animation-delay: -.1s; animation-duration: 1s; }
.eq i:nth-child(5) { animation-delay: -.5s; animation-duration: 1.2s; background: linear-gradient(to top, var(--pink), var(--violet)); }
.eq i:nth-child(6) { animation-delay: -.9s; animation-duration: .8s; }
.eq i:nth-child(7) { animation-delay: -.2s; animation-duration: 1.15s; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }

.auth-hero h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -.02em;
  background: linear-gradient(90deg, #fff, #ddd6fe 60%, #bfdbfe); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { margin: 0; color: var(--muted); font-size: 14px; }
.auth-sub strong { color: var(--text); }

/* Glass inputs with icons. */
.auth-page label { color: var(--muted); }
.auth-page input:not([type="checkbox"]):not([type="file"]), .auth-page select, .auth-page textarea {
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px; min-height: 46px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.auth-page input:focus, .auth-page select:focus, .auth-page textarea:focus {
  background: rgba(255, 255, 255, .11); border-color: rgba(167, 139, 250, .8);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .25), 0 0 24px rgba(124, 58, 237, .25);
}
.field { position: relative; display: block; }
.field svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); pointer-events: none;
  fill: none; stroke: rgba(235, 230, 255, .6); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s; }
.field input { padding-left: 42px; }
.field:focus-within svg { stroke: #c4b5fd; }

/* Gradient button with a shine sweep. */
.auth-page .btn-primary {
  position: relative; overflow: hidden; min-height: 48px; border: 0; border-radius: 12px; color: #fff; font-weight: 650;
  background: linear-gradient(110deg, var(--violet), #6d28d9 40%, var(--blue)); background-size: 200% 100%;
  box-shadow: 0 10px 30px rgba(91, 33, 182, .45); transition: background-position .5s, transform .15s, box-shadow .2s;
}
.auth-page .btn-primary:hover { background-position: 100% 0; filter: none; box-shadow: 0 14px 36px rgba(37, 99, 235, .45); }
.auth-page .btn-primary::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent); transform: skewX(-20deg); }
.auth-page .btn-primary:hover::after { animation: shine .8s ease; }
@keyframes shine { to { left: 130%; } }
.btn-shine { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-shine svg { width: 16px; height: 16px; fill: currentColor; }

.auth-page .alert-error { background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .45); }
.auth-page .brand { position: relative; }
.auth-page .auth-note { color: var(--muted); }

@media (max-width: 480px) {
  .auth-page .auth-card { padding: 28px 20px 22px; border-radius: 20px; }
  .orb { filter: blur(50px); }
  .notes span:nth-child(n+9) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .orb, .notes span, .auth-logo::before, .auth-logo img, .eq i, .auth-page .auth-card { animation: none !important; }
  .notes span { opacity: .25; bottom: auto; }
  .notes span:nth-child(odd) { top: 18%; } .notes span:nth-child(even) { top: 72%; }
  .eq i:nth-child(odd) { transform: scaleY(.6); } .eq i:nth-child(even) { transform: scaleY(.35); }
}

/* Privacy / Support pages (public, linked from the App Store listing). */
.legal { max-width: 720px; text-align: left; }
.legal h1 { font-size: 30px; margin: 0 0 6px; }
.legal h2 { font-size: 18px; margin: 26px 0 8px; }
.legal h3 { font-size: 15px; margin: 18px 0 4px; }
.legal p, .legal li { line-height: 1.6; color: var(--text); }
.legal ul, .legal ol { padding-left: 20px; margin: 0; display: grid; gap: 6px; }
.legal a { color: #c4b5fd; }
.legal .brand { text-decoration: none; }
.legal-links { margin-top: 28px; text-align: center; color: var(--muted); }
.auth-links { text-align: center; margin: 10px 0 0; font-size: 13px; }
.auth-links a { color: var(--muted); }
