/* Backstage — Kentish Players members portal */

:root {
  --purple: #4c3f8e;
  --purple-dark: #3a2f72;
  --lilac: #7b6cc0;
  --lilac-soft: #ece8f8;
  --stage: #140f24;
  --stage-2: #1f1838;
  --magenta: #b4307f;
  --gold: #f2c14e;
  --ink: #231d3d;
  --muted: #6b6585;
  --line: #e2ddf0;
  --paper: #f7f5fc;
  --card: #ffffff;
  --success: #1f8a5b;
  --success-soft: #e3f5ec;
  --danger: #c0392b;
  --danger-soft: #fbe9e7;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(35, 29, 61, 0.08);
  --accent: #4c3f8e;
  --accent-strong: #3a2f72;
  --field-bg: #ffffff;
  --muted-bg: #eeedf2;
  --success-ink: #145c3d;
  --danger-ink: #8e2a20;
  --warn-ink: #7a4f10;
  --tabbar-bg: rgba(255, 255, 255, 0.96);
  --tile-subs-bg: #efe9ff; --tile-subs-ink: #5a49a8;
  --tile-show-bg: #fde8f3; --tile-show-ink: #b4307f;
  --tile-other-bg: #fff4d9; --tile-other-ink: #a87612;
  color-scheme: light;
  --font: 'Raleway', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ---------- Dark mode: follows the device unless the member picks one in Settings ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #c4b8ff;
    --accent-strong: #ddd5ff;
    --lilac-soft: #2b2450;
    --ink: #ece9f7;
    --muted: #a49cc4;
    --line: #2f2849;
    --paper: #0f0b1c;
    --card: #1a1430;
    --field-bg: #120e22;
    --muted-bg: #2a2440;
    --success-soft: #11301f; --success-ink: #8fe0b4;
    --danger-soft: #3a1714; --danger-ink: #ffaba0;
    --warn-soft: #3a2a0e; --warn-ink: #f6cf85;
    --tabbar-bg: rgba(26, 20, 48, 0.96);
    --tile-subs-bg: #2b2450; --tile-subs-ink: #c4b8ff;
    --tile-show-bg: #3a1530; --tile-show-ink: #ff9fd4;
    --tile-other-bg: #3a2a0e; --tile-other-ink: #f6cf85;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #c4b8ff;
  --accent-strong: #ddd5ff;
  --lilac-soft: #2b2450;
  --ink: #ece9f7;
  --muted: #a49cc4;
  --line: #2f2849;
  --paper: #0f0b1c;
  --card: #1a1430;
  --field-bg: #120e22;
  --muted-bg: #2a2440;
  --success-soft: #11301f; --success-ink: #8fe0b4;
  --danger-soft: #3a1714; --danger-ink: #ffaba0;
  --warn-soft: #3a2a0e; --warn-ink: #f6cf85;
  --tabbar-bg: rgba(26, 20, 48, 0.96);
  --tile-subs-bg: #2b2450; --tile-subs-ink: #c4b8ff;
  --tile-show-bg: #3a1530; --tile-show-ink: #ff9fd4;
  --tile-other-bg: #3a2a0e; --tile-other-ink: #f6cf85;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  font-size: 16px;
  font-variant-numeric: lining-nums; /* Raleway's default numbers dip below the line */
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-weight: 800; letter-spacing: -0.02em; font-size: clamp(1.6rem, 4vw, 2.1rem); }
h2 { font-weight: 700; font-size: 1.15rem; }
h3 { font-weight: 600; font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 0.75em 1.4em; border-radius: 999px; border: 2px solid var(--purple);
  background: var(--purple); color: #fff; cursor: pointer; text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--purple-dark); border-color: var(--purple-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--lilac-soft); color: var(--accent-strong); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--stage); }
.btn-gold:hover { background: #e6b23a; border-color: #e6b23a; color: var(--stage); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-small { padding: 0.4em 0.9em; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35em; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date],
input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 0.7em 0.9em; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--field-bg); color: var(--ink);
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 3px solid rgba(123, 108, 192, 0.45); outline-offset: 1px; border-color: var(--lilac);
}
.field { margin-bottom: 1.1em; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.3em; }
.check { display: flex; gap: 0.6em; align-items: center; font-weight: 500; }
.check input { width: 1.15em; height: 1.15em; accent-color: var(--purple); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1em; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1em; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.code-input { font-size: 1.8rem !important; letter-spacing: 0.5em; text-align: center; font-weight: 600; }

/* ---------- Alerts ---------- */

.alert { padding: 0.85em 1.1em; border-radius: 10px; margin-bottom: 1.2em; font-size: 0.95rem; border-left: 4px solid; }
.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--success-ink); }
.alert-error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-ink); }
.alert-info { background: var(--lilac-soft); border-color: var(--lilac); color: var(--accent-strong); }

