:root {
  color-scheme: dark;
  --ink: #f6f3fa;
  --muted: #c1bdca;
  --quiet: #9893a4;
  --bg: #0a0a0f;
  --surface: #141420;
  --surface-raised: #1a1926;
  --line: #343142;
  --purple: #a855f7;
  --purple-bright: #c084fc;
  --purple-deep: #7e22ce;
  --gold: #d4af37;
  --success: #a9d9b5;
  --danger: #ffb7b7;
  --warning: #ffe0a0;
  --radius: 16px;
  --shadow: 0 18px 60px rgb(0 0 0 / 26%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); scroll-padding-top: 20px; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--bg); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { touch-action: manipulation; }
a { color: var(--purple-bright); text-underline-offset: 3px; }
a:hover { color: #dfc4ff; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
::selection { color: #fff; background: #5b2590; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px max(24px, env(safe-area-inset-left)) 12px max(24px, env(safe-area-inset-right));
  border-bottom: 1px solid #252332;
  background: rgb(10 10 15 / 94%);
}
.brand { display: inline-grid; justify-items: start; gap: 0; min-width: 0; min-height: 48px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
/* Logo 11 (reversed white/gold) at 250px shows a ~224px lockup, above the 220px minimum; its artboard keeps clear space. */
.brand-logo { display: block; width: 250px; max-width: 100%; height: auto; }
/* Indent matches the logo artboard's left padding (189/3600), so the line sits under the K. */
.brand-ministry { margin: -4px 0 0 5.25%; color: #b9a875; font-size: 9px; letter-spacing: .17em; font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.identity { display: grid; text-align: right; line-height: 1.25; }
.identity strong { font-size: 13px; font-weight: 650; }
.identity span { color: var(--quiet); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }

main { width: min(100%, 1050px); margin: 0 auto; padding: 38px 28px 52px; flex: 1; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid #24222f; padding: 18px 28px max(18px, env(safe-area-inset-bottom)); color: #777382; font-size: 9px; letter-spacing: .14em; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 11px; letter-spacing: .17em; line-height: 1.3; font-weight: 700; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 5vw, 3.15rem); letter-spacing: -.035em; line-height: 1.12; }
h2 { margin-bottom: 8px; font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.02em; line-height: 1.22; }
h3 { margin-bottom: 6px; font-size: 1.3rem; line-height: 1.25; }
.lede { max-width: 600px; margin-bottom: 0; color: var(--muted); font-size: 16px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head-copy { min-width: 0; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn {
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--surface-raised);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, opacity .16s ease;
}
.btn:hover:not(:disabled) { border-color: #746b83; background: #242132; }
.btn:active:not(:disabled) { background: #302742; }
.btn:disabled { cursor: wait; opacity: .62; }
.btn-primary { border-color: #9f55dc; background: var(--purple-deep); color: #fff; box-shadow: 0 7px 22px rgb(126 34 206 / 18%); }
.btn-primary:hover:not(:disabled) { border-color: #c084fc; background: #8b31d8; }
.btn-primary:active:not(:disabled) { background: #6f1bb3; }
.btn-quiet { border-color: var(--line); background: transparent; color: var(--muted); }
.btn-danger { border-color: #754043; background: #2b171b; color: #ffd5d5; }
.btn-danger:hover:not(:disabled) { border-color: #bc6870; background: #3a1e23; }
.btn-small { min-height: 44px; padding: 9px 13px; }
.btn-icon { width: 44px; padding: 0; }

.backup-banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 26px; padding: 14px 16px; border: 1px solid #846a31; border-radius: 12px; background: #241f12; color: #ffedbf; }
.backup-banner[data-state="ok"] { border-color: #41664a; background: #142017; color: #c8f0d0; }
.backup-banner strong { display: block; font-size: 13px; }
.backup-banner p { margin: 3px 0 0; color: inherit; font-size: 13px; opacity: .9; }
.backup-symbol { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgb(255 237 191 / 10%); }

.toolbar { display: flex; align-items: center; gap: 14px; margin: 24px 0 18px; }
.search-wrap { position: relative; flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--quiet); pointer-events: none; }
.search-wrap input { padding-left: 42px; }
.result-count { flex: 0 0 auto; color: var(--quiet); font-size: 13px; }
.message-list { display: grid; gap: 12px; }
.message-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 19px 20px; border: 1px solid #2c2a39; border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 12px rgb(0 0 0 / 11%); }
.message-card:hover { border-color: #50445f; background: #171622; }
.message-main { min-width: 0; }
.message-card h3 { margin: 0 0 8px; overflow-wrap: anywhere; }
.message-card h3 a { color: var(--ink); text-decoration: none; }
.message-card h3 a:hover { color: var(--purple-bright); }
.message-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; color: var(--muted); font-size: 13px; }
.message-meta span { min-width: 0; overflow-wrap: anywhere; }
.message-scripture { color: #d8c6f0; }
.message-status { display: flex; align-items: center; justify-content: end; gap: 8px; flex-wrap: wrap; }
.status-pill { min-height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 4px 10px; border: 1px solid #595366; border-radius: 999px; color: #ded9e8; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: #ada7b8; content: ""; }
.status-pill.published { border-color: #41664a; background: #152118; color: #c5ebcd; }
.status-pill.published::before { background: #8ed39c; }
.status-pill.draft { border-color: #5c4f37; background: #201c15; color: #f1ddb2; }
.status-pill.draft::before { background: var(--gold); }
.status-pill.hidden { border-color: #5e5180; background: #201a2d; color: #d8c2ff; }
.status-pill.hidden::before { background: #b196f6; }
.arrow { color: var(--quiet); font-size: 20px; line-height: 1; }
.empty-state { padding: 38px 24px; border: 1px dashed #454152; border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-state h3 { color: var(--ink); }
.empty-state p { max-width: 430px; margin: 0 auto 18px; }

.surface { border: 1px solid #302d3d; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form-surface { width: min(100%, 730px); margin: 0 auto; padding: clamp(20px, 4vw, 34px); }
.form-head { margin-bottom: 26px; }
.form-head .back-link { display: inline-flex; min-height: 44px; align-items: center; margin: 0 0 20px; color: var(--muted); text-decoration: none; }
.form-head .back-link:hover { color: var(--ink); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.field { min-width: 0; display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label, .field-label { color: #f1edf6; font-size: 13px; font-weight: 650; }
.required { color: var(--gold); }
.field-help { margin: 0; color: var(--quiet); font-size: 12px; line-height: 1.45; }
input, textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #464253;
  border-radius: 10px;
  background: #0f0f16;
  color: var(--ink);
  font-size: 16px;
}
input::placeholder, textarea::placeholder { color: #8d8898; opacity: 1; }
input:hover, textarea:hover, select:hover { border-color: #655a76; }
input[type="file"] { padding: 6px; font-size: 14px; }
input[type="file"]::file-selector-button { min-height: 34px; margin-right: 10px; padding: 4px 10px; border: 1px solid #5e526d; border-radius: 7px; background: #282235; color: #f4eafa; font: inherit; cursor: pointer; }
input[type="date"] { color-scheme: dark; }
textarea { min-height: 100px; resize: vertical; }
.form-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid #343142; }
.form-section h3 { margin-bottom: 4px; font-size: 1.2rem; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; }
.form-actions-right { display: flex; gap: 10px; }
.field-error { color: var(--danger); font-size: 13px; }
.invalid { border-color: #d27b83 !important; }
.upload-progress { margin-top: 15px; }
.progress-copy { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
progress { width: 100%; height: 10px; accent-color: var(--purple); }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 24px; }
.detail-title { min-width: 0; }
.detail-title h1 { margin: 8px 0 10px; overflow-wrap: anywhere; }
.detail-title .message-meta { font-size: 14px; }
.detail-status { flex: 0 0 auto; padding-top: 8px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(270px, .8fr); gap: 16px; align-items: start; }
.detail-panel { min-width: 0; padding: 22px; }
.detail-panel + .detail-panel { margin-top: 16px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h2 { margin: 0; font-size: 1.35rem; }
.player { width: 100%; min-height: 50px; display: block; }
.audio-empty { display: grid; gap: 4px; padding: 18px; border: 1px dashed #4b4558; border-radius: 10px; color: var(--muted); }
.audio-empty strong { color: var(--ink); font-size: 14px; }
.card-preview { width: 100%; display: block; overflow: hidden; border-radius: 11px; background: #0c0c12; object-fit: contain; }
.card-placeholder { aspect-ratio: 4 / 5; display: grid; align-content: center; justify-items: center; gap: 12px; padding: 26px; border: 1px solid #473852; border-radius: 11px; background: linear-gradient(145deg, #23172f, #11121d 70%); text-align: center; }
.card-placeholder-mark { width: 45px; height: 45px; display: grid; place-items: center; border: 1px solid #b995e6; border-radius: 50%; color: var(--gold); font-family: Georgia, "Times New Roman", serif; font-size: 20px; }
.card-placeholder strong { max-width: 100%; font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; font-weight: 400; line-height: 1.25; overflow-wrap: anywhere; }
.card-placeholder span { color: #d0c4db; font-size: 12px; }
.transcript-empty { padding: 15px 16px; border-left: 2px solid #8e72ab; background: #1a1722; color: var(--muted); }
.transcript-empty strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 13px; }
.transcript-empty p { margin: 0; font-size: 13px; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.publish-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 18px 20px; }
.publish-copy strong { display: block; font-size: 14px; }
.publish-copy span { color: var(--muted); font-size: 13px; }
.invitation-box { display: grid; gap: 12px; }
.team-section { margin-top: 20px; }
.invite-link { overflow-wrap: anywhere; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #0e0e15; color: #e4d2fa; font-size: 14px; }
.signin-wrap { width: min(100%, 520px); margin: 6vh auto; }
.signin-card { padding: clamp(24px, 6vw, 42px); border-top: 2px solid var(--gold); }
.signin-intro { margin-bottom: 26px; }
/* Logo 10 (stacked reversed white/gold) on the dark card: 180px shows a ~150px lockup, above the 140px minimum. */
.signin-logo { display: block; width: 180px; height: auto; margin: -8px 0 18px -15px; }
.signin-intro h1 { font-size: clamp(2.1rem, 8vw, 3.05rem); }
.signin-form { display: grid; gap: 17px; }
.signin-note { margin: 19px 0 0; padding-top: 18px; border-top: 1px solid #343142; color: var(--quiet); font-size: 13px; }
.refusal-card { max-width: 620px; margin: 8vh auto; padding: 32px; border-color: #634d35; background: #1b1713; }
.refusal-card h1 { font-size: 2rem; }
.refusal-card p { color: var(--muted); }
.notice { position: fixed; z-index: 10; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); width: min(440px, calc(100vw - 36px)); min-height: 0; border-radius: 10px; pointer-events: none; }
.notice:not(:empty) { padding: 14px 16px; border: 1px solid #625071; background: #211a2d; color: #f0e3ff; box-shadow: var(--shadow); }
.notice[data-kind="error"] { border-color: #8a4f54; background: #2a171b; color: #ffd8dc; }
.notice[data-kind="success"] { border-color: #496f50; background: #152219; color: #d0f2d5; }
.notice[data-kind="warning"] { border-color: #846a31; background: #241f12; color: #ffedbf; }
.spinner { width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 40%); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .topbar { min-height: 68px; gap: 10px; padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right)); }
  .brand-ministry { font-size: 8px; letter-spacing: .14em; }
  .identity { display: none; }
  main { padding: 28px 16px 40px; }
  .site-footer { padding-right: 16px; padding-left: 16px; font-size: 8px; }
  .page-head { align-items: flex-start; }
  .page-head .head-actions { margin-top: 3px; }
  .page-head .btn { padding: 10px 12px; }
  .message-card { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 16px; }
  .message-meta { gap: 3px 10px; font-size: 12px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .detail-side .detail-panel + .detail-panel { margin-top: 0; }
}
@media (max-width: 480px) {
  .topbar-actions { gap: 4px; }
  .topbar-actions .btn { min-width: 44px; padding: 9px 10px; font-size: 12px; }
  .page-head { display: block; }
  .page-head .head-actions { margin-top: 18px; }
  .toolbar { align-items: stretch; gap: 8px; }
  .result-count { align-self: center; font-size: 12px; }
  .message-card { grid-template-columns: minmax(0, 1fr); }
  .message-status { justify-content: space-between; }
  .arrow { display: none; }
  .field-grid, .edit-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .btn, .form-actions-right .btn { width: 100%; }
  .form-actions-right { flex-direction: column; width: 100%; }
  .detail-head { display: block; }
  .detail-status { padding-top: 0; }
  .detail-side { grid-template-columns: 1fr; }
  .publish-bar { align-items: stretch; flex-direction: column; }
  .publish-bar .btn { width: 100%; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 5px; }
}
@media (max-width: 360px) {
  .topbar { padding-right: 12px; padding-left: 12px; }
  main { padding-right: 12px; padding-left: 12px; }
  .brand-ministry { letter-spacing: .1em; }
}
@media (orientation: landscape) and (max-height: 540px) {
  main { padding-top: 20px; padding-bottom: 24px; }
  .signin-wrap { margin: 2vh auto; }
  .signin-card { padding: 23px 28px; }
  .signin-intro { margin-bottom: 16px; }
  .signin-form { grid-template-columns: 1fr 1fr; align-items: end; gap: 12px; }
  .signin-form .field { min-width: 0; }
  .signin-form .btn { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.team-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.team-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.team-list li > div { min-width: 0; overflow-wrap: anywhere; }
.team-list li .btn { flex: 0 0 auto; }
.invitation-box form { display: grid; gap: 12px; }
.invitation-box form .btn { justify-self: start; }
@media (max-width: 480px) { .team-list li { flex-wrap: wrap; } }
