/* ============================================================
   Family To-Do v2 — Style Sheet
   Design: Touch-first, no dropdowns, color-coded streams
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --primary: #1565c0;
    --primary-light: #e3f0ff;
    --nav-h: 52px;
    --bottom-nav-h: 62px;
    --panel-radius: 20px;
    --card-radius: 14px;

    /* Streams */
    --c-office:     #1565c0;
    --c-office-bg:  #e3f0ff;
    --c-home:       #2e7d32;
    --c-home-bg:    #e8f5e9;
    --c-dev:        #e65100;
    --c-dev-bg:     #fff3e0;

    /* Priorities */
    --c-urgent: #c62828;
    --c-high:   #e65100;
    --c-medium: #f9a825;
    --c-low:    #388e3c;

    /* Status */
    --c-pending:    #546e7a;
    --c-inprogress: #1565c0;
    --c-onhold:     #f57f17;
    --c-done:       #2e7d32;
    --c-cancelled:  #6d4c41;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7a99;
    --border: #e0e5f0;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
}

/* Dark mode */
[data-dark] {
    --bg: #121212;
    --surface: #1e1e2e;
    --text: #e8eaf6;
    --text-muted: #9aa5cc;
    --border: #2e3050;
    --shadow: 0 2px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --primary-light: #1a2a4a;
}