/* ---------- The stage (sign-in pages) ---------- */

.stage-body {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(180, 48, 127, 0.35), transparent 70%),
    radial-gradient(ellipse 40% 60% at 15% 100%, rgba(123, 108, 192, 0.25), transparent 70%),
    radial-gradient(ellipse 40% 60% at 85% 100%, rgba(123, 108, 192, 0.25), transparent 70%),
    var(--stage);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px; position: relative; overflow-x: hidden;
}
/* Curtain swags at the top */
.stage-body::before {
  content: ''; position: fixed; inset: 0 0 auto 0; height: 46px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle at 50% -20px, #6b1a4f 0 44px, transparent 45px) 0 0 / 90px 46px repeat-x;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}
.spotlight {
  position: fixed; top: -10vh; width: 38vw; max-width: 420px; height: 120vh; pointer-events: none; z-index: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 85%);
  clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
  animation: sway 9s ease-in-out infinite alternate;
}
.spotlight.left { left: 0; transform-origin: top center; transform: rotate(-18deg); }
.spotlight.right { right: 0; transform-origin: top center; transform: rotate(18deg); animation-delay: -4s; }
@keyframes sway {
  from { rotate: -6deg; }
  to { rotate: 6deg; }
}
@media (prefers-reduced-motion: reduce) { .spotlight { animation: none; } }

.stage-brand { text-align: center; margin-bottom: 24px; position: relative; z-index: 1; }
.stage-brand .wordmark { font-family: 'Montserrat', var(--font); font-weight: 300; letter-spacing: 0.32em; font-size: clamp(1.5rem, 6vw, 2.4rem); margin: 12px 0 0; padding-left: 0.32em; }
.stage-logo { display: block; margin: 0 auto 10px; width: clamp(130px, 34vw, 170px); height: auto; }
.stage-brand .sub { letter-spacing: 0.5em; font-size: 0.8rem; color: var(--gold); font-weight: 600; padding-left: 0.5em; }
.stage-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px;
  background: var(--card); color: var(--ink); border-radius: 20px; padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.stage-card h1 { font-weight: 600; font-size: 1.5rem; letter-spacing: 0; color: var(--accent); }
.stage-card .lead { color: var(--muted); }
.stage-foot { position: relative; z-index: 1; margin-top: 24px; font-size: 0.8rem; color: rgba(255, 255, 255, 0.55); text-align: center; }
.stage-foot a { color: rgba(255, 255, 255, 0.8); }
.stage-links { display: flex; justify-content: space-between; gap: 1em; margin-top: 1em; font-size: 0.9rem; flex-wrap: wrap; }

/* ---------- App shell: sidebar on desktop, tab bar on phones ---------- */

body.app { background: var(--paper); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 20; display: flex; flex-direction: column;
  padding: 22px 16px 16px; color: #fff;
  background:
    radial-gradient(ellipse 120% 40% at 0% 0%, rgba(180, 48, 127, 0.35), transparent 70%),
    radial-gradient(ellipse 100% 35% at 100% 100%, rgba(123, 108, 192, 0.3), transparent 70%),
    var(--stage);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 0 8px 22px; }
