@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #090d12;
  --panel: #101820;
  --panel-raised: #15212b;
  --line: #263541;
  --muted: #9aabb7;
  --text: #edf5f7;
  --cyan: #d66cff;
  --lime: #c0f56b;
  --violet: #a88aff;
  --danger: #ff727b;
  --shadow: 0 16px 44px rgba(0, 0, 0, .28), inset 0 1px rgba(255,255,255,.035);
  font-family: 'Manrope', sans-serif;
}
* { box-sizing: border-box; }
body { display: block; height: auto; margin: 0; min-width: 320px; min-height: 100vh; overflow: auto; color: var(--text); background: radial-gradient(ellipse at 82% 0%, rgba(142, 50, 180, .16), transparent 34%), var(--bg); font-family: 'Manrope', sans-serif; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
#app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; width: auto; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px 15px; background: rgba(13, 20, 27, .92); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 40px; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid rgba(214, 108, 255, .5); border-radius: 12px; color: var(--cyan); background: linear-gradient(145deg, #321c40, #111922 70%); box-shadow: 0 8px 24px rgba(179, 55, 242, .15), inset 0 1px rgba(255,255,255,.12); font-size: 19px; }
.brand strong { display: block; font-size: 15px; letter-spacing: 0; }
.brand small { color: var(--muted); font-size: 11px; }
.nav { display: grid; gap: 5px; }
.nav button, .signout, .icon-btn, .secondary-btn, .primary-btn, .danger-btn { border: 1px solid transparent; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; text-align: left; color: var(--muted); background: transparent; border-radius: 8px; font-size: 13px; font-weight: 700; }
.nav button i { width: 17px; text-align: center; }
.nav button:hover, .nav button.active { color: var(--text); border-color: rgba(214, 108, 255, .24); background: linear-gradient(90deg, rgba(179, 55, 242, .16), rgba(179, 55, 242, .035)); }
.nav button.active { box-shadow: inset 2px 0 var(--cyan); }
.sidebar-foot { margin-top: auto; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.sidebar-foot strong { display: block; font-size: 12px; }
.sidebar-foot small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.profile-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px; }
.profile-card-copy { min-width: 0; }
.profile-avatar, .member-mini-avatar { display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(214,108,255,.45); border-radius: 50%; color: #f5d8ff; background: linear-gradient(145deg, #742397, #251633); box-shadow: inset 0 1px rgba(255,255,255,.2), 0 6px 18px rgba(88, 23, 120, .28); font-size: 12px; font-weight: 800; }
.profile-avatar { width: 34px; height: 34px; }
.profile-avatar.large { width: 68px; height: 68px; font-size: 23px; }
.profile-edit { width: 27px; height: 27px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.profile-edit:hover { color: var(--text); background: rgba(255,255,255,.07); }
.workspace { min-width: 0; padding: 26px clamp(18px, 4vw, 54px) 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 5px; color: var(--cyan); font-size: 10px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
.topbar h1 { margin-bottom: 0; font-size: clamp(20px, 2vw, 27px); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.connection::before { width: 7px; height: 7px; content: ''; border-radius: 50%; background: #64737e; }
.connection.online::before { background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.icon-btn, .signout { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.icon-btn:hover, .signout:hover { border-color: var(--cyan); }
.page { display: none; padding-top: 24px; animation: rise .22s ease both; }
.page.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.assignment-option { display:flex; align-items:center; gap:10px; padding:10px; margin:7px 0; border:1px solid var(--line); border-radius:8px; cursor:pointer; }
.assignment-option:has(input:disabled) { opacity:.48; cursor:not-allowed; }
.assignment-option span { display:grid; gap:2px; }
.assignment-option small { color:var(--muted); }
.page-heading h2 { margin-bottom: 4px; font-size: 19px; }
.page-heading p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.primary-btn, .secondary-btn, .danger-btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 7px; font-size: 12px; font-weight: 800; }
.primary-btn { color: #15091b; background: var(--cyan); box-shadow: 0 5px 18px rgba(179, 55, 242, .2); }
.primary-btn:hover { background: #e39cff; transform: translateY(-1px); }
.secondary-btn { border-color: var(--line); color: var(--text); background: #17232d; }
.secondary-btn:hover { border-color: var(--cyan); }
.danger-btn { border-color: rgba(255, 114, 123, .3); color: #ff9da3; background: rgba(255, 114, 123, .07); }
.danger-btn:hover { background: rgba(255, 114, 123, .15); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.stat, .surface, .plan-card { border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(23, 36, 46, .94), rgba(14, 22, 29, .96)); box-shadow: var(--shadow); }
.stat { padding: 16px; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.stat:hover { border-color: rgba(214,108,255,.42); box-shadow: 0 19px 38px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.06); transform: translateY(-2px); }
.stat > i { float: right; color: var(--cyan); opacity: .82; }
.stat span { color: var(--muted); font-size: 11px; }
.stat strong { display: block; margin-top: 6px; font-size: 25px; }
.surface { padding: 19px; }
.next-event-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 150px; overflow: hidden; background: radial-gradient(circle at 100% 50%, rgba(179,55,242,.18), transparent 40%), linear-gradient(145deg, rgba(30, 39, 56, .96), rgba(14, 22, 29, .98)); }
.next-event-card > i { color: var(--cyan); opacity: .38; font-size: clamp(54px, 10vw, 110px); transform: rotate(-8deg); }
.surface h3 { margin-bottom: 13px; font-size: 14px; }
.notice { margin: 14px 0; padding: 11px 13px; border: 1px solid rgba(214, 108, 255, .24); border-radius: 7px; color: #edd4fa; background: rgba(179, 55, 242, .08); font-size: 12px; line-height: 1.55; }
.notice.error { border-color: rgba(255,114,123,.34); color: #ffc1c4; background: rgba(255,114,123,.08); }
.notice.warning { border-color: rgba(192,245,107,.3); color: #dff7b5; background: rgba(192,245,107,.06); }
.list { display: grid; gap: 9px; }
.song-search { display: flex; align-items: center; gap: 9px; width: min(440px, 100%); margin: -4px 0 15px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(0,0,0,.14); }
.song-search:focus-within { border-color: rgba(214,108,255,.7); box-shadow: 0 0 0 3px rgba(179,55,242,.1); }
.song-search input { width: 100%; height: 40px; border: 0; outline: 0; color: var(--text); background: transparent; }
.song-grid, .birthday-grid, .role-grid, .guide-grid, .content-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 13px; }
.song-card, .birthday-card, .role-card, .guide-card, .content-card { border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, rgba(25,37,49,.96), rgba(11,18,25,.98)); box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.song-card:hover, .birthday-card:hover, .role-card:hover, .guide-card:hover, .content-card:hover { border-color: rgba(214,108,255,.45); box-shadow: 0 19px 38px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.06); transform: translateY(-3px); }
.song-card { padding: 16px; }
.song-card-head { display: flex; align-items: center; gap: 11px; }
.song-icon { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 10px; color: var(--cyan); background: rgba(179,55,242,.13); }
.song-card h3, .birthday-card h3, .role-card h3, .guide-card h3, .content-card h3 { margin: 0 0 4px; font-size: 14px; }
.song-card p, .birthday-card p, .role-card p, .guide-card p, .content-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.song-meta { display: flex; gap: 7px; margin: 16px 0; }
.song-meta span { padding: 5px 7px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; color: #d7c6df; background: rgba(255,255,255,.03); font-size: 10px; font-weight: 700; }
.song-meta i { margin-right: 5px; color: var(--cyan); }
.song-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.song-action { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; text-decoration: none; }
.song-action:hover { border-color: var(--line); color: var(--text); background: rgba(255,255,255,.05); }
.song-action.disabled { cursor: default; opacity: .4; }
.song-action.danger:hover { color: #ffadb2; border-color: rgba(255,114,123,.25); }
.birthday-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.birthday-day { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 12px; color: #1b0b22; background: var(--cyan); box-shadow: 0 7px 18px rgba(179,55,242,.25); font-size: 20px; font-weight: 800; }
.birthday-card span { display: inline-block; margin-top: 8px; color: var(--lime); font-size: 10px; }
.role-card { display: grid; grid-template-columns: 35px minmax(0, 1fr); gap: 10px; padding: 14px; }
.member-mini-avatar { width: 35px; height: 35px; }
.role-card-main { min-width: 0; }
.role-select { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.07); color: var(--muted); font-size: 10px; font-weight: 700; }
.role-select select { min-height: 31px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: #101820; font-size: 11px; }
.guide-card, .content-card { padding: 17px; }
.guide-card > i { display: grid; width: 37px; height: 37px; place-items: center; margin-bottom: 13px; border-radius: 10px; color: var(--cyan); background: rgba(179,55,242,.13); }
.content-label { display: inline-block; margin-bottom: 11px; color: var(--cyan); font-size: 10px; font-weight: 800; }
.content-card time { display: block; margin-top: 13px; color: var(--muted); font-size: 10px; }
.profile-settings { display: grid; grid-template-columns: auto minmax(0, 440px); align-items: start; gap: 22px; }
.list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; background: rgba(255,255,255,.025); }
.list-item h3 { margin: 0 0 4px; font-size: 13px; }
.list-item p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; white-space: pre-line; }
.item-actions { display: flex; gap: 6px; }
.item-actions button { width: 32px; height: 32px; }
.empty { padding: 26px 14px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 8px; font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; padding: 3px 7px; border-radius: 99px; color: var(--lime); background: rgba(192,245,107,.1); font-size: 10px; font-weight: 800; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan-card { padding: 17px; }
.plan-card h3 { margin-bottom: 6px; }
.plan-price { margin: 13px 0 4px; font-size: 25px; font-weight: 800; color: var(--cyan); }
.plan-features { padding-left: 17px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(ellipse at 50% 8%, rgba(142, 50, 180, .18), transparent 34%), var(--bg); }
.auth-panel { width: min(420px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, #15212b, #0e151c); box-shadow: 0 24px 80px rgba(0,0,0,.4), inset 0 1px rgba(255,255,255,.07); }
.auth-panel h1 { margin: 21px 0 7px; font-size: 23px; }
.auth-panel > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; }
.auth-links button { padding: 4px 0; border: 0; color: var(--cyan); background: transparent; cursor: pointer; text-align: left; font-size: 11px; }
.auth-links button:hover { color: #e9b4ff; text-decoration: underline; }
.field { display: grid; gap: 6px; margin-bottom: 13px; }
.field label { color: #c1cdd4; font-size: 11px; font-weight: 700; }
.field input, .field textarea, .field select, .chat-input { width: 100%; min-height: 40px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: #0c141a; }
.field textarea { min-height: 84px; resize: vertical; }
.field input[type=checkbox] { width: 16px; min-height: 16px; accent-color: var(--cyan); }
.field input[type=date], .field input[type=datetime-local] { color-scheme: dark; }
#record-dialog { width: min(520px, calc(100% - 28px)); max-height: 88vh; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel); box-shadow: 0 30px 100px rgba(0,0,0,.65); }
#record-dialog::backdrop { background: rgba(2, 6, 10, .76); backdrop-filter: blur(4px); }
.dialog-content { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 17px; }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-fields { display: grid; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.chat-log { display: grid; gap: 10px; max-height: 420px; overflow: auto; margin-bottom: 13px; }
.chat-message { max-width: min(90%, 640px); padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.chat-message.user { justify-self: end; color: #fbf0ff; border-color: rgba(214,108,255,.24); background: rgba(179,55,242,.09); }
.chat-message.assistant { background: rgba(255,255,255,.035); }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.chat-message audio { display: block; width: min(100%, 420px); height: 36px; margin-top: 10px; }
.voice-option { display: inline-flex; align-items: center; gap: 7px; align-self: center; color: var(--muted); white-space: nowrap; font-size: 11px; }
.voice-option input { width: 15px; height: 15px; accent-color: var(--cyan); }
.admin-section { margin-top: 14px; min-width: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title h3 { margin: 0; }
.section-title > span { color: var(--muted); font-size: 11px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap table { width: 100%; min-width: 720px; border-collapse: collapse; text-align: left; font-size: 11px; }
.table-wrap th { color: var(--muted); background: rgba(255,255,255,.035); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.table-wrap th, .table-wrap td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: middle; }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap td strong, .table-wrap td small { display: block; }
.table-wrap td small { max-width: 180px; margin-top: 3px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; font-size: 9px; }
.table-empty { padding: 24px !important; color: var(--muted); text-align: center; }
.table-actions { display: flex; align-items: center; gap: 5px; }
.table-actions .icon-btn { width: 30px; height: 30px; }
.status-badge { display: inline-block; padding: 4px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: rgba(255,255,255,.035); white-space: nowrap; font-size: 9px; font-weight: 800; }
.status-badge.approved, .status-badge.active { border-color: rgba(192,245,107,.25); color: var(--lime); background: rgba(192,245,107,.08); }
.status-badge.pending, .status-badge.trial { border-color: rgba(214,108,255,.28); color: var(--cyan); background: rgba(179,55,242,.09); }
.status-badge.rejected, .status-badge.expired, .status-badge.suspended { border-color: rgba(255,114,123,.25); color: #ff9da3; background: rgba(255,114,123,.08); }
.admin-form { max-width: 700px; }
.admin-form textarea { min-height: 100px; }
.settings-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; }
.settings-form .field { min-width: 0; margin-bottom: 0; }
.settings-form .secondary-btn { justify-self: start; }
.announcement-list { display: grid; gap: 8px; }
.announcement-item { display: flex; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 7px; background: rgba(255,255,255,.025); }
.announcement-item h4 { margin: 0 0 4px; font-size: 12px; }
.announcement-item p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.announcement-item time { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
#church-dialog { width: min(540px, calc(100% - 28px)); max-height: 88vh; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel); }
#church-dialog::backdrop { background: rgba(2, 6, 10, .76); backdrop-filter: blur(4px); }
.metronome { max-width: 500px; margin: 0 auto; text-align: center; }
.bpm-value { margin: 12px 0; font-size: 66px; line-height: 1; font-weight: 800; color: var(--cyan); text-shadow: 0 0 28px rgba(80,227,208,.25); }
.bpm-value small { color: var(--muted); font-size: 14px; }
.bpm-range { width: 100%; accent-color: var(--cyan); }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: min(400px, calc(100vw - 36px)); padding: 12px 15px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #17232d; box-shadow: var(--shadow); font-size: 12px; }
.toast.error { border-color: rgba(255,114,123,.45); color: #ffc1c4; }
.toast[hidden] { display: none; }
.loading { padding: 35px; color: var(--muted); text-align: center; font-size: 12px; }
@media (max-width: 860px) {
  #app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; gap: 12px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding-bottom: 11px; }
  .nav { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 3px; }
  .nav button { width: auto; min-width: max-content; padding: 9px 11px; }
  .sidebar-foot { display: grid; margin-top: 0; }
  .workspace { padding: 17px 16px 35px; }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 20px; }
  .connection { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 12px; }
  .stat strong { font-size: 22px; }
  .list-item { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-end; }
  .bpm-value { font-size: 56px; }
  .profile-settings { grid-template-columns: 1fr; }
    .settings-form { grid-template-columns: 1fr; }
    .announcement-item { flex-direction: column; }
  .chat-form { grid-template-columns: minmax(0, 1fr) auto; }
  .chat-input { grid-column: 1 / -1; }
  .voice-option { grid-column: 1; }
  .chat-form > button { grid-column: 2; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
