:root {
  --purple: #5b2a91;
  --purple-500: #7339b5;
  --purple-300: #b48ae6;
  --purple-100: #efe6fa;
  --purple-50: #f7f2fd;
  --ink: #0b0910;
  --ink-2: #16121d;
  --text: #221b2c;
  --muted: #6e6580;
  --line: #e7e0ef;
  --bg: #f5f3f8;
  --white: #fff;
  --danger: #c0264b;
  --ok: #0f8a5f;
  --display: "Playfair Display", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
a { color: var(--purple); }
h1, h2, h3 { margin: 0; }
:focus-visible { outline: 3px solid var(--purple-300); outline-offset: 2px; }
.muted { color: var(--muted); }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: .7rem 1.2rem; border-radius: 10px; font-weight: 700; font-size: .92rem; border: 1.5px solid transparent; text-decoration: none; transition: background .2s, border-color .2s, color .2s; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; }
.btn--sm { padding: .45rem .85rem; font-size: .84rem; }
.btn--block { width: 100%; }
.btn--primary { background: var(--purple); color: #fff; }
.btn--primary:hover { background: var(--purple-500); }
.btn--ghost { background: var(--white); color: var(--text); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--purple-300); color: var(--purple); }
.btn--danger { background: var(--white); color: var(--danger); border-color: #f3c9d4; }
.btn--danger:hover { background: #fdf0f3; }
.btn--add { width: 100%; background: var(--purple-50); color: var(--purple); border: 1.5px dashed var(--purple-300); padding: .8rem; }
.btn--add:hover { background: var(--purple-100); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--purple); font-weight: 700; text-decoration: underline; }
.iconbtn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--white); display: grid; place-items: center; color: var(--muted); flex: none; }
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn:hover:not(:disabled) { color: var(--purple); border-color: var(--purple-300); }
.iconbtn--danger:hover:not(:disabled) { color: var(--danger); border-color: #f3c9d4; }
.iconbtn:disabled { opacity: .35; cursor: default; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% 0%, rgba(91, 42, 145, .5), transparent 60%), var(--ink); }
.auth__card { width: min(420px, 100%); background: var(--white); border-radius: 20px; padding: 36px; display: grid; gap: 14px; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6); }
.auth__card h1 { font-family: var(--display); font-size: 1.8rem; margin-top: 10px; }
.auth__card p { margin: 0; }
.auth__brand, .side__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.brand-logo { display: block; height: 50px; width: auto; }
.auth__brand { align-self: start; background: var(--ink); border-radius: 14px; padding: 10px 14px; }
.auth__brand small, .side__brand small { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--purple-300); font-weight: 800; }
.auth__err { color: var(--danger); font-weight: 600; min-height: 1.2em; font-size: .9rem; }
.auth__back { text-align: center; font-size: .88rem; text-decoration: none; color: var(--muted); }

