/* Staff app. Same look as the broadcaster and the original app's settings
   pages: white page, Geist, a side menu with rounded items, quiet rows. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg: oklch(1 0 0);
  --fg: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --muted: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --border: oklch(0.922 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --live: #22c55e;
  --amber: #f59e0b;
  --radius: 0.625rem;
  --sidebar: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-border: oklch(0.922 0 0);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.145 0 0);
    --fg: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --muted: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --border: oklch(1 0 0 / 10%);
    --destructive: oklch(0.704 0.191 22.216);
    --sidebar: oklch(0.205 0 0);
    --sidebar-accent: oklch(0.269 0 0);
    --sidebar-border: oklch(1 0 0 / 10%);
    color-scheme: dark;
  }
  .logo { filter: invert(1); }
}

html, body { min-height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--destructive); font-size: 13px; }

.link {
  font-size: 12px; text-decoration: underline; text-underline-offset: 3px;
  color: color-mix(in oklch, var(--fg) 50%, transparent); transition: color 0.2s;
}
.link:hover { color: var(--fg); }

/* Top bar */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px;
}
@media (min-width: 640px) { .top { padding: 16px 32px; } }
.logo { height: 18px; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; min-width: 0; }
.who #whoEmail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker {
  height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9999px;
  background: var(--card); color: var(--fg); font-weight: 500;
}

.banner {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 8px; width: calc(100% - 32px); max-width: 26rem;
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid color-mix(in oklch, var(--destructive) 50%, transparent);
  background: color-mix(in oklch, var(--destructive) 10%, var(--bg)); color: var(--destructive);
}
.banner.info { border-color: var(--border); background: var(--card); color: var(--fg); }
.banner span { flex: 1; }

/* Sign-in and empty states */
.center { min-height: calc(100svh - 64px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { width: 100%; max-width: 24rem; display: flex; flex-direction: column; gap: 8px; text-align: center; }
.card h1 { font-size: 20px; font-weight: 600; }

/* Sign-in card (shadcn login-01) */
.login-stack { width: 100%; max-width: 24rem; display: flex; flex-direction: column; gap: 16px; }
.login {
  display: flex; flex-direction: column; gap: 20px; padding: 24px;
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  background: var(--card); box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}
.login-head { display: flex; flex-direction: column; gap: 6px; }
.login-head h1 { font-size: 16px; font-weight: 600; line-height: 1.2; }
.login-head p { font-size: 14px; }
.login form { gap: 0; }
.login form input { margin: 8px 0 20px; }
.login form .primary, .login form .secondary { margin-top: 4px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.link-quiet { font-size: 13px; color: var(--fg); text-underline-offset: 4px; }
.link-quiet:hover { text-decoration: underline; }
.login-back { align-self: center; color: var(--muted); }
.login-note { font-size: 13px; color: var(--muted); }
.wide { width: 100%; }
.login .error, .login-note { margin: -8px 0 0; }

form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
label { font-size: 13px; font-weight: 500; }
input, select.field {
  height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) * 0.8);
  background: transparent; outline: none; width: 100%;
}
input:focus, select.field:focus { border-color: color-mix(in oklch, var(--fg) 40%, transparent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--fg) 10%, transparent); }
.primary {
  height: 36px; padding: 0 16px; border-radius: calc(var(--radius) * 0.8);
  background: var(--fg); color: var(--bg); font-weight: 500; transition: opacity 0.2s;
}
.primary:hover { opacity: 0.85; }
.primary:disabled { opacity: 0.5; cursor: default; }
.secondary {
  height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) * 0.8);
  font-weight: 500; transition: background 0.15s; white-space: nowrap;
}
.secondary:hover { background: var(--accent); }
a.secondary { display: inline-flex; align-items: center; color: var(--fg); text-decoration: none; }
.secondary.danger { color: var(--destructive); }

/* Shell: a shadcn-style sidebar beside an inset content area. On phones the
   sidebar slides in over the page. */
.shell { display: flex; min-height: 100svh; }
.sidebar {
  position: sticky; top: 0; height: 100svh; width: 16rem; flex-shrink: 0;
  display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--sidebar-border);
  transition: transform 0.2s ease;
}
@media (max-width: 767px) {
  .sidebar { position: fixed; z-index: 30; left: 0; transform: translateX(-100%); box-shadow: 0 10px 30px rgb(0 0 0 / 0.15); }
  .shell.open .sidebar { transform: none; }
}
.sb-backdrop { position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / 0.35); }

