:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --primary: #1e3a8a;
    --primary-light: #eff6ff;
    --accent: #d97706;
    --accent-soft: #fef3c7;
    --success: #059669;
    --success-soft: #d1fae5;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-shell {
    max-width: 720px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    padding-bottom: 48px;
}

.app-header {
    background: linear-gradient(135deg, #172554 0%, #1e3a8a 100%);
    color: #fff;
    padding: 16px 18px;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 4px 16px rgba(23, 37, 84, 0.18);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
    width: 44px; height: 44px;
    background: #ffffff;
    border-radius: 12px;
    display: grid; place-items: center;
    overflow: hidden;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}
.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
}
.brand h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.subtitle { font-size: 0.78rem; color: #bfdbfe; }

.live-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #a7f3d0;
    font-size: 0.7rem; font-weight: 700;
    padding: 4px 10px; border-radius: 999px;
}

.pulse-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #34d399;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

.hero-card {
    background: var(--surface);
    margin: 14px 16px;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.hero-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.86rem; font-weight: 600; margin-bottom: 8px;
}
.hero-meta strong { color: var(--primary); }

.progress-track {
    height: 9px; background: #e2e8f0; border-radius: 999px; overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #10b981);
    transition: width 0.35s ease;
}
.hero-hint { font-size: 0.78rem; color: var(--muted); margin-top: 8px; }

.tab-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px 12px;
    scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.84rem;
    padding: 9px 15px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    transition: 0.18s;
}
.tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.tab-btn .badge {
    background: rgba(255,255,255,0.22);
    padding: 1px 7px; border-radius: 999px; font-size: 0.72rem;
}
.tab-btn:not(.active) .badge {
    background: var(--primary-light); color: var(--primary);
}

.tab-panel { display: none; padding: 0 16px; }
.tab-panel.active { display: block; }

.filter-bar {
    display: flex; gap: 6px; overflow-x: auto;
    padding-bottom: 12px; scrollbar-width: none;
}
.pill {
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.76rem; font-weight: 500;
    padding: 6px 12px; border-radius: 999px;
    cursor: pointer;
}
.pill.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: #92400e;
    font-weight: 600;
}

.slots-list, .points-list {
    display: flex; flex-direction: column; gap: 10px;
}

.slot-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(15,23,42,0.03);
}
.slot-card.covered { border-left: 4px solid var(--success); }
.slot-card.open { border-left: 4px solid var(--accent); }

.slot-main { flex: 1; min-width: 0; }
.slot-time { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.slot-period { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.intercessor-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--success-soft);
    color: #065f46;
    font-size: 0.75rem; font-weight: 600;
    padding: 3px 9px; border-radius: 999px;
}
.chip small { font-weight: 400; opacity: 0.85; }
.chip .del-chip {
    background: none; border: none; color: #065f46;
    cursor: pointer; font-weight: 700; margin-left: 2px;
}

.slot-comments {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
}
.comment-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
    font-size: 0.74rem; font-weight: 600;
    padding: 2px 9px; border-radius: 999px;
}
.comment-badge small { font-weight: 400; color: #4f46e5; }

.open-label {
    display: inline-block; margin-top: 5px;
    font-size: 0.75rem; color: #b45309; font-weight: 500;
}

.slot-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.btn-join {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #bfdbfe;
    font-weight: 600; font-size: 0.76rem;
    padding: 7px 12px; border-radius: 10px;
    cursor: pointer; white-space: nowrap;
}
.btn-join:hover { background: var(--primary); color: #fff; }

.btn-comment {
    background: #f8fafc;
    color: #334155;
    border: 1px solid var(--border);
    font-weight: 600; font-size: 0.74rem;
    padding: 6px 10px; border-radius: 10px;
    cursor: pointer; white-space: nowrap;
}
.btn-comment:hover { background: #e2e8f0; }

.scripture-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}
.scripture-tag {
    display: inline-block;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
    color: #92400e; background: rgba(217,119,6,0.14);
    padding: 3px 8px; border-radius: 6px; margin-bottom: 8px;
    text-transform: uppercase;
}
.scripture-card h2 { font-size: 1.08rem; color: #78350f; margin-bottom: 8px; }
.scripture-card blockquote {
    font-family: 'Lora', Georgia, serif;
    font-style: italic; font-size: 0.94rem; color: #451a03;
    margin-bottom: 8px;
}
.scripture-card cite { font-size: 0.8rem; font-weight: 600; color: #92400e; font-style: normal; }

.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin: 6px 0 12px;
}
.section-header h3 { font-size: 0.96rem; font-weight: 700; }

.point-card, .admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(15,23,42,0.03);
}
.admin-card { margin-bottom: 16px; }

.login-box {
    max-width: 440px;
    margin: 12px auto;
    padding: 24px;
}
.login-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: var(--primary-light);
    display: grid; place-items: center;
    font-size: 22px;
    margin-bottom: 10px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--success-soft);
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: 0.84rem;
}