/* Theme overrides via data-theme */
[data-theme="Forest Green"]    { --primary: #2e7d32; --primary-light: #e8f5e9; }
[data-theme="Deep Purple"]     { --primary: #6a1b9a; --primary-light: #f3e5f5; }
[data-theme="Sunset Orange"]   { --primary: #e65100; --primary-light: #fff3e0; }
[data-theme="Rose Pink"]       { --primary: #880e4f; --primary-light: #fce4ec; }
[data-theme="Midnight Black"]  { --primary: #212121; --primary-light: #f5f5f5; }
[data-theme="Slate Grey"]      { --primary: #37474f; --primary-light: #eceff1; }
[data-theme="Teal"]            { --primary: #00695c; --primary-light: #e0f2f1; }
[data-theme="Crimson Red"]     { --primary: #b71c1c; --primary-light: #ffebee; }
[data-theme="Golden Amber"]    { --primary: #f57f17; --primary-light: #fffde7; }

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font: inherit; }
textarea, input { font: inherit; }
.hidden { display: none !important; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #0d47a1 100%);
}
.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 16px;
}
.login-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 36px 28px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-icon-wrap { margin-bottom: 16px; }
.login-title { font-size: 1.75rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-sub { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 28px; }
.login-error {
    background: #ffebee; border: 1px solid #ffcdd2; color: #c62828;
    padding: 10px 14px; border-radius: 10px; font-size: 0.875rem;
    margin-bottom: 16px; text-align: left;
}
.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 14px 20px;
    background: #ffffff; border: 2px solid var(--border);
    border-radius: 12px; font-size: 1rem; font-weight: 600; color: var(--text);
    transition: box-shadow .2s, transform .1s;
}
.btn-google:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.btn-google:active { transform: scale(0.98); }
.login-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 20px; line-height: 1.6; }

/* ============================================================
   APP SHELL
   ============================================================ */

/* Navbar */
.app-navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    height: var(--nav-h);
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.navbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 100%; padding: 0 14px;
}
.navbar-brand {
    display: flex; align-items: center; gap: 8px;
    color: #fff; font-weight: 700; font-size: 1.05rem;
}
.brand-text { display: inline; }
.navbar-right { display: flex; align-items: center; gap: 8px; position: relative; }
.offline-badge {
    background: #ff9800; color: #fff; font-size: 0.72rem; font-weight: 700;
    padding: 3px 8px; border-radius: 999px;
}

/* Icon button */
.icon-btn {
    background: rgba(255,255,255,0.15); color: #fff;
    border-radius: 8px; padding: 6px 9px; font-size: 1rem;
    transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.25); }

/* User avatar button */
.user-avatar-btn {
    background: rgba(255,255,255,0.2); border-radius: 50%;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    overflow: hidden; color: #fff; font-weight: 700;
}
.user-avatar-btn img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.avatar-fallback { font-size: 1rem; color: #fff; font-weight: 700; }

/* User dropdown */
.user-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-lg);
    min-width: 200px; z-index: 300; overflow: hidden;
}
.user-info { padding: 12px 16px; }
.user-info strong { display: block; font-size: 0.9rem; color: var(--text); }
.user-info span { font-size: 0.78rem; color: var(--text-muted); }
.dropdown-hr { border: none; border-top: 1px solid var(--border); margin: 0; }
.dropdown-item-danger {
    display: block; width: 100%; padding: 12px 16px;
    text-align: left; color: #c62828; font-size: 0.9rem;
    transition: background .15s;
}
.dropdown-item-danger:hover { background: #ffebee; }

/* Offline banner */
.offline-banner {
    position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 190;
    background: #ff9800; color: #fff; text-align: center;
    padding: 8px 12px; font-size: 0.85rem; font-weight: 600;
}

/* App Main */
.app-main {
    padding-top: var(--nav-h);
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
    min-height: 100vh;
    max-width: 680px; margin: 0 auto;
}

/* Tab pane */
.tab-pane { padding: 12px 14px; }

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    height: var(--bottom-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-around;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    flex: 1; padding: 6px 4px;
    color: var(--text-muted); font-size: 0.7rem; font-weight: 600;
    transition: color .2s;
    position: relative;
    isolation: isolate;
}
.nav-btn .nav-icon { font-size: 1.4rem; line-height: 1; }
.nav-btn.active {
    color: #ffffff;
}
.nav-btn.active::before {
    content: '';
    position: absolute;
    top: 2px; bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    background: linear-gradient(135deg, #2e7d32, #43a047);
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(46, 125, 50, 0.45);
    z-index: -1;
}

/* ============================================================
   SUMMARY ROW
   ============================================================ */
.summary-row {
    display: flex; gap: 10px; margin-bottom: 14px;
}
.summary-card {
    flex: 1; background: var(--surface); border-radius: var(--card-radius);
    padding: 14px 10px; text-align: center;
    box-shadow: var(--shadow);
}
.summary-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.summary-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-top: 4px; }
.summary-pending .summary-num { color: var(--c-pending); }
.summary-today .summary-num { color: var(--c-onhold); }
.summary-overdue .summary-num { color: var(--c-urgent); }

/* ============================================================
   CHIP BAR (filter chips)
   ============================================================ */
.chip-bar {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
    scrollbar-width: none; margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}
.chip-bar::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0;
    padding: 6px 14px; border-radius: 999px;
    background: var(--surface); border: 1.5px solid var(--border);
    font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
    transition: all .15s; white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-urgent.active  { background: var(--c-urgent); border-color: var(--c-urgent); color: #fff; }
.chip-danger.active  { background: var(--c-urgent); border-color: var(--c-urgent); color: #fff; }
.chip-today.active   { background: var(--c-onhold); border-color: var(--c-onhold); color: #fff; }
.chip-inprogress.active { background: var(--c-inprogress); border-color: var(--c-inprogress); color: #fff; }
.chip-done.active    { background: var(--c-done); border-color: var(--c-done); color: #fff; }

/* ============================================================
   SEARCH
   ============================================================ */
.search-wrap {
    position: relative; margin-bottom: 12px;
}
.search-icon-inner {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    font-size: 0.95rem; pointer-events: none;
}
.search-input {
    width: 100%; padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--border); border-radius: 12px;
    background: var(--surface); color: var(--text);
    font-size: 0.9rem;
    transition: border-color .15s;
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   TASK CARDS
   ============================================================ */
.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-card {
    background: var(--surface);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--border);
    overflow: hidden;
    transition: box-shadow .15s;
}
.task-card:active { box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* Stream left-border colors */
.task-card.stream-office    { border-left-color: var(--c-office); }
.task-card.stream-home      { border-left-color: var(--c-home); }
.task-card.stream-devotional { border-left-color: var(--c-dev); }

.task-card.status-done { opacity: 0.65; }

.card-body { padding: 12px 14px; }

.card-top {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
    margin-bottom: 8px;
}
.card-title {
    font-size: 0.97rem; font-weight: 700; color: var(--text); flex: 1;
    line-height: 1.4;
}
.card-pri-badge {
    flex-shrink: 0; font-size: 1rem; line-height: 1;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

/* Status badge */
.tag-status {
    padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
    cursor: pointer; user-select: none; transition: opacity .15s;
}
.tag-status:active { opacity: 0.75; }
.status-pending    { background: #eceff1; color: var(--c-pending); }
.status-inprogress { background: #e3f0ff; color: var(--c-inprogress); }
.status-onhold     { background: #fff8e1; color: var(--c-onhold); }
.status-done       { background: #e8f5e9; color: var(--c-done); }
.status-cancelled  { background: #efebe9; color: var(--c-cancelled); }

/* Due date badge */
.tag-due {
    padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
    background: var(--primary-light); color: var(--primary);
}
.tag-due.overdue { background: #ffebee; color: var(--c-urgent); }
.tag-due.today   { background: #fff8e1; color: var(--c-onhold); }

/* Category badge */
.tag-cat {
    padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
    background: var(--bg); color: var(--text-muted); border: 1px solid var(--border);
}

.card-footer {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.78rem; color: var(--text-muted);
}
.card-assignee { font-size: 0.78rem; }

.card-actions { display: flex; gap: 4px; }
.card-btn {
    padding: 6px 9px; border-radius: 8px; font-size: 0.85rem;
    background: transparent; color: var(--text-muted);
    transition: background .15s, color .15s;
    min-width: 34px; min-height: 34px;
    display: flex; align-items: center; justify-content: center;
}
.card-btn:hover { background: var(--bg); color: var(--text); }
.card-btn.btn-done  { color: var(--c-done); }
.card-btn.btn-edit  { color: var(--primary); }
.card-btn.btn-del   { color: var(--c-urgent); }

/* --- Inline Edit Form inside card --- */
.inline-edit-wrap { padding: 12px 14px; }
.inline-edit-wrap .add-title-input {
    font-size: 0.95rem; margin-bottom: 10px;
}
.edit-field-row { margin-bottom: 10px; }
.edit-field-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }

/* Delete confirm strip */
.delete-confirm-strip {
    background: #ffebee; padding: 10px 14px;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.85rem; color: var(--c-urgent); font-weight: 600;
    border-top: 1px solid #ffcdd2;
}
.delete-confirm-strip .del-actions { display: flex; gap: 8px; }
.btn-del-confirm { background: var(--c-urgent); color: #fff; padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 0.85rem; }
.btn-del-cancel  { background: var(--bg); color: var(--text-muted); padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 0.85rem; }

.edit-action-row {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px;
}
.btn-cancel-edit {
    padding: 9px 18px; border-radius: 10px;
    background: var(--bg); color: var(--text-muted); font-weight: 700; font-size: 0.85rem;
}
.btn-save-edit {
    padding: 9px 22px; border-radius: 10px;
    background: var(--primary); color: #fff; font-weight: 700; font-size: 0.85rem;
}

/* Empty state */
.empty-state { text-align: center; padding: 52px 20px; }
.empty-icon  { font-size: 3.5rem; margin-bottom: 12px; }
.empty-text  { font-size: 1rem; color: var(--text-muted); }

/* Group By row */
.groupby-row {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 10px; flex-wrap: wrap;
}
.groupby-label {
    font-size: 0.73rem; font-weight: 800; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 0.05em; white-space: nowrap;
    margin-right: 2px;
}
.groupby-chip {
    padding: 4px 12px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 700;
    background: var(--bg); border: 1.5px solid var(--border);
    color: var(--text-muted); transition: all .15s;
}
.groupby-chip.active {
    background: var(--primary-light); border-color: var(--primary);
    color: var(--primary);
}

/* Group header used for all group-by modes */
.group-header-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 4px 4px; cursor: pointer; user-select: none;
    border-bottom: 2px solid var(--border); margin-bottom: 8px;
}
.group-header-row h3 {
    font-size: 0.8rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted);
    display: flex; align-items: center; gap: 6px; margin: 0;
}
.group-header-row .group-count {
    font-size: 0.72rem; font-weight: 700;
    background: var(--bg); color: var(--text-muted);
    border-radius: 999px; padding: 1px 7px; border: 1px solid var(--border);
}
.group-header-row .collapse-arrow { font-size: 0.75rem; color: var(--text-muted); }
.task-group { margin-bottom: 14px; }
.task-group.collapsed .group-tasks { display: none; }

/* Stream tint on group header */
.group-stream-office   h3 { color: var(--c-office); border-color: var(--c-office); }
.group-stream-home     h3 { color: var(--c-home); border-color: var(--c-home); }
.group-stream-devotional h3 { color: var(--c-dev); border-color: var(--c-dev); }

/* ============================================================
   ADD TASK PANEL  — permanent card, scrolls with page content
   ============================================================ */
.add-task-panel {
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    margin-top: 18px;
    overflow: hidden;
}

.add-panel-title {
    padding: 12px 16px 0;
    font-size: 0.82rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--primary);
}

/* Assign To / By side by side */
.assign-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 4px;
}
.assign-col { min-width: 0; }

/* Body always visible */
.add-panel-body {
    padding: 8px 14px 16px;
}

/* Textarea for new task title */
.add-title-input {
    width: 100%; padding: 12px 14px;
    border: 2px solid var(--border); border-radius: 12px;
    background: var(--bg); color: var(--text);
    font-size: 1rem; line-height: 1.5; resize: none;
    transition: border-color .15s;
    margin-bottom: 2px;
}
.add-title-input:focus { outline: none; border-color: var(--primary); background: var(--surface); }

.add-notes-input {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: 10px;
    background: var(--bg); color: var(--text);
    font-size: 0.88rem; resize: none;
    transition: border-color .15s;
}
.add-notes-input:focus { outline: none; border-color: var(--primary); }

.field-label {
    font-size: 0.75rem; font-weight: 800; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 0.05em;
    margin: 10px 0 5px;
}
.field-optional { font-weight: 400; text-transform: none; letter-spacing: 0; }

/* Generic button-row */
.btn-seg-row {
    display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; padding-bottom: 3px;
    -webkit-overflow-scrolling: touch;
}
.btn-seg-row::-webkit-scrollbar { display: none; }
.btn-seg-row.wrap-row { flex-wrap: wrap; overflow-x: visible; }

/* Stream segment buttons */
.seg-stream-btn {
    flex: 1; min-width: 80px; padding: 11px 8px;
    border-radius: 12px; font-size: 0.85rem; font-weight: 700;
    border: 2px solid var(--border); background: var(--bg); color: var(--text);
    transition: all .15s; white-space: nowrap; text-align: center;
}
.seg-stream-btn.active,
.seg-stream-btn:focus { outline: none; }
.seg-stream-btn.stream-office-btn.active  { background: var(--c-office); border-color: var(--c-office); color: #fff; }
.seg-stream-btn.stream-home-btn.active    { background: var(--c-home); border-color: var(--c-home); color: #fff; }
.seg-stream-btn.stream-dev-btn.active     { background: var(--c-dev); border-color: var(--c-dev); color: #fff; }

/* Stream button background tints (inactive) */
.seg-stream-btn.stream-office-btn  { border-color: var(--c-office); color: var(--c-office); background: var(--c-office-bg); }
.seg-stream-btn.stream-home-btn    { border-color: var(--c-home); color: var(--c-home); background: var(--c-home-bg); }
.seg-stream-btn.stream-dev-btn     { border-color: var(--c-dev); color: var(--c-dev); background: var(--c-dev-bg); }

/* Priority segment buttons */
.seg-pri-btn {
    flex: 1; min-width: 60px; padding: 9px 6px;
    border-radius: 10px; font-size: 0.8rem; font-weight: 700;
    border: 2px solid var(--border); background: var(--bg); color: var(--text);
    transition: all .15s; text-align: center;
}
.seg-pri-btn.pri-urgent { border-color: var(--c-urgent); color: var(--c-urgent); }
.seg-pri-btn.pri-high   { border-color: var(--c-high);   color: var(--c-high); }
.seg-pri-btn.pri-medium { border-color: var(--c-medium); color: #795403; }
.seg-pri-btn.pri-low    { border-color: var(--c-low);    color: var(--c-low); }
.seg-pri-btn.active     { color: #fff !important; }
.seg-pri-btn.pri-urgent.active { background: var(--c-urgent); border-color: var(--c-urgent); }
.seg-pri-btn.pri-high.active   { background: var(--c-high);   border-color: var(--c-high); }
.seg-pri-btn.pri-medium.active { background: var(--c-medium); border-color: var(--c-medium); }
.seg-pri-btn.pri-low.active    { background: var(--c-low);    border-color: var(--c-low); }

/* Due date chips */
.chip-due {
    flex-shrink: 0; padding: 7px 14px; border-radius: 999px;
    font-size: 0.82rem; font-weight: 700;
    background: var(--bg); border: 1.5px solid var(--border); color: var(--text-muted);
    transition: all .15s; white-space: nowrap;
}
.chip-due.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Sub-category mini chips */
.seg-cat-btn {
    padding: 5px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
    background: var(--bg); border: 1.5px solid var(--border); color: var(--text-muted);
    flex-shrink: 0; transition: all .15s;
}
.seg-cat-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* Member name buttons (assign to / by) */
.member-avatar-btn {
    display: inline-flex; align-items: center;
    padding: 5px 12px; border-radius: 999px;
    background: var(--bg); border: 2px solid var(--border); color: var(--text-muted);
    font-size: 0.8rem; font-weight: 700; transition: all .15s;
}
.member-avatar-btn.active {
    border-color: var(--primary); background: var(--primary-light);
    color: var(--primary);
}

/* Validation error */
.validation-error {
    background: #ffebee; border-radius: 8px; color: var(--c-urgent);
    padding: 8px 12px; font-size: 0.85rem; margin: 8px 0;
}

/* Big Add Task button */
.btn-add-task {
    width: 100%; margin-top: 12px; padding: 15px 20px;
    background: var(--primary); color: #fff;
    border-radius: 14px; font-size: 1.1rem; font-weight: 800;
    letter-spacing: 0.03em; transition: opacity .15s, transform .1s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.btn-add-task:active { opacity: 0.85; transform: scale(0.98); }

/* ============================================================
   FAMILY BOARD — MEMBER GRID
   ============================================================ */
.member-grid {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.member-tile {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 16px; min-width: 72px;
    background: var(--surface); border: 2px solid var(--border);
    border-radius: 14px; font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
    transition: all .15s; position: relative;
}
.member-tile-icon { font-size: 1.5rem; line-height: 1; }
.member-tile-name { text-align: center; }
.member-tile-badge {
    position: absolute; top: 4px; right: 4px;
    background: var(--primary); color: #fff; border-radius: 999px;
    font-size: 0.66rem; font-weight: 800; padding: 1px 5px;
    min-width: 18px; text-align: center;
}
.member-tile-badge.has-overdue { background: var(--c-urgent); }
.member-tile.active {
    background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}
.member-section-header {
    font-size: 0.78rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted);
    margin: 14px 0 6px; letter-spacing: 0.05em;
    display: flex; align-items: center; gap: 6px;
}
.member-section-header::before { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-section-title {
    font-size: 0.78rem; font-weight: 800; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 0.05em; margin-bottom: 8px;
}

.kpi-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px;
}
.kpi-card {
    background: var(--surface); border-radius: var(--card-radius);
    padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.kpi-num   { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.kpi-label { font-size: 0.73rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-top: 4px; }
.kpi-total   .kpi-num { color: var(--text); }
.kpi-active  .kpi-num { color: var(--c-inprogress); }
.kpi-overdue .kpi-num { color: var(--c-urgent); }
.kpi-done    .kpi-num { color: var(--c-done); }

.dash-filter-row { background: var(--surface); border-radius: var(--card-radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.dash-filter-group { margin-bottom: 10px; }
.dash-filter-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }
.btn-group-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
    padding: 7px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 700;
    background: var(--bg); border: 1.5px solid var(--border); color: var(--text-muted);
    transition: all .15s;
}
.seg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg-btn.stream-office-btn.active { background: var(--c-office); border-color: var(--c-office); color: #fff; }
.seg-btn.stream-home-btn.active   { background: var(--c-home);   border-color: var(--c-home); color: #fff; }
.seg-btn.stream-dev-btn.active    { background: var(--c-dev);    border-color: var(--c-dev); color: #fff; }
.seg-btn-success.active { background: var(--c-done); border-color: var(--c-done); color: #fff; }
.dash-date-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 8px; }
.dash-date-input { border: 1.5px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 0.82rem; color: var(--text); background: var(--bg); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chart-card { background: var(--surface); border-radius: var(--card-radius); padding: 14px; box-shadow: var(--shadow); }
.chart-title { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
@media (max-width: 500px) { .chart-grid { grid-template-columns: 1fr; } }

/* ============================================================
   SETTINGS / SIDE PANEL
   ============================================================ */
.side-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,0.45);
}
.side-panel {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 500;
    width: min(340px, 90vw);
    background: var(--surface);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: transform .25s;
}
.side-panel.hidden { transform: translateX(100%); display: flex !important; visibility: hidden; }
.side-panel:not(.hidden) { transform: translateX(0); visibility: visible; }
.side-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 1rem; color: var(--text);
}
.side-panel-body { flex: 1; overflow-y: auto; padding: 16px 18px; }

/* Full-page settings layout (settings.html) */
.settings-page-body { padding: 4px 0 24px; }
.settings-page-body .settings-section { margin-bottom: 20px; }

   ============================================================ */
.toast-container {
    position: fixed; bottom: calc(var(--bottom-nav-h) + 60px); right: 12px;
    z-index: 600; display: flex; flex-direction: column; gap: 8px;
}
.toast-msg {
    padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
    font-size: 0.88rem; font-weight: 600; color: #fff; max-width: 300px;
    animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.toast-success { background: var(--c-done); }
.toast-danger  { background: var(--c-urgent); }
.toast-warning { background: var(--c-onhold); color: #4a3000; }
.toast-info    { background: var(--primary); }

/* ============================================================
   INSTALL BANNER
   ============================================================ */
.install-banner {
    position: fixed; bottom: var(--bottom-nav-h); left: 0; right: 0; z-index: 180;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; font-size: 0.88rem;
}
.install-actions { display: flex; gap: 8px; }
.btn-install-yes {
    background: #fff; color: var(--primary); border-radius: 8px;
    padding: 5px 12px; font-weight: 700; font-size: 0.82rem;
}
.btn-install-no {
    background: rgba(255,255,255,0.2); color: #fff; border-radius: 8px;
    padding: 5px 10px; font-size: 0.82rem;
}

/* ============================================================
   MISC / STREAM GROUP HEADERS
   ============================================================ */
.stream-group-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0 5px; cursor: pointer; user-select: none;
}
.stream-group-header h3 {
    font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
    display: flex; align-items: center; gap: 6px;
}
.stream-group-header .group-count { font-size: 0.72rem; color: var(--text-muted); }
.stream-group.collapsed .group-tasks { display: none; }
.stream-divider {
    height: 3px; border-radius: 2px; margin-bottom: 8px; opacity: 0.25;
}
.stream-office-header  h3 { color: var(--c-office); }
.stream-office-header  .stream-divider { background: var(--c-office); }
.stream-home-header    h3 { color: var(--c-home); }
.stream-home-header    .stream-divider { background: var(--c-home); }
.stream-dev-header     h3 { color: var(--c-dev); }
.stream-dev-header     .stream-divider { background: var(--c-dev); }