.sb-header { padding: 12px 8px 4px; display: grid; gap: 10px; }
.sb-logo { height: 16px; margin: 4px 8px 0; }
.sb-switch { position: relative; }
.sb-church, .sb-user {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border-radius: calc(var(--radius) * 0.8);
  text-align: left; min-width: 0;
}
.sb-church { transition: background 0.15s; }
.sb-church.switchable:hover { background: var(--sidebar-accent); }
.sb-church:not(.switchable) { cursor: default; }
.sb-avatar {
  width: 32px; height: 32px; border-radius: calc(var(--radius) * 0.8); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--fg); color: var(--bg); font-weight: 600; font-size: 13px;
}
.sb-avatar.round { border-radius: 9999px; background: var(--sidebar-accent); color: var(--fg); }
.sb-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.sb-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40; padding: 4px;
  border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.2); background: var(--card);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.sb-menu .label { font-size: 12px; color: var(--muted); padding: 6px 8px; }
.sb-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: calc(var(--radius) * 0.6); text-align: left;
}
.sb-menu button:hover { background: var(--accent); }
.sb-menu .sb-avatar { width: 24px; height: 24px; font-size: 11px; }
.sb-menu .check { margin-left: auto; opacity: 0; }
.sb-menu button.on .check { opacity: 1; }

.sb-content { flex: 1; overflow-y: auto; padding: 48px 8px 8px; } /* clear space between the logo and the menu */
.sb-group { padding: 8px 0; }
.sb-label { height: 28px; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 8px; font-size: 12px; font-weight: 500; color: color-mix(in oklch, var(--fg) 70%, transparent); }
.sb-add {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: calc(var(--radius) * 0.6);
  color: var(--muted); transition: background 0.15s, color 0.15s;
}
.sb-add:hover, .sb-add.on { background: var(--sidebar-accent); color: var(--fg); }
.sb-group > .sb-item + .sb-item { margin-top: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: calc(var(--radius) * 0.8);
  color: color-mix(in oklch, var(--fg) 80%, transparent); text-decoration: none; transition: background 0.15s, color 0.15s;
}
.sb-item:hover { color: var(--fg); }
.sb-item.on { color: var(--fg); }
/* Hover is a hint; the selected campus is clearly stronger. */
.sb-item:hover { background: color-mix(in oklch, var(--sidebar-accent) 60%, transparent); }
.sb-item.on { background: var(--sidebar-accent); font-weight: 500; box-shadow: inset 0 0 0 1px var(--sidebar-border); }
.sb-item .sb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-footer { padding: 8px; border-top: 1px solid var(--sidebar-border); }
.sb-footer .sb-user { padding: 0; gap: 4px; }
.sb-account {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 8px; border-radius: calc(var(--radius) * 0.8);
  color: var(--fg); text-decoration: none; transition: background 0.15s;
}
.sb-account:hover, .sb-account.on { background: var(--sidebar-accent); }
.sb-icon {
  width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: calc(var(--radius) * 0.8); color: var(--muted); transition: background 0.15s, color 0.15s;
}
.sb-icon:hover { background: var(--sidebar-accent); color: var(--fg); }

.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon.sm { width: 16px; height: 16px; }

