/* FaithKit admin portal */
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #e8edf2; background: #0f1720; }
:root { --fk-primary: #1e3a5f; --fk-accent: #d4af37; }

/* --- Login --- */
.fk-login { display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #17324f 0%, #0f1720 60%); }
.login-card { width: 360px; max-width: 92vw; padding: 2rem; background: #16212e;
  border: 1px solid #22303f; border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.login-brand { font-size: 1.4rem; font-weight: 700; }
.login-sub { color: #93a4b5; margin: .2rem 0 1.4rem; }
.login-card label { display: block; font-size: .85rem; color: #c7d3de; margin-bottom: .35rem; }
.login-card input { width: 100%; padding: .75rem .85rem; border-radius: 10px;
  border: 1px solid #2b3a4a; background: #0f1720; color: #e8edf2; font-size: 1rem; }
.login-card button { width: 100%; margin-top: 1.2rem; padding: .8rem; border: 0; border-radius: 10px;
  background: var(--fk-accent); color: #1a1a1a; font-weight: 700; font-size: 1rem; cursor: pointer; }
.login-err { background: #3a1720; border: 1px solid #7a2f3f; color: #f2b8c2;
  padding: .6rem .8rem; border-radius: 9px; margin-bottom: 1rem; font-size: .9rem; }
.login-foot { margin-top: 1.2rem; color: #7f93a6; font-size: .8rem; }

/* --- App shell --- */
.fk-app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.fk-side { background: #131c27; border-right: 1px solid #202d3b; display: flex; flex-direction: column;
  padding: 1.2rem 0; position: sticky; top: 0; height: 100vh; }
.fk-side-brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem;
  padding: 0 1.2rem 1rem; }
.fk-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--fk-accent);
  box-shadow: 0 0 0 4px rgba(212,175,55,.18); }
.fk-nav { display: flex; flex-direction: column; gap: 2px; padding: .4rem .6rem; flex: 1; }
.fk-nav-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 10px;
  color: #c1cdd9; text-decoration: none; font-size: .93rem; transition: background .18s, color .18s; }
.fk-nav-item:hover { background: #1b2733; color: #fff; }
.fk-nav-item.is-active { background: linear-gradient(90deg, rgba(212,175,55,.16), rgba(212,175,55,.04));
  color: #fff; box-shadow: inset 3px 0 0 var(--fk-accent); }
/* Drawn SVG icons — fixed box so every nav row aligns on the same optical grid. */
.fk-nav-ic { flex: 0 0 20px; width: 20px; height: 20px; display: inline-flex;
  align-items: center; justify-content: center; color: #8ea2b6; transition: color .18s; }
.fk-nav-ic svg { width: 20px; height: 20px; display: block; }
.fk-nav-item:hover .fk-nav-ic { color: #dbe4ed; }
.fk-nav-item.is-active .fk-nav-ic { color: var(--fk-accent); }
.fk-logout { margin: .6rem 1.2rem 0; color: #8fa1b2; text-decoration: none; font-size: .85rem; }
.fk-logout:hover { color: #fff; }

.fk-main { min-width: 0; }
.fk-topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 2rem; border-bottom: 1px solid #1c2734; position: sticky; top: 0;
  background: rgba(15,23,32,.85); backdrop-filter: blur(8px); z-index: 5; }
.fk-topbar h1 { margin: 0; font-size: 1.25rem; }
.fk-view-site { color: var(--fk-accent); text-decoration: none; font-size: .9rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.fk-view-site svg { width: 15px; height: 15px; display: block; flex-shrink: 0; }
.fk-panel { padding: 2rem; }

/* --- Mobile shell controls (hidden on desktop; drawer wiring in @media) --- */
.fk-navtoggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.fk-scrim { display: none; }
.fk-hamburger { display: none; }
.fk-hamburger span { display: block; width: 20px; height: 2px; border-radius: 2px; background: #cdd8e2;
  transition: background .2s; }
.fk-hamburger span + span { margin-top: 4px; }
.fk-hamburger:hover span { background: #fff; }

/* --- Cards / dashboard --- */
.fk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.fk-card { display: block; padding: 1.4rem 1.5rem; border-radius: 14px; text-decoration: none;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0));
  border: 1px solid #22303f; color: #e8edf2; transition: transform .3s, border-color .3s; }
.fk-card:hover { transform: translateY(-3px); border-color: rgba(212,175,55,.5); }
.fk-card-n { font-size: 2rem; font-weight: 700; color: #fff; }
.fk-card-l { color: #93a4b5; font-size: .9rem; margin-top: .2rem; }
.fk-welcome { margin-top: 2rem; max-width: 720px; }
.fk-welcome h2 { margin: 0 0 .4rem; }
.fk-welcome p { color: #b7c3cf; line-height: 1.6; }
.fk-checklist { list-style: none; padding: 0; margin: 1rem 0 0; color: #c1cdd9; line-height: 2; }

/* --- Placeholder panels --- */
.fk-soon { max-width: 620px; }
.fk-soon h2 { margin-top: 0; }
.fk-soon p { color: #b7c3cf; line-height: 1.6; }
.fk-soon-tag { display: inline-block; margin-top: .6rem; padding: .25rem .7rem; border-radius: 999px;
  background: rgba(212,175,55,.14); color: #f0d783; border: 1px solid rgba(212,175,55,.5);
  font-size: .78rem; font-weight: 700; }

/* --- Settings --- */
.fk-note { color: #8fa1b2; font-size: .9rem; }
.fk-set-group { margin: 1.6rem 0; padding: 1.2rem 1.4rem; border: 1px solid #22303f; border-radius: 14px;
  background: rgba(255,255,255,.02); max-width: 720px; }
.fk-set-group h3 { margin: 0 0 .8rem; font-size: 1rem; color: #fff; }
.fk-set-group dl { display: grid; grid-template-columns: 130px 1fr; gap: .5rem 1rem; margin: 0; }
.fk-set-group dt { color: #8fa1b2; font-size: .9rem; }
.fk-set-group dd { margin: 0; }
.fk-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: .5rem;
  vertical-align: -2px; border: 1px solid rgba(255,255,255,.25); }
.fk-toggles { display: flex; flex-wrap: wrap; gap: .5rem; }
.fk-toggle { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .7rem; border-radius: 999px;
  font-size: .85rem; border: 1px solid #2b3a4a; color: #c1cdd9; }
.fk-toggle b { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.fk-toggle.on b { color: #7ee0b0; }
.fk-toggle.off { opacity: .55; }
.fk-toggle.off b { color: #b7c6d4; }
.fk-svc { list-style: none; padding: 0; margin: 0; line-height: 1.9; color: #c1cdd9; }

@media (max-width: 780px) {
  /* Single-column: content is the page; nav becomes an off-canvas drawer. */
  .fk-app { display: block; }

  .fk-topbar { gap: .9rem; padding: .9rem 1.1rem; }
  .fk-topbar h1 { font-size: 1.1rem; flex: 1; }
  .fk-hamburger { display: inline-grid; place-items: center; flex-shrink: 0;
    width: 42px; height: 42px; border-radius: 10px; border: 1px solid #22303f;
    background: #16212e; cursor: pointer; }
  .fk-hamburger:hover { background: #1b2733; }

  /* Drawer */
  .fk-side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    width: 268px; max-width: 84vw; height: 100%; overflow-y: auto;
    transform: translateX(-100%); transition: transform .28s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.6); padding: 1.2rem 0; }
  .fk-nav { flex-direction: column; gap: 2px; }
  .fk-nav-item { padding: .8rem .9rem; font-size: 1rem; }

  /* Backdrop */
  .fk-scrim { display: block; position: fixed; inset: 0; z-index: 30;
    background: rgba(4,9,15,.62); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .28s ease; }

  /* Open state (CSS-only; each nav tap is a page load, so it resets closed) */
  #fk-navtoggle:checked ~ .fk-side { transform: none; }
  #fk-navtoggle:checked ~ .fk-scrim { opacity: 1; pointer-events: auto; }

  .fk-panel { padding: 1.2rem; }
  .fk-crud { grid-template-columns: 1fr; }
  .fk-crud-aside { position: static; }

  /* Nothing may inflate the document. Grid and flex items default to
     min-width:auto, which lets a wide child push the whole page sideways —
     that is what turned a 375px screen into a 924px one. */
  .fk-main, .fk-crud, .fk-crud-main, .fk-crud-aside { min-width: 0; }

  /* Rows become cards. A four-column table on a 375px screen is a sideways
     swipe with the delete button parked off-screen; the same data as a card
     reads top-to-bottom with the control under the thumb. Markup stays a
     real <table> — this is presentation only, and desktop is untouched. */
  .fk-table { display: block; width: 100%; overflow: visible; white-space: normal; }
  .fk-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .fk-table tbody, .fk-table tr, .fk-table td { display: block; }
  .fk-table tr { position: relative; padding: .9rem 1rem; margin-bottom: .6rem;
    border: 1px solid #22303f; border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)); }
  .fk-table tr:hover td { background: none; }
  .fk-table td { border: 0; padding: .3rem 0; font-size: .92rem;
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
  .fk-table td::before { content: attr(data-label); flex: 0 0 auto;
    font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #7f93a6; }

  /* Card title: full width, no label, cleared of the pinned action button. */
  .fk-table .fk-td-strong { display: block; font-size: 1rem; line-height: 1.35;
    padding: 0 52px .55rem 0; }
  .fk-table .fk-td-strong::before { display: none; }

  /* The row's control pins to the card's top-right corner. */
  .fk-table .fk-td-actions { position: absolute; top: .8rem; right: .85rem;
    width: auto; padding: 0; display: block; }
  .fk-table .fk-td-actions::before { display: none; }

}

/* ── P3: flash + CRUD panels ───────────────────────────────────────────── */
.fk-flash { margin: 0 2rem; margin-top: 1.4rem; padding: .7rem 1rem; border-radius: 10px;
  background: rgba(126,224,176,.12); border: 1px solid rgba(47,122,88,.5); color: #9be9c2; font-size: .9rem; }

.fk-crud { display: grid; grid-template-columns: 1fr 320px; gap: 1.6rem; align-items: start; }
.fk-crud-stats { display: flex; gap: 1.2rem; margin-bottom: 1rem; color: #93a4b5; font-size: .9rem; }
.fk-crud-stats strong { color: #fff; font-size: 1.05rem; }
.fk-crud-h { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: #8fa1b2; margin: 1.4rem 0 .7rem; }
.fk-crud-h--muted { opacity: .7; }
.fk-empty { padding: 2rem; text-align: center; color: #8fa1b2; border: 1px dashed #2b3a4a; border-radius: 12px; }

.fk-prayer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.fk-prayer { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: 1rem 1.1rem; border: 1px solid #22303f; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)); transition: border-color .25s; }
.fk-prayer:hover { border-color: rgba(212,175,55,.4); }
.fk-prayer.is-answered { opacity: .62; }
.fk-prayer.is-answered .fk-prayer-req { text-decoration: line-through; text-decoration-color: rgba(255,255,255,.3); }
.fk-prayer-req { color: #e8edf2; line-height: 1.5; }
.fk-prayer-meta { color: #8fa1b2; font-size: .8rem; margin-top: .35rem; }
.fk-prayer-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.fk-prayer-actions form { margin: 0; }
/* Row actions. Two shapes off one base: a pill with a label, and a square
   icon-only button. Both are ≥36px tall on desktop and ≥44px on a phone, so a
   volunteer hits Delete on the first try instead of the third. */
.fk-btn-sm { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 36px; padding: .4rem .75rem; border-radius: 9px; border: 1px solid #2b3a4a; background: #16212e;
  color: #c1cdd9; font-size: .82rem; font-family: inherit; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s; }
.fk-btn-sm svg { width: 15px; height: 15px; display: block; flex-shrink: 0; }
.fk-btn-sm:hover { background: #1b2733; color: #fff; }
.fk-btn-sm:focus-visible { outline: 2px solid var(--fk-accent); outline-offset: 2px; }
.fk-btn-sm:active { transform: translateY(1px); }
/* Icon-only: square, no label, so it reads as a control not a truncated word. */
.fk-btn-ico { width: 36px; min-width: 36px; padding: 0; gap: 0; }
.fk-btn-ico svg { width: 17px; height: 17px; }
.fk-btn-ok:hover { border-color: rgba(47,122,88,.6); color: #7ee0b0; }
.fk-btn-del:hover { border-color: rgba(180,60,80,.6); color: #f2b8c2; }

/* Section heading with a drawn mark (radio auto-slice). */
.fk-h3-ic { display: inline-flex; vertical-align: -3px; margin-right: .45rem; color: var(--fk-accent); }
.fk-h3-ic svg { width: 17px; height: 17px; display: block; }

/* Dashboard checklist — drawn marks on a fixed grid instead of mixed glyphs. */
.fk-checklist li { display: flex; align-items: flex-start; gap: .6rem; }
.fk-check { flex: 0 0 18px; display: inline-flex; align-items: center; justify-content: center;
  height: 1.9em; }
.fk-check svg { width: 16px; height: 16px; display: block; }
.fk-check.is-done { color: #7ee0b0; }
.fk-check.is-todo { color: #52657a; }
.fk-check.is-todo svg { width: 9px; height: 9px; }

.fk-crud-aside { position: sticky; top: 90px; }
.fk-form-card { padding: 1.4rem; border: 1px solid #22303f; border-radius: 14px; background: rgba(255,255,255,.02); }
.fk-form-card h3 { margin: 0 0 1rem; font-size: 1.05rem; color: #fff; }
.fk-form-card label { display: block; font-size: .82rem; color: #c7d3de; margin: .8rem 0 .3rem; }
.fk-form-card .fk-opt { color: #7f93a6; font-weight: 400; }
.fk-form-card input, .fk-form-card textarea, .fk-form-card select {
  width: 100%; box-sizing: border-box; padding: .6rem .7rem; border-radius: 9px;
  border: 1px solid #2b3a4a; background: #0f1720; color: #e8edf2; font-size: .95rem; font-family: inherit; }
.fk-form-card textarea { resize: vertical; }
.fk-btn-primary { margin-top: 1.1rem; width: 100%; padding: .75rem; border: 0; border-radius: 10px;
  background: var(--fk-accent); color: #1a1a1a; font-weight: 700; font-size: .95rem; cursor: pointer; }
.fk-btn-primary:hover { filter: brightness(1.06); }

@media (max-width: 780px) {
  .fk-crud { grid-template-columns: 1fr; }
  .fk-crud-aside { position: static; }
  /* 44px minimum tap target — the phone is where these get pressed. */
  .fk-btn-sm { min-height: 44px; padding: .5rem .9rem; font-size: .88rem; }
  .fk-btn-ico { width: 44px; min-width: 44px; padding: 0; }
  .fk-btn-ico svg { width: 19px; height: 19px; }
  .fk-btn-sm svg { width: 16px; height: 16px; }
  /* Stack the row: the request gets the full width, the controls sit under it.
     Side-by-side at 375px squeezed the text to a three-word column. */
  .fk-prayer { flex-direction: column; align-items: stretch; gap: .8rem; }
  .fk-prayer-actions { gap: .5rem; padding-top: .7rem; border-top: 1px solid #1e2a37; }
  .fk-prayer-actions form { flex: 1; }
  .fk-prayer-actions form .fk-btn-sm:not(.fk-btn-ico) { width: 100%; }
  .fk-prayer-actions form:has(.fk-btn-ico) { flex: 0 0 auto; }
  .fk-radio-ctl { gap: .45rem; }
  .fk-radio-track { flex-wrap: wrap; }
  .fk-radio-body { flex: 1 1 100%; order: 2; }
  .fk-radio-ctl { order: 3; margin-left: auto; }
}

/* ── P3: members table + editable settings ─────────────────────────────── */
.fk-table { width: 100%; border-collapse: collapse; }
.fk-table thead th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: #7f93a6; padding: .5rem .7rem; border-bottom: 1px solid #22303f; }
.fk-table td { padding: .7rem .7rem; border-bottom: 1px solid #1a2532; font-size: .92rem; }
.fk-table tr:hover td { background: rgba(255,255,255,.02); }
.fk-td-strong { font-weight: 600; color: #fff; }
.fk-td-muted { color: #93a4b5; }
.fk-td-actions { text-align: right; width: 1%; white-space: nowrap; }
.fk-td-actions form { display: inline; margin: 0; }

.fk-settings-form { max-width: 780px; }
.fk-set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.1rem; }
.fk-set-grid .fk-span2 { grid-column: 1 / -1; }
.fk-set-grid label { display: block; font-size: .8rem; color: #c7d3de; margin-bottom: .3rem; }
.fk-set-grid input { width: 100%; box-sizing: border-box; padding: .6rem .7rem; border-radius: 9px;
  border: 1px solid #2b3a4a; background: #0f1720; color: #e8edf2; font-size: .95rem; font-family: inherit; }
.fk-set-grid input[type="color"] { height: 42px; padding: .2rem; cursor: pointer; }

.fk-feat-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem 1rem; }
.fk-switch { display: flex; align-items: center; gap: .6rem; cursor: pointer; user-select: none; }
.fk-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.fk-switch-track { width: 38px; height: 22px; border-radius: 999px; background: #2b3a4a; position: relative; transition: background .2s; flex-shrink: 0; }
.fk-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #8fa1b2; transition: transform .2s, background .2s; }
.fk-switch input:checked + .fk-switch-track { background: rgba(212,175,55,.55); }
.fk-switch input:checked + .fk-switch-track::after { transform: translateX(16px); background: var(--fk-accent); }
.fk-switch-label { font-size: .9rem; color: #c1cdd9; }
.fk-settings-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.8rem; }
.fk-chip-audio { display: inline-flex; align-items: center; gap: .25rem; font-size: .68rem; color: var(--fk-accent);
  border: 1px solid rgba(212,175,55,.4); border-radius: 5px; padding: .1rem .35rem; margin-left: .4rem; vertical-align: middle; }
.fk-chip-audio svg { width: 10px; height: 10px; display: block; flex-shrink: 0; }

/* ── P4: radio playlist ────────────────────────────────────────────────── */
.fk-radio-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.fk-radio-track { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; border: 1px solid #22303f; border-radius: 12px; background: linear-gradient(180deg,rgba(255,255,255,.03),rgba(255,255,255,0)); }
.fk-radio-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(212,175,55,.16); color: var(--fk-accent); font-size: .78rem; font-weight: 700; flex-shrink: 0; }
.fk-radio-body { flex: 1; min-width: 0; }
.fk-radio-title { font-weight: 600; color: #fff; margin-bottom: .4rem; }
.fk-radio-body audio { width: 100%; height: 34px; }
.fk-radio-ctl { display: flex; gap: .35rem; flex-shrink: 0; }
.fk-radio-ctl form { margin: 0; }
.fk-form-card input[type="file"] { padding: .5rem; font-size: .85rem; }
.fk-slice-card { border-color: rgba(212,175,55,.4); background: linear-gradient(180deg, rgba(212,175,55,.07), rgba(255,255,255,.01)); }

/* ── Phone overrides that must win the cascade ─────────────────────────────
   .fk-set-grid and .fk-radio-body are defined below the earlier media
   queries, so an override up there loses on source order at equal
   specificity. These live at the end of the file on purpose. */
@media (max-width: 780px) {
  /* Settings fields stack — side-by-side pairs truncate the church name at 375px. */
  .fk-set-grid { grid-template-columns: 1fr; }
  .fk-feat-toggles { grid-template-columns: 1fr; }
}
