/* ── RESET & BASE ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #F7F5F0;
    --surface: #ffffff;
    --border: #E5E0D8;
    --text: #1a202c;
    --text-muted: #6B7280;
    --primary: #1B2A4A;
    --primary-dark: #132036;
    --accent: #D4A017;
    --accent-light: #FEF3C7;
    --success: #38a169;
    --warning: #d69e2e;
    --error: #e53e3e;
    --info: #3182ce;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(27,42,74,0.10);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(27,42,74,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, #1B2A4A 0%, #2D1B69 100%);
    border-bottom: none;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.nav-brand a { font-size: 24px; font-weight: 700; font-family: Georgia, 'Times New Roman', serif; color: #D4A017; text-decoration: none; }
.nav-subtitle { font-size: 11px; color: rgba(212,160,23,0.75); margin-left: 8px; }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.7); }
.nav-links a.active, .nav-links a:hover { color: #D4A017; text-decoration: none; }
.btn-link { background: none; border: none; color: rgba(255,255,255,0.6); font-size: 13px; cursor: pointer; padding: 0; }
.btn-link:hover { color: #D4A017; }

/* Nav dropdowns */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.7);
    display: flex; align-items: center; gap: 4px;
}
.nav-dropdown-trigger:hover,
.nav-dropdown-trigger.active { color: #D4A017; }
.nav-caret { font-size: 10px; opacity: 0.7; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1B2A4A;
    border: 1px solid rgba(212,160,23,0.2);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 140px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 200;
}
.nav-dropdown-right { left: auto; right: 0; }
.nav-dropdown-menu a {
    display: block; padding: 8px 16px;
    font-size: 13px; font-weight: 500;
    color: rgba(255,255,255,0.75);
    text-decoration: none; white-space: nowrap;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active { color: #D4A017; background: rgba(212,160,23,0.08); }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 16px; border-radius: var(--radius); border: none;
    font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: linear-gradient(135deg, #D4A017, #F59E0B); color: #1B2A4A; font-weight: 600; }
.btn-primary:hover { background: linear-gradient(135deg, #c49010, #e8900a); opacity: 1; }
.btn-secondary { background: transparent; color: var(--text); border: 1.5px solid var(--border); font-weight: 500; }
.btn-secondary:hover { background: var(--surface-raised); opacity: 1; }
.btn-sm { padding: 4px 10px; font-size: 12px; background: var(--border); color: var(--text); }
.btn-sm:hover { background: #d8d0c4; opacity: 1; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; }

/* ── PAGE HEADERS ────────────────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px; gap: 16px;
    background: linear-gradient(135deg, #1B2A4A 0%, #2D3561 100%);
    color: white;
    padding: 24px 32px;
    border-radius: var(--radius);
}
.page-header h1 { font-size: 28px; font-weight: 700; font-family: Georgia, 'Times New Roman', serif; color: white; }
.page-header .btn-sm { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.3); }
.page-header .btn-sm:hover { background: rgba(255,255,255,0.25); }
.page-header .sermon-meta { color: rgba(255,255,255,0.7); }
.page-header .scripture-refs { color: rgba(255,255,255,0.65); }
.page-header .badge { background: rgba(255,255,255,0.2); color: white; }
.page-header .badge-outline { border-color: rgba(255,255,255,0.35); color: rgba(255,255,255,0.7); }
.page-header .tag { background: rgba(212,160,23,0.2); color: #FEF3C7; }
.breadcrumb { font-size: 12px; color: rgba(255,255,255,0.6); margin-bottom: 4px; }
.breadcrumb a { color: rgba(255,255,255,0.6); }
.breadcrumb a:hover { color: #D4A017; }

/* ── CHIPS / BADGES ──────────────────────────────────────────────────────── */
.chip {
    display: inline-block; padding: 2px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 500; white-space: nowrap;
}
.chip-generated { background: #E0E7FF; color: #3730A3; }
.chip-published, .chip-sent, .chip-complete { background: #D1FAE5; color: #065F46; }
.chip-scheduled { background: #EDE9FE; color: #5B21B6; }
.chip-pending { background: #FEF3C7; color: #92400E; }
.chip-in-progress { background: #DBEAFE; color: #1E40AF; }
.chip-needs-review { background: #FFE4E6; color: #9F1239; }
.chip-posted { background: #CCFBF1; color: #0F766E; }
.chip-done { background: #D1FAE5; color: #065F46; }
.chip-none { background: transparent; color: var(--text-muted); }

.badge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--primary); color: white; }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.tag { display: inline-block; padding: 2px 8px; background: #ebf8ff; color: #2b6cb0; border-radius: 12px; font-size: 11px; margin: 2px; }
.tag-topic    { background: #ebf4ff; color: #2b6cb0; }
.tag-theme    { background: #f0fff4; color: #276749; }
.tag-scripture { background: #fffaf0; color: #c05621; }
.tag-speaker  { background: #faf5ff; color: #6b46c1; }

.tag-cell { min-width: 120px; }
.tag-edit-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 4px; vertical-align: middle; }
.tag-edit-btn:hover { color: var(--primary); }
.tag-input-wrap { display: none; margin-top: 4px; }
.tag-input-wrap.visible { display: block; }
.tag-input { font-size: 12px; padding: 4px 8px; width: 100%; min-width: 160px; }

.search-bar { flex: 1; max-width: 320px; }
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── ALERTS ──────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fff5f5; border: 1px solid #fed7d7; color: #c53030; }
.alert-info { background: #ebf8ff; border: 1px solid #bee3f8; color: #2b6cb0; }

/* ── AUTH ────────────────────────────────────────────────────────────────── */
.auth-card {
    max-width: 420px; margin: 80px auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 40px; box-shadow: var(--shadow-md);
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 24px; font-weight: 700; }
.auth-header p { color: var(--text-muted); margin-top: 4px; }
.auth-form .field + .field { margin-top: 16px; }
.auth-form .btn { margin-top: 24px; }

/* ── FORMS ───────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 500; }
.field-hint { font-size: 11px; color: var(--text-muted); }
.required { color: var(--error); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.field-group { margin-bottom: 16px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="url"], input[type="number"],
input[type="file"], select, textarea {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; background: var(--surface); color: var(--text);
    transition: border-color 0.15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input[type="file"] { padding: 6px; cursor: pointer; }

/* ── DASHBOARD ───────────────────────────────────────────────────────────── */
.filters {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.filter-form { display: flex; align-items: center; gap: 8px; }
.filter-form select { width: auto; }
.sermon-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }

.sermon-table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.sermon-table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    font-size: 13px;
}
.sermon-table th {
    padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 600;
    text-transform: uppercase; color: var(--text-muted);
    background: var(--bg); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.sermon-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sermon-table tr:last-child td { border-bottom: none; }
.sermon-table tr:hover td { background: #FEF9F0; }

.date-cell { white-space: nowrap; color: var(--text-muted); font-size: 12px; }
.title-cell a { font-weight: 500; }
.processing-badge { display: inline-block; margin-left: 6px; font-size: 10px; background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 10px; }
.error-badge { display: inline-block; margin-left: 6px; font-size: 10px; background: #fed7d7; color: #c53030; padding: 1px 6px; border-radius: 10px; }
.pending-badge { display: inline-block; margin-left: 6px; font-size: 10px; background: var(--border); color: var(--text-muted); padding: 1px 6px; border-radius: 10px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .btn { margin-top: 16px; }

/* ── UPLOAD ──────────────────────────────────────────────────────────────── */
.upload-card { max-width: 680px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.upload-form .field { margin-bottom: 16px; }
.upload-actions { margin-top: 24px; display: flex; align-items: center; gap: 16px; }
.upload-hint { font-size: 12px; color: var(--text-muted); }

/* ── SERMON DETAIL ───────────────────────────────────────────────────────── */
.sermon-meta { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.scripture-refs { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.theme-tags { margin: 6px 0; }
.sermon-header-actions { display: flex; align-items: center; gap: 8px; }

.header-edit-input {
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent;
    padding: 0;
    font: inherit;
    color: inherit;
    width: 100%;
    cursor: text;
}
.header-edit-input:hover {
    border-bottom-color: var(--border);
}
.header-edit-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
    background: var(--surface);
    border-radius: 3px;
    padding: 2px 4px;
}

.processing-banner {
    display: flex; align-items: center; gap: 10px;
    background: #fffbeb; border: 1px solid #f6e05e; border-radius: var(--radius);
    padding: 12px 16px; margin-bottom: 20px; font-size: 13px; color: #744210;
}
.processing-banner.pending { background: #f7fafc; border-color: var(--border); color: var(--text-muted); }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 18px; height: 18px; border: 2px solid #f6e05e;
    border-top-color: #744210; border-radius: 50%;
    animation: spin 0.8s linear infinite; flex-shrink: 0;
}

/* ── TABS ────────────────────────────────────────────────────────────────── */
.tabs { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tab-nav {
    display: flex; border-bottom: 1px solid var(--border);
    background: var(--bg); overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-link {
    padding: 12px 18px; font-size: 13px; font-weight: 500;
    color: var(--text-muted); white-space: nowrap; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    text-decoration: none;
}
.tab-link:hover { color: var(--text); text-decoration: none; }
.tab-link.active { color: var(--accent); border-bottom-color: var(--accent); }

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

/* ── PLATFORM STATUS ─────────────────────────────────────────────────────── */
.platform-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
.platform-status { display: flex; flex-direction: column; gap: 6px; }
.status-row { display: flex; align-items: center; gap: 8px; }
.status-row label { font-size: 12px; color: var(--text-muted); min-width: 70px; }
.status-row select, .status-row input { width: auto; font-size: 12px; padding: 4px 8px; }
.status-select { font-size: 13px; font-weight: 500; }

/* ── CONTENT BLOCKS ──────────────────────────────────────────────────────── */
.content-block { background: var(--bg); border-radius: var(--radius); padding: 16px; }
.content-text { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.7; color: var(--text); }
.content-editable { width: 100%; min-height: 300px; resize: vertical; border: none; background: transparent; font-family: inherit; font-size: 13px; line-height: 1.7; color: var(--text); white-space: pre-wrap; word-break: break-word; outline: none; padding: 0; box-sizing: border-box; }
.content-editable:focus { outline: 1px dashed var(--border); border-radius: 4px; padding: 4px; }

/* ── QUOTES ──────────────────────────────────────────────────────────────── */
.quotes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-items: stretch; }
.quote-card { background: var(--bg); border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; padding: 16px; display: flex; flex-direction: column; height: 100%; }
.quote-card blockquote { font-style: italic; font-size: 14px; line-height: 1.6; color: var(--text); flex: 1; }
.quote-card cite { display: block; margin-top: 8px; font-size: 12px; color: var(--text-muted); }

/* ── REELS ───────────────────────────────────────────────────────────────── */
.reels-list { display: flex; flex-direction: column; gap: 16px; }
.reel-card { background: var(--bg); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.reel-number { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.reel-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.reel-section { font-size: 13px; margin-bottom: 6px; }
.reel-section strong { color: var(--text-muted); font-size: 11px; text-transform: uppercase; display: block; }
.reel-card .reel-divider { margin-top: auto; }

/* ── CAROUSELS ───────────────────────────────────────────────────────────── */
.carousels-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: stretch; }
.carousel-card { background: var(--bg); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; height: 100%; }
.carousel-number { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.carousel-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.carousel-card .reel-divider { margin-top: auto; }
.slide-list { padding-left: 18px; }
.slide-list li { font-size: 13px; padding: 3px 0; }

/* ── CONTENT VIEW ────────────────────────────────────────────────────────── */
.content-view-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.content-view-text { white-space: pre-wrap; word-break: break-word; font-family: 'Courier New', monospace; font-size: 13px; line-height: 1.7; color: var(--text); }

/* ── INLINE FORMS ────────────────────────────────────────────────────────── */
.inline-form { display: inline; }

/* ── MISC ────────────────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* ── REGENERATE ──────────────────────────────────────────────────────────── */
.btn-regen { color: var(--text-muted); border-color: var(--border); background: var(--bg); }
.btn-regen:hover { color: var(--primary); border-color: var(--primary); background: var(--surface); }
.regen-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); font-style: italic; }
.spinner-sm { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
.notes-cell {
    max-width: 200px;
    white-space: normal;
    word-break: break-word;
    vertical-align: top;
}

tr.group-header td {
    background: var(--bg);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 6px 10px;
    border-top: 2px solid var(--border);
}

@media (max-width: 768px) {
    .container { padding: 16px; }
    .field-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .sermon-table th:nth-child(n+5), .sermon-table td:nth-child(n+5) { display: none; }
    .navbar { padding: 0 16px; }
    .nav-subtitle { display: none; }
}

/* ── DASHBOARD TIMESTAMPS SUMMARY ─────────────────────────────── */
.ts-dash-summary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ts-dash-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ts-dash-type { font-size: 12px; font-weight: 600; color: var(--text); min-width: 52px; text-decoration: none; }
.ts-dash-type:hover { color: var(--primary); }
.ts-dash-stat {
    font-size: 12px; padding: 3px 10px; border-radius: 99px;
    text-decoration: none; white-space: nowrap;
    border: 1px solid var(--border); color: var(--text-muted);
}
.ts-dash-stat:hover { border-color: var(--primary); color: var(--primary); }
.ts-dash-n { font-weight: 600; color: var(--text); }
.ts-dash-pending     { background: #fef3c7; border-color: #f6e05e; }
.ts-dash-in-progress { background: #dbeafe; border-color: #93c5fd; }
.ts-dash-done        { background: #d1fae5; border-color: #6ee7b7; }
.ts-dash-posted      { background: #ede9fe; border-color: #c4b5fd; }

/* ── TIMESTAMPS BOARD ──────────────────────────────────────────── */
.ts-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.ts-column-header {
    font-weight: 600;
    font-size: 14px;
    padding: 0 0 10px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ts-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.ts-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.ts-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ts-sermon-link {
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}
.ts-sermon-link:hover { text-decoration: underline; }

.ts-date { font-size: 11px; color: var(--text-muted); }

.ts-card-title {
    font-weight: 500;
    font-size: 14px;
    margin: 2px 0 6px;
    color: var(--primary);
    cursor: pointer;
}
.ts-card-title:hover { text-decoration: underline; }

.ts-card-notes-preview {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.4;
}

.ts-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }

.ts-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-top: 4px;
}

.ts-times { color: var(--text-muted); }

.ts-col-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 20px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* Status badges */
.ts-status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
}
.ts-status-select {
    border: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    line-height: normal;
    width: auto;
}
.ts-status-select:focus { outline: none; }

.ts-cloud-link {
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.ts-cloud-link:hover { opacity: 1; color: var(--primary); }

.ts-cloud-input {
    width: 100%;
    font-size: 12px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
}
.ts-cloud-input:focus { outline: none; border-color: var(--primary); }

.ts-cloud-open-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.ts-cloud-open-link:hover { text-decoration: underline; }
.status-pending     { background: #FEF3C7; color: #92400E; }
.status-in-progress { background: #DBEAFE; color: #1E40AF; }
.status-done        { background: #D1FAE5; color: #065F46; }
.status-ready-to-use { background: #D1FAE5; color: #065F46; }
.status-posted      { background: #CCFBF1; color: #0F766E; }
.status-scheduled   { background: #EDE9FE; color: #5B21B6; }
.status-generated   { background: #E0E7FF; color: #3730A3; }
.status-needs-review { background: #FFE4E6; color: #9F1239; }

/* ── SERMON GROUP HEADERS ──────────────────────────────────────── */
.ts-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: var(--radius);
    margin-bottom: 6px;
    margin-top: 14px;
}
.ts-group-header:first-child { margin-top: 0; }
.ts-group-header:hover { background: var(--bg); }
.ts-group-chevron { font-size: 11px; color: var(--text-muted); width: 12px; flex-shrink: 0; }
.ts-group-title { font-weight: 600; font-size: 13px; flex: 1; }
.ts-group-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── STAT CARDS ────────────────────────────────────────────────── */
.ts-stat-cards {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.ts-stat-card {
    flex: 1;
    min-width: 130px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ts-stat-card:hover { border-color: var(--accent); }
.ts-stat-card.ts-stat-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
.ts-stat-label { font-weight: 600; font-size: 13px; color: var(--text); }
.ts-stat-counts { font-size: 12px; color: var(--text-muted); }

/* Per-status border colors */
.ts-stat-card.ts-stat-pending     { border-color: #92400E; }
.ts-stat-card.ts-stat-in-progress { border-color: #1E40AF; }
.ts-stat-card.ts-stat-ready       { border-color: #065F46; }
.ts-stat-card.ts-stat-posted      { border-color: #0F766E; }
.ts-stat-card.ts-stat-pending.ts-stat-active     { box-shadow: 0 0 0 1px #92400E; }
.ts-stat-card.ts-stat-in-progress.ts-stat-active { box-shadow: 0 0 0 1px #1E40AF; }
.ts-stat-card.ts-stat-ready.ts-stat-active       { box-shadow: 0 0 0 1px #065F46; }
.ts-stat-card.ts-stat-posted.ts-stat-active      { box-shadow: 0 0 0 1px #0F766E; }

/* ── CARD MODAL ────────────────────────────────────────────────── */
.ts-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 200;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
}
.ts-modal-overlay.visible { display: flex; }

.ts-modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    display: grid;
    grid-template-columns: 1fr 190px;
    gap: 24px;
    position: relative;
}

.ts-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}
.ts-modal-close:hover { color: var(--text); }

.ts-modal-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.ts-modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
    cursor: text;
    border-radius: 4px;
    padding: 2px 4px;
    outline: none;
}
.ts-modal-title:hover { background: var(--hover, rgba(0,0,0,0.04)); }
.ts-modal-title[contenteditable="true"] {
    background: var(--hover, rgba(0,0,0,0.04));
    box-shadow: 0 0 0 2px var(--primary);
}

.ts-modal-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.ts-modal-notes {
    width: 100%;
    min-height: 180px;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    box-sizing: border-box;
}
.ts-modal-notes:focus { outline: none; border-color: var(--primary); }

.ts-modal-sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 14px 0 5px;
}
.ts-modal-sidebar-label:first-child { margin-top: 0; }

.ts-modal-tags-display { display: flex; flex-wrap: wrap; gap: 4px; }

.ts-modal-dates {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

@media (max-width: 768px) {
    .ts-board { grid-template-columns: 1fr; }
    .ts-modal { grid-template-columns: 1fr; }
}