.inset { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inset-header {
  position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 8px;
  padding: 0 16px; background: color-mix(in oklch, var(--bg) 85%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .inset-header { display: none; } } /* the menu button is for phones only */
.content { width: 100%; max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; } /* centred beside the sidebar */
@media (min-width: 768px) { .content { padding: 32px 32px 64px; } }
/* A campus page is short: place it a little above the middle of the screen
   (a third of the spare room above, two thirds below) rather than at the top. */
@media (min-width: 768px) {
  .inset:has(> .content.centered)::before { content: ""; flex: 1; }
  .inset:has(> .content.centered)::after { content: ""; flex: 2; }
  .content.centered { padding-bottom: 48px; }
}

.dot { width: 8px; height: 8px; border-radius: 9999px; background: var(--border); flex-shrink: 0; }
.dot.live { background: var(--live); animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Content */
/* Finish setup: the first page an owner sees until payment is set up */
.setup { max-width: 32rem; margin: 8vh auto 0; }
.setup-card { margin-top: 24px; padding: 24px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); background: var(--card); display: grid; gap: 14px; }
.setup-reminder { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
@media (max-width: 640px) {
  /* Phones: single-purpose screens (sign-in, Welcome) read best centered */
  .login-head { text-align: center; }
  .login-head h1 { font-size: 18px; }
  .setup { margin-top: 4vh; text-align: center; }
  .setup .settings-title { font-size: 24px; }
  .setup .lead { margin-left: auto; margin-right: auto; }
  .setup-card { text-align: left; padding: 20px; }
  .setup-card .row { flex-direction: column; align-items: stretch; }
  .setup-card .row > * { width: 100%; justify-content: center; text-align: center; }
  .settings-title { font-size: 22px; }
}

/* Settings: a page of its own, without the sidebar (shadcn settings layout) */
.shell.settings-mode .sidebar, .shell.settings-mode .sb-backdrop, .shell.settings-mode .inset-header { display: none; }
.shell.settings-mode .content { max-width: 1040px; }
.back {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 0 20px -6px; padding: 4px 8px 4px 4px;
  border-radius: calc(var(--radius) * 0.8); color: var(--muted); text-decoration: none; font-size: 13px; transition: background 0.15s, color 0.15s;
}
.back:hover { background: var(--accent); color: var(--fg); }
.settings-title { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.content .settings-title + .lead { margin: 4px 0 0; }
.settings { display: flex; flex-direction: column; gap: 24px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.settings-nav { display: flex; gap: 4px; overflow-x: auto; }
.settings-nav a {
  padding: 6px 12px; border-radius: calc(var(--radius) * 0.8); color: var(--fg); text-decoration: none; white-space: nowrap; transition: background 0.15s;
}
.settings-nav a:hover { background: var(--accent); }
.settings-nav a.on { background: var(--accent); font-weight: 500; }
.settings-panel { flex: 1; min-width: 0; }
@media (min-width: 768px) {
  .settings { flex-direction: row; gap: 48px; }
  .settings-nav { flex-direction: column; width: 180px; flex-shrink: 0; }
}

.content h2 { font-size: 22px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 12px; }
.content .lead { color: var(--muted); margin-bottom: 28px; }
.content h2.spaced { margin-bottom: 24px; }
.badge { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--live); display: inline-flex; align-items: center; gap: 6px; }
.section { border-top: 1px solid var(--border); padding: 20px 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .section { grid-template-columns: 200px minmax(0, 1fr); gap: 24px; } }
.section > .label { font-weight: 500; }
.section > .label .muted { display: block; font-weight: 400; font-size: 12px; margin-top: 2px; }
.value { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* A part of a section, such as the broadcaster's passcode */
.sub { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px dashed var(--border); }
.sub-label { font-weight: 500; }
.sub-label .muted { display: block; font-weight: 400; font-size: 12px; margin-top: 2px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.url { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.reveal {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius);
  background: color-mix(in oklch, var(--live) 10%, var(--bg)); border: 1px solid color-mix(in oklch, var(--live) 35%, transparent);
}
.reveal .mono { font-size: 18px; letter-spacing: 0.04em; }

/* Usage */
.meter { display: grid; gap: 8px; margin-bottom: 8px; }
.meter .big { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.bar { height: 8px; border-radius: 9999px; background: var(--accent); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 9999px; background: var(--fg); }
.bar > i.over { background: var(--amber); }
.month { display: flex; align-items: center; gap: 4px; }
.month button { width: 32px; height: 32px; border-radius: 9999px; color: var(--muted); }
.month button:hover { background: var(--accent); color: var(--fg); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px 6px 0; }
td { padding: 8px 8px 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.form-grid { display: grid; gap: 10px; max-width: 28rem; }
.form-grid .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* QR dialog */
.backdrop { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 0.4); padding: 16px; }
.dialog {
  position: relative; width: 100%; max-width: 22rem; padding: 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.4);
}
.dialog h2 { font-size: 16px; font-weight: 600; }
.dialog-close { position: absolute; top: 12px; right: 14px; color: var(--muted); }
.qr-image { background: #fff; padding: 12px; border-radius: var(--radius); }
.qr-image img { display: block; width: 240px; height: 240px; image-rendering: pixelated; }

/* Billing */
.plan-price { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.plan-price small { font-size: 14px; font-weight: 400; color: var(--muted); }
.facts { display: grid; gap: 6px; }
/* Billing: a row with its action on the right (plan, each card) */
.split { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-name { font-size: 18px; font-weight: 600; line-height: 32px; }
.card-row { align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.card-row:first-child { padding-top: 0; }
.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 6px; border-radius: 9999px;
  font-size: 11px; font-weight: 500; background: var(--accent); color: var(--fg); vertical-align: 1px;
}
td .pill { margin-left: 0; }
.pill.warn { background: color-mix(in oklch, var(--amber) 20%, transparent); }
button.link { padding: 0; }
.link.danger:hover { color: var(--destructive); }
.facts div { display: flex; align-items: center; gap: 8px; }
.facts .icon { color: var(--live); }
.note {
  padding: 12px 14px; border-radius: var(--radius); background: var(--accent); color: color-mix(in oklch, var(--fg) 80%, transparent);
}
.note.warn { background: color-mix(in oklch, var(--amber) 14%, transparent); color: var(--fg); }

/* Listener QR on the campus page */
.qr-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr-small { width: 112px; height: 112px; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: calc(var(--radius) * 0.8); border: 1px solid var(--border); }
.qr-row .value { flex: 1; min-width: 200px; }