.sidebar-brand:hover { color: #fff; }
.sidebar-brand span { font-family: 'Montserrat', var(--font); font-weight: 300; letter-spacing: 0.2em; font-size: 0.82rem; line-height: 1.25; }
.sidebar-brand small { display: block; color: var(--gold); font-weight: 600; letter-spacing: 0.42em; font-size: 0.62rem; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: rgba(255, 255, 255, 0.7); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}
.side-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.side-nav a.active { background: rgba(255, 255, 255, 0.12); color: #fff; }
.side-nav a.active::before {
  content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--gold); box-shadow: 0 0 14px var(--gold);
}
.side-nav a.active .icon { color: var(--gold); }
.side-label { margin: 22px 14px 6px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(255, 255, 255, 0.4); font-weight: 700; }
.side-badge {
  margin-left: auto; font-style: normal; font-size: 0.72rem; font-weight: 800; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--gold); color: var(--stage); display: inline-flex; align-items: center; justify-content: center;
}
.side-user { display: flex; align-items: center; gap: 8px; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.side-user form { margin: 0; }
.side-user-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; text-decoration: none; }
.side-user-link:hover { color: #fff; }
.side-user-link span { min-width: 0; }
.side-user-link strong { display: block; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-link small { display: block; color: var(--gold); font-size: 0.75rem; font-weight: 600; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: rgba(255, 255, 255, 0.7); cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.icon { flex-shrink: 0; }

.main { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; }
.page { width: 100%; max-width: 1080px; margin: 0 auto; padding: 36px 36px 48px; flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.72rem; font-weight: 800; color: var(--magenta); margin-bottom: 6px; }

.mobile-top, .tabbar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 76px; }
  .page { padding: 20px 16px 32px; }
  .mobile-top {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    padding: 10px 12px 10px 16px; background: var(--stage); color: #fff;
  }
  .mobile-top form { margin: 0; }
  .mobile-top .sidebar-brand { padding: 0; }
  .mobile-top .sidebar-brand span { letter-spacing: 0.32em; font-size: 0.8rem; color: var(--gold); font-weight: 600; }
  .tabbar {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--tabbar-bg);
    backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
    color: var(--muted); text-decoration: none; font-size: 0.68rem; font-weight: 700; border-radius: 12px;
  }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.active .icon { background: var(--lilac-soft); border-radius: 10px; padding: 3px 10px; box-sizing: content-box; }
  .tabbar .side-badge { position: absolute; top: 0; right: calc(50% - 26px); margin: 0; height: 18px; min-width: 18px; font-size: 0.65rem; }
}

/* ---------- Cards & stats ---------- */