/* layout */
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #d6cce4; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { padding: 0 8px; color: #fff; }
.side__brand small { color: var(--purple-300); }
.side__nav { display: grid; gap: 2px; }
.side__group { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 800; color: #7d7290; padding: 16px 12px 6px; }
.side__item, .side__link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #d6cce4; text-decoration: none; font-weight: 600; font-size: .93rem; background: none; border: 0; width: 100%; text-align: left; }
.side__item:hover, .side__link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side__item.is-active { background: var(--purple); color: #fff; }
.side__ic, .side__link svg { width: 20px; height: 20px; display: grid; flex: none; }
.side__ic svg { width: 20px; height: 20px; }
.badge { margin-left: auto; background: #ff4d6d; color: #fff; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 2px 8px; }
.side__foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; display: grid; gap: 2px; }
.content { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 10; background: rgba(245, 243, 248, .9); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 12px; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.top__title { font-family: var(--display); font-size: 1.6rem; }
.top__view { margin-left: auto; }
.top__menu { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); padding: 9px; }
.main { padding: 28px 32px 120px; flex: 1; }
.page { display: grid; gap: 22px; max-width: 1080px; }
.scrim { display: none; }

/* panels */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: grid; gap: 18px; align-content: start; }
.panel__head h2 { font-size: 1.1rem; }
.panel__head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.note { background: var(--purple-50); border: 1px solid var(--purple-100); border-radius: 10px; padding: 12px 14px; font-size: .9rem; }
.toolbar { display: flex; justify-content: flex-end; }
.empty { color: var(--muted); margin: 0; font-size: .93rem; }

/* fields */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-weight: 700; font-size: .84rem; }
.field--wide { grid-column: 1 / -1; }
.field input, .field textarea, .field select, .string input { font: inherit; font-size: .95rem; padding: .7rem .85rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); color: var(--text); width: 100%; }
.field textarea { resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .string input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(91, 42, 145, .12); }
.hint { color: var(--muted); font-size: .8rem; }
.warn { color: var(--danger); font-size: .8rem; font-weight: 600; }
.img-field { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: center; }
.img-prev { aspect-ratio: 16 / 10; border-radius: 10px; background: var(--purple-50) center / cover no-repeat; border: 1px solid var(--line); }
.img-prev.is-empty { background-image: repeating-linear-gradient(45deg, transparent 0 8px, var(--purple-100) 8px 9px); }
.img-field__ctl { display: grid; gap: 10px; }
.ic { display: inline-grid; }
.ic svg { width: 16px; height: 16px; }
.yt-field { display: grid; gap: 8px; }
.yt-thumb { width: 200px; border-radius: 8px; }
.icons { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-pick { width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--white); color: var(--muted); display: grid; place-items: center; }
.icon-pick svg { width: 22px; height: 22px; }
.icon-pick:hover { border-color: var(--purple-300); color: var(--purple); }
.icon-pick.is-on { background: var(--purple); border-color: var(--purple); color: #fff; }

/* list editor */
.list { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; background: var(--white); overflow: hidden; }
.item.is-open { border-color: var(--purple-300); box-shadow: 0 8px 24px -16px rgba(91, 42, 145, .5); }
.item__head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; }
.item__toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: left; padding: 4px; border-radius: 8px; color: inherit; }
.item__thumb { width: 64px; height: 42px; border-radius: 6px; background: var(--purple-50) center / cover; flex: none; border: 1px solid var(--line); }
.item__sum { display: grid; min-width: 0; }
.item__sum strong, .item__sum small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__sum small { color: var(--muted); font-size: .8rem; }
.item__ctl { display: flex; gap: 6px; }
.item__body { display: none; padding: 16px 18px 20px; border-top: 1px solid var(--line); background: #fcfbfe; }
.item.is-open .item__body { display: block; }
.strings { display: grid; gap: 8px; }
.string { display: flex; gap: 8px; align-items: center; }

/* save bar */
.savebar { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 150%); z-index: 40; display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 10px 10px 10px 20px; border-radius: 14px; box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .5); transition: transform .35s cubic-bezier(.2, .8, .2, 1.1); margin-left: 130px; }
.savebar.is-on { transform: translate(-50%, 0); }
.savebar__note { font-weight: 600; font-size: .9rem; margin-right: 8px; }
.savebar__note::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ffc857; margin-right: 8px; }

/* toast */
.toast { position: fixed; top: 20px; right: 20px; z-index: 100; background: var(--ok); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 700; font-size: .9rem; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); transform: translateY(-150%); opacity: 0; transition: .3s; max-width: calc(100% - 40px); }
.toast.is-on { transform: none; opacity: 1; }
.toast.is-bad { background: var(--danger); }