.point-top {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px;
}
.point-num {
    background: var(--primary); color: #fff;
    font-size: 0.72rem; font-weight: 700;
    padding: 2px 8px; border-radius: 6px;
}
.point-card h4 { font-size: 0.96rem; margin-bottom: 5px; }
.point-card p { font-size: 0.86rem; color: #334155; }

.btn-primary {
    background: var(--primary); color: #fff;
    border: none; border-radius: 10px;
    font-weight: 600; cursor: pointer;
    padding: 11px 18px; font-size: 0.88rem;
}
.btn-outline-sm {
    background: var(--surface); color: var(--primary);
    border: 1px solid var(--border); border-radius: 10px;
    font-weight: 600; cursor: pointer;
    padding: 6px 11px; font-size: 0.76rem;
}

.quick-phrases { display: flex; gap: 8px; flex-wrap: wrap; }
.stack-form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; color: #334155; }
input, select, textarea {
    font-family: inherit; font-size: 0.88rem;
    padding: 9px 11px; border-radius: 10px;
    border: 1px solid var(--border); background: #f8fafc;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); background: #fff;
}

.admin-point-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border); gap: 10px;
}
.admin-point-row:last-child { border-bottom: none; }
.btn-danger-sm {
    background: #fee2e2; color: #b91c1c; border: none;
    padding: 5px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 600; cursor: pointer;
}

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none; place-items: center;
    padding: 16px; z-index: 50;
}
.modal-backdrop.open { display: grid; }
.modal-card {
    background: #fff; width: 100%; max-width: 440px;
    border-radius: 18px; padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.close-btn {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted);
}

.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #0f172a; color: #fff;
    padding: 10px 18px; border-radius: 999px;
    font-size: 0.82rem; font-weight: 500;
    opacity: 0; pointer-events: none; transition: 0.25s; z-index: 60;
}
.toast.show { opacity: 1; }
.muted { font-size: 0.8rem; color: var(--muted); }
.loading-state, .empty-state {
    text-align: center; padding: 28px 16px; color: var(--muted); font-size: 0.86rem;
}

@media (max-width: 520px) {
    .form-row { grid-template-columns: 1fr; }
}

.point-html {
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.6;
}
.point-html p { margin-bottom: 8px; }
.point-html p:last-child { margin-bottom: 0; }
.point-html ul, .point-html ol {
    padding-left: 20px;
    margin: 6px 0 8px;
}
.point-html li { margin-bottom: 4px; }
.point-html blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 10px;
    color: #475569;
    font-style: italic;
    margin: 6px 0;
}
.point-html a { color: var(--primary); text-decoration: underline; }

.admin-point-body { flex: 1; min-width: 0; }
.point-html-preview ul, .point-html-preview ol { padding-left: 18px; }

.editor-group { display: flex; flex-direction: column; gap: 6px; }
.editor-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.field-label { font-size: 0.8rem; font-weight: 600; color: #334155; }
.editor-toolbar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.tool-btn {
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 7px;
    cursor: pointer;
}
.tool-btn:hover { background: #e2e8f0; }
.tool-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.rich-editor {
    min-height: 110px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text);
    overflow-y: auto;
}
.rich-editor:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}
.rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
}
.rich-editor ul, .rich-editor ol { padding-left: 20px; }
.html-source-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
}