.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 1.05rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.grid-cards { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-cards > .card { margin-bottom: 0; }
@media (max-width: 760px) { .grid-cards { grid-template-columns: 1fr; } }

.balance-card {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 26px; display: flex; flex-direction: column; gap: 6px;
  background:
    radial-gradient(circle at 100% 0%, rgba(242, 193, 78, 0.35), transparent 45%),
    linear-gradient(135deg, #5a49a8 0%, #4c3f8e 45%, #9b2f78 100%);
  box-shadow: 0 18px 40px rgba(76, 63, 142, 0.35);
}
.balance-card.all-square { background: radial-gradient(circle at 100% 0%, rgba(242, 193, 78, 0.35), transparent 45%), linear-gradient(135deg, #1f8a5b, #2a6f8f); box-shadow: 0 18px 40px rgba(31, 138, 91, 0.3); }
.balance-card .label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; }
.balance-card .amount { font-size: clamp(2.2rem, 6vw, 3rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.balance-card .note { opacity: 0.85; font-size: 0.92rem; }
.balance-card .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.balance-card .chip { background: rgba(255, 255, 255, 0.16); border-radius: 999px; padding: 5px 12px; font-size: 0.8rem; font-weight: 700; }
.balance-card .btn { align-self: flex-start; margin-top: 14px; }
.balance-card .deco { position: absolute; right: -10px; bottom: -18px; font-size: 7rem; opacity: 0.12; transform: rotate(-12deg); pointer-events: none; }

.membership-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.membership-card .who h3 { margin: 0; font-size: 1.1rem; }
.facts { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.facts li { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--muted); }
.facts li strong { color: var(--ink); font-weight: 700; }
.facts .icon { color: var(--lilac); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat .stat-icon { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--lilac-soft); color: var(--accent); flex-shrink: 0; }
.stat .label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.stat .note { font-size: 0.8rem; color: var(--muted); }
.stat.good .stat-icon { background: var(--success-soft); color: var(--success); }
.stat.owing .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat.overdue .stat-icon { background: var(--danger-soft); color: var(--danger); }

/* List rows: charges, payments, people */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .tile { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--lilac-soft); color: var(--accent); }
.list-item .tile.subs { background: var(--tile-subs-bg); color: var(--tile-subs-ink); }
.list-item .tile.show_fee { background: var(--tile-show-bg); color: var(--tile-show-ink); }
.list-item .tile.other { background: var(--tile-other-bg); color: var(--tile-other-ink); }
.list-item .tile.paid { background: var(--success-soft); color: var(--success); }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; }
.list-item .meta { font-size: 0.84rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-item .end { text-align: right; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.list-item .money { font-weight: 800; font-size: 1.02rem; white-space: nowrap; }
.list-item.cancelled .title, .list-item.cancelled .money { text-decoration: line-through; color: var(--muted); }
a.list-item { color: inherit; text-decoration: none; border-radius: 14px; padding-left: 10px; padding-right: 10px; margin: 0 -10px; }
a.list-item:hover { background: var(--paper); color: inherit; }
a.list-item .chev { color: var(--line); }
a.list-item:hover .chev { color: var(--accent); }
@media (max-width: 560px) {
  .list-item { flex-wrap: wrap; }
  .list-item .end { width: 100%; justify-content: space-between; padding-left: 58px; }
  a.list-item .end { width: auto; padding-left: 0; }
  .hide-sm { display: none !important; }
}


.hero {
  border-radius: 24px; padding: 28px; color: #fff; margin-bottom: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 50% 90% at 85% 0%, rgba(180, 48, 127, 0.55), transparent 70%),
    radial-gradient(ellipse 40% 90% at 10% 100%, rgba(123, 108, 192, 0.45), transparent 70%),
    var(--stage);
}
.hero h1 { margin-bottom: 4px; }
.hero p { color: rgba(255, 255, 255, 0.78); margin: 0; }

.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.3em 0.75em; border-radius: 999px; background: var(--lilac-soft); color: var(--accent-strong); white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge-gold { background: var(--gold); color: var(--stage); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.cancelled td { color: var(--muted); text-decoration: line-through; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--paper); }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .big { font-size: 2.2rem; display: block; margin-bottom: 6px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 6px 14px; border-radius: 999px; text-decoration: none; font-size: 0.85rem; font-weight: 600; background: var(--card); border: 1.5px solid var(--line); color: var(--muted); }
.pill.active, .pill:hover { border-color: var(--purple); color: var(--accent); }

details.panel { background: var(--paper); border-radius: 10px; padding: 0 16px; margin-top: 12px; }
details.panel summary { cursor: pointer; font-weight: 600; padding: 12px 0; color: var(--accent); }
details.panel[open] { padding-bottom: 16px; }

.inline-form { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.member-list { columns: 2 220px; margin: 0 0 1em; padding: 0; list-style: none; }
.member-list li { break-inside: avoid; padding: 4px 0; }

.footer { text-align: center; font-size: 0.8rem; color: var(--muted); padding: 24px 16px 40px; }

/* ---------- Avatars & profiles ---------- */

.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-block; vertical-align: middle; background: var(--lilac-soft); }
.avatar-initials {
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: 0.04em;
  color: #fff; background: linear-gradient(135deg, var(--lilac), var(--purple));
}
.who { display: flex; align-items: center; gap: 12px; }
.who-large { gap: 20px; }
@media (max-width: 520px) { .who-large { flex-direction: column; align-items: flex-start; } }
.nav-profile { display: inline-flex !important; align-items: center; gap: 8px; }
.nav-profile .avatar { box-shadow: 0 0 0 2px var(--gold); }

.hero-with-avatar { padding-right: 140px; min-height: 150px; }
.hero-avatar { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); border-radius: 50%; box-shadow: 0 0 0 4px var(--gold), 0 0 30px rgba(242, 193, 78, 0.45); }
@media (max-width: 560px) {
  .hero-with-avatar { padding-right: 28px; padding-top: 120px; }
  .hero-avatar { top: 24px; left: 28px; right: auto; transform: none; }
}

.headshot { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.headshot > .avatar { box-shadow: 0 0 0 4px var(--gold); }
.upload-btn { position: relative; cursor: pointer; }
.upload-btn:focus-within { outline: 3px solid rgba(123, 108, 192, 0.45); outline-offset: 2px; }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; margin-bottom: 8px; }
.avatar-choice {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px;
  border: 2px solid transparent; cursor: pointer; text-align: center; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  transition: transform 0.15s, border-color 0.15s;
}
.avatar-choice:hover { transform: translateY(-3px) rotate(-3deg); color: var(--accent); }
.avatar-choice:has(input:checked) { border-color: var(--gold); background: var(--card); color: var(--accent); }
.avatar-choice:has(input:focus-visible) { outline: 3px solid rgba(123, 108, 192, 0.45); }
.avatar-choice img { border-radius: 50%; }

.stat-link { text-decoration: none; color: inherit; }
.stat-link:hover { color: inherit; transform: translateY(-2px); }

/* Honeypot for bots */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.search { position: relative; flex: 1; min-width: 220px; display: flex; align-items: center; }
.search .icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 42px; border-radius: 999px; background: var(--paper); border-color: transparent; }
.money.muted { font-weight: 600; font-size: 0.88rem; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; }

/* ---------- Settings ---------- */

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .choice-grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } }
.choice { display: flex; flex-direction: column; gap: 8px; cursor: pointer; border: 2px solid var(--line); border-radius: 16px; padding: 10px; transition: border-color 0.15s; }
.choice:hover { border-color: var(--lilac); }
.choice:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.25); }
.choice:has(input:focus-visible) { outline: 3px solid rgba(123, 108, 192, 0.45); }
.choice-preview { height: 64px; border-radius: 10px; border: 1px solid var(--line); }
.choice-light { background: linear-gradient(90deg, #140f24 0 28%, #f7f5fc 28%); }
.choice-dark { background: linear-gradient(90deg, #140f24 0 28%, #0f0b1c 28%); box-shadow: inset -40px -20px 0 -10px #1a1430; }
.choice-system { background: linear-gradient(135deg, #f7f5fc 50%, #0f0b1c 50%); }
.choice-label { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.86rem; }

.dev-card { border: 2px dashed var(--gold); }
.dev-card h2 span { display: inline-flex; align-items: center; gap: 8px; }
.dev-banner {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 24px; background: repeating-linear-gradient(-45deg, #f2c14e 0 14px, #e9b63c 14px 28px); color: #2a1c05; font-size: 0.9rem;
}
.dev-banner form { margin: 0; }
.dev-banner .dev-switch select { padding: 4px 28px 4px 10px; border-radius: 8px; width: auto; font-size: 0.85rem; background-color: #fff8e6; color: #2a1c05; border-color: #c99a2e; }
.dev-banner .btn-gold { background: #2a1c05; color: #f2c14e; border-color: #2a1c05; }
@media (max-width: 900px) { .dev-banner { top: 56px; padding: 8px 16px; } }
.divider { border: 0; border-top: 1px dashed var(--line); margin: 20px 0 16px; }
.dev-card h3 { display: flex; align-items: center; gap: 8px; }

/* Money and counts line up neatly */
.money, .amount, .stat .value, .balance-card .chip, td.num { font-variant-numeric: lining-nums tabular-nums; }
.role-help { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }

fieldset.segmented { border: 0; padding: 0; margin: 0 0 1.1em; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
fieldset.segmented legend { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35em; padding: 0; }
fieldset.segmented label { margin: 0; cursor: pointer; }
fieldset.segmented input { position: absolute; opacity: 0; }
fieldset.segmented span {
  display: block; text-align: center; padding: 0.7em 0.5em; border-radius: 10px; border: 1.5px solid var(--line);
  font-weight: 600; font-size: 0.9rem; transition: border-color 0.15s, background 0.15s;
}
fieldset.segmented input:checked + span { border-color: var(--accent); background: var(--lilac-soft); color: var(--accent); }
fieldset.segmented input:focus-visible + span { outline: 3px solid rgba(123, 108, 192, 0.45); }

/* ---------- Subs ---------- */
.rates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 14px; }
.money-input { position: relative; }
.money-input span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.money-input input { padding-left: 28px; font-variant-numeric: lining-nums tabular-nums; }
.subs-confirm { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.subs-confirm .field { margin: 0; min-width: 200px; }
.card-head select { width: auto; padding: 6px 32px 6px 12px; border-radius: 999px; }

/* ---------- Payments ---------- */
.card .icon-btn, .list .icon-btn { color: var(--muted); width: 32px; height: 32px; }
.card .icon-btn:hover { background: var(--muted-bg); color: var(--ink); }
.icon-btn-danger:hover { background: var(--danger-soft) !important; color: var(--danger-ink) !important; }
.bank-panel { margin-top: 18px; padding: 18px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.bank-panel h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bank-panel dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 10px; }
.bank-panel dt { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.bank-panel dd { margin: 2px 0 0; font-weight: 700; font-size: 1.05rem; font-variant-numeric: lining-nums tabular-nums; user-select: all; }
.bank-panel .ref dd { color: var(--accent); }
fieldset.segmented span small { display: block; font-weight: 500; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.type-help { margin: -0.4em 0 1.1em; }
.type-help summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