/* overview */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: linear-gradient(120deg, var(--ink), #2c0f4d 60%, var(--purple)); color: #fff; border-radius: 18px; padding: 28px; }
.hello h2 { font-family: var(--display); font-size: 1.8rem; }
.hello p { margin: 4px 0 0; color: #d6cce4; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-align: left; display: grid; gap: 2px; color: var(--text); transition: border-color .2s, transform .2s; }
.stat:hover { border-color: var(--purple-300); transform: translateY(-2px); }
.stat__ic { width: 36px; height: 36px; border-radius: 10px; background: var(--purple-50); color: var(--purple); display: grid; place-items: center; margin-bottom: 8px; }
.stat__ic svg { width: 20px; height: 20px; }
.stat b { font-size: 1.8rem; font-family: var(--display); }
.stat > span:last-child { color: var(--muted); font-size: .86rem; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.mini { list-style: none; margin: 0; padding: 0; display: grid; }
.mini li { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.mini li:last-child { border-bottom: 0; }
.mini li:hover { background: var(--purple-50); }
.mini strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
.mini small { color: var(--muted); font-size: .8rem; }
.mini li.is-unread strong::after { content: ""; display: inline-block; width: 7px; height: 7px; background: #ff4d6d; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.datechip { background: var(--ink); color: #fff; font-size: .75rem; font-weight: 800; padding: 4px 8px; border-radius: 6px; flex: none; }
.feat { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.feat img { width: 220px; border-radius: 10px; }
.feat p { margin: 4px 0 12px; font-size: .9rem; }

/* tags */
.tag { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; flex: none; }
.tag--prayer { background: var(--purple-100); color: var(--purple); }
.tag--contact { background: #e8eefc; color: #2b4fa6; }
.tag--ministry { background: #e5f6ef; color: #0f7a54; }
.tag--private { background: #fff1d6; color: #8a5a00; }

/* inbox */
.inbox-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.inbox-bar__actions { margin-left: auto; display: flex; gap: 8px; }
.tabs { display: flex; gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tab { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-weight: 700; font-size: .86rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.tab.is-on { background: var(--purple); color: #fff; }
.tab__n { font-size: .72rem; opacity: .75; }
.switch { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .88rem; }
.switch input { accent-color: var(--purple); width: 16px; height: 16px; }
.msgs { display: grid; gap: 8px; }
.msg { background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.msg[open] { border-color: var(--purple-300); }
.msg summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; }
.msg summary::-webkit-details-marker { display: none; }
.msg .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.msg.is-unread .dot { background: #ff4d6d; }
.msg.is-unread strong { font-weight: 800; }
.msg strong { font-weight: 600; white-space: nowrap; }
.msg__preview { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.msg summary small { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.msg__body { padding: 4px 16px 18px 34px; display: grid; gap: 12px; }
.msg dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: .9rem; }
.msg dt { color: var(--muted); font-weight: 700; }
.msg dd { margin: 0; }
.msg__text { white-space: pre-wrap; margin: 0; background: var(--bg); border-radius: 10px; padding: 14px; line-height: 1.6; }
.msg__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .3s; }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(11, 9, 16, .5); z-index: 45; }
  .top { padding: 12px 16px; }
  .top__menu { display: grid; }
  .top__title { font-size: 1.3rem; }
  .main { padding: 18px 16px 120px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .savebar { margin-left: 0; width: calc(100% - 24px); bottom: 12px; padding: 10px; }
  .savebar__note { flex: 1; font-size: .82rem; }
}
@media (max-width: 600px) {
  .fields { grid-template-columns: 1fr; }
  .img-field { grid-template-columns: 1fr; }
  .img-prev { max-width: 260px; }
  .panel { padding: 18px; }
  .top__view { display: none; }
  .item__thumb { display: none; }
  .msg summary { flex-wrap: wrap; }
  .msg__preview { flex-basis: 100%; order: 5; }
  .msg__body { padding-left: 16px; }
  .inbox-bar__actions { margin-left: 0; }
  .savebar__note { display: none; }
  .savebar .btn { flex: 1; }
}
