:root {
    --primary-blue: #3f51b5;
    --primary-blue-dark: #32408f;
    --link-blue: var(--primary-blue);
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --text-dark: #212121;
    --text-muted: #757575;
    --border-color: #e0e0e0;
    --tag-inactive-bg: #e0e0e0;
    --tag-inactive-text: #424242;
    --success: #2e7d32;
    --topbar-bg: var(--primary-blue);
    --hover-tint: #f0f1fb;
    --icon-fallback-bg: #eceef7;
    --surface-2: #f5f5f7;
    --scrollbar-thumb: #c4c4c4;
    --shadow-color: rgba(0,0,0,0.08);
    --modal-shadow: rgba(0,0,0,0.3);
    --btn-close-hover: #d5d5d5;
    --font: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --topbar-h: 56px;
}

:root[data-theme="dark"] {
    --primary-blue: #5c6bc0;
    --primary-blue-dark: #4a58ab;
    --link-blue: #8c9eff;
    --bg-light: #121212;
    --bg-white: #1c1c24;
    --text-dark: #f0f0f2;
    --text-muted: #9a9aa5;
    --border-color: #33333c;
    --tag-inactive-bg: #2a2a33;
    --tag-inactive-text: #c7c7d1;
    --success: #43a047;
    --topbar-bg: #1a1a22;
    --hover-tint: rgba(92,107,192,0.18);
    --icon-fallback-bg: #2a2a35;
    --surface-2: #24242c;
    --scrollbar-thumb: #46464f;
    --shadow-color: rgba(0,0,0,0.5);
    --modal-shadow: rgba(0,0,0,0.6);
    --btn-close-hover: #38383f;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-light);
    color: var(--text-dark);
    font-family: var(--font);
    transition: background-color .15s, color .15s;
}

button, input { font-family: var(--font); }
a { color: var(--link-blue); }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 8px; }

/* ---------------------------------------------------------------- */
/* Top bar                                                            */
/* ---------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    background: var(--topbar-bg);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: background-color .15s;
}

.icon-btn {
    background: transparent;
    border: none;
    color: inherit;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
    position: relative;
}
/* Invisible 48px tap area (Android's minimum touch target) around a smaller visual. */
.icon-btn::after { content: ''; position: absolute; inset: -6px; }
.icon-btn:hover { background: rgba(255,255,255,0.15); }
.icon-btn svg { width: 20px; height: 20px; }

.sidebar-toggle { display: none; }

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    background: transparent;
    border: none;
    color: inherit;
    padding: 4px 6px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s;
}
.brand:hover { background: rgba(255,255,255,0.15); }
.brand-check {
    width: 22px;
    height: 22px;
    background: #fff;
    color: var(--primary-blue);
    border-radius: 50%;
    padding: 3px;
    box-sizing: content-box;
}

.topbar-actions { margin-left: auto; display: flex; gap: 4px; }

/* ---------------------------------------------------------------- */
/* Shell / sidebar                                                    */
/* ---------------------------------------------------------------- */
.app-shell {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h)); /* mobile: tracks the browser bars showing/hiding */
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h));
    position: sticky;
    top: var(--topbar-h);
    overflow-y: auto;
    padding: 6px 0 20px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 11px 18px;
    font-size: 0.92rem;
    color: var(--text-dark);
    cursor: pointer;
    font-weight: 500;
    transition: background .12s;
}
.sidebar-item:hover { background: var(--hover-tint); }
.sidebar-item.active-route { color: var(--link-blue); }
.sidebar-item .sidebar-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}
.sidebar-icon.home-icon { color: var(--text-muted); background: transparent; }
.sidebar-icon.home-icon svg { width: 22px; height: 22px; }
.sidebar-icon.has-logo { background: #fff; border: 1px solid var(--border-color); padding: 5px; }
.sidebar-icon.has-logo img { width: 100%; height: 100%; object-fit: contain; }

.franchise-list { border-top: 1px solid var(--border-color); margin-top: 4px; padding-top: 4px; }

.sidebar-group-heading {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 14px 18px 6px;
}
.sidebar-group-heading:first-child { padding-top: 6px; }

.sidebar-item.disabled {
    cursor: default;
    opacity: 0.5;
}
.sidebar-item.disabled:hover { background: transparent; }
.sidebar-item .soon-tag {
    margin-left: auto;
    font-size: 0.62rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}

/* ---------------------------------------------------------------- */
/* Content                                                            */
/* ---------------------------------------------------------------- */
.content { flex: 1; min-width: 0; padding: 24px 32px 60px; }

.home-view { display: none; max-width: 1100px; }
.home-view.active-view { display: block; }
.home-heading { font-size: 1.5rem; font-weight: 600; margin: 0 0 4px; color: var(--text-dark); }
.home-sub { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 22px; }
.home-groups { display: flex; flex-direction: column; gap: 28px; }
.home-group-heading {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(45%, 200px), 1fr));
    gap: 16px;
}
.home-card-wrap { position: relative; height: 100%; }
.home-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    height: 100%;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    cursor: pointer;
    text-align: left;
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.home-card:hover { border-color: var(--primary-blue); box-shadow: 0 4px 16px var(--shadow-color); transform: translateY(-2px); }
.home-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.home-card-icon.has-logo { background: #fff; border: 1px solid var(--border-color); padding: 7px; }
.home-card-icon.has-logo img { width: 100%; height: 100%; object-fit: contain; }
.home-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.3;
    padding-right: 22px;
    height: 2.6em; /* fixed 2-line block so every card matches height, however the title wraps */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.home-card-count { font-size: 0.78rem; color: var(--text-muted); }

.home-star-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #bdbdbd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background .12s, color .12s;
}
.home-star-btn::after { content: ''; position: absolute; inset: -9px; } /* 48px tap area */
.home-star-btn:hover { background: var(--hover-tint); color: #f5a623; }
.home-star-btn svg { width: 19px; height: 19px; }
.home-star-btn.starred { color: #f5a623; }
.home-star-btn.starred svg { fill: currentColor; }

.stats-sections { display: flex; flex-direction: column; gap: 16px; }
.stats-subgroups { display: flex; flex-direction: column; gap: 22px; }
.stats-subgroups .home-group-heading { margin-top: 0; }
.stats-section {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-white);
    overflow: hidden;
}
.stats-section summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--surface-2);
    transition: background-color .15s;
}
.stats-section summary::-webkit-details-marker { display: none; }
.stats-section summary::before { content: '▸'; font-size: 0.75rem; color: #9e9e9e; transition: transform .15s; }
.stats-section[open] summary::before { transform: rotate(90deg); }
.stats-section-body { padding: 18px; display: flex; flex-direction: column; gap: 20px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(45%, 220px), 1fr));
    gap: 16px;
}
.stats-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
}
/* wrap: on a narrow phone a long title ("All Collections") drops below its icon instead of
   overflowing the tile. */
.stats-tile-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stats-tile-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    overflow: hidden;
}
.stats-tile-icon.has-logo { background: #fff; border: 1px solid var(--border-color); padding: 5px; }
.stats-tile-icon.has-logo img { width: 100%; height: 100%; object-fit: contain; }
.stats-tile-icon.app-logo img { width: 100%; height: 100%; object-fit: cover; }
.stats-tile-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.3;
}
.stats-tile-big .stats-tile-title { font-size: 1rem; }
.stats-tile-count { font-size: 0.85rem; color: var(--text-muted); }
.stats-tile-count strong { color: var(--text-dark); font-size: 1.3rem; font-weight: 700; }
.stats-tile-bar { height: 6px; border-radius: 3px; background: var(--border-color); overflow: hidden; }
.stats-tile-fill { height: 100%; background: var(--primary-blue); border-radius: 3px; }
.stats-tile-pct { font-size: 0.78rem; color: var(--text-muted); align-self: flex-end; }
.stats-encourage { display: flex; align-items: center; padding: 12px 16px; }
.stats-encourage p { margin: 0; font-size: 0.95rem; font-style: italic; color: var(--text-muted); line-height: 1.5; }

#franchiseView { display: block; }
#franchiseView.hidden-view { display: none; }

.content-header { max-width: 900px; }

.franchise-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 18px;
    text-align: center;
}
.franchise-glyph {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.franchise-glyph.has-logo { background: #fff; border: 1px solid var(--border-color); padding: 6px; }
.franchise-glyph.has-logo img { width: 100%; height: 100%; object-fit: contain; }
.franchise-title-row h1 { font-size: 1.5rem; font-weight: 600; margin: 0; color: var(--text-dark); }

.search-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
#searchInput {
    flex: 1;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    padding: 10px 4px;
    font-size: 0.95rem;
    color: var(--text-dark);
}
#searchInput:focus { outline: none; border-bottom-color: var(--primary-blue); }
#searchInput::placeholder { color: var(--text-muted); }

.config-btn { color: var(--text-muted); }
.config-btn:hover { background: var(--hover-tint); }

.tabs {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--border-color);
    margin-top: 6px;
}
.tab {
    background: none;
    border: none;
    padding: 12px 2px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text-dark); }
.tab.active { color: var(--link-blue); border-bottom-color: var(--link-blue); font-weight: 600; }

.progress-meter {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 16px;
}
.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.progress-meta strong { color: var(--text-dark); font-weight: 700; }
.progress-track {
    height: 8px;
    background: var(--bg-light);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.progress-fill {
    height: 100%;
    background: var(--primary-blue);
    border-radius: 999px;
    width: 0%;
    transition: width .4s cubic-bezier(.4,0,.2,1);
}

/* ---------------------------------------------------------------- */
/* Timeline list                                                      */
/* ---------------------------------------------------------------- */
.timeline-wrap { max-width: 900px; margin-top: 10px; }

.mark-all-wrap { max-width: 900px; margin: 20px 0 4px; }
.mark-all-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.mark-all-btn:hover { border-color: var(--primary-blue); background: var(--hover-tint); }
.mark-all-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.timeline { position: relative; }

.timeline-row {
    position: relative;
    display: grid;
    grid-template-columns: 46px 20px 34px 1fr 24px;
    align-items: start;
    column-gap: 12px;
    padding: 10px 0;
    cursor: pointer;
}

.timeline-row::before {
    content: '';
    position: absolute;
    left: 68px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--text-dark);
    z-index: 0;
}
.timeline-row:first-child::before { top: 18px; }
.timeline-row:last-child::before { bottom: calc(100% - 18px); }

.row-year {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 6px;
    text-align: right;
    white-space: nowrap;
}

.row-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dark);
    margin: 12px auto 0;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.row-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--icon-fallback-bg);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}
.row-icon img { width: 100%; height: 100%; object-fit: cover; }

.row-body { min-width: 0; }
.row-title { font-size: 0.95rem; font-weight: 500; color: var(--text-dark); line-height: 1.3; }
.row-title .upcoming-flag { color: var(--link-blue); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; margin-left: 6px; }
.row-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.row-check {
    width: 20px;
    height: 20px;
    border: 2px solid #9e9e9e;
    border-radius: 3px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .12s;
    position: relative;
}
/* 20px box, 48px tap area — taps just beside the box still toggle it instead of expanding the row. */
.row-check::after { content: ''; position: absolute; inset: -14px; }
.row-check:hover { border-color: var(--primary-blue); }
.row-check:focus-visible { outline: 2px solid var(--primary-blue); outline-offset: 3px; }
.row-check svg { width: 14px; height: 14px; opacity: 0; color: #fff; transition: opacity .12s; }
.timeline-row.watched .row-check { background: var(--success); border-color: var(--success); }
.timeline-row.watched .row-check svg { opacity: 1; }
.timeline-row.watched .row-title { color: var(--text-muted); }

.timeline-row.upcoming { cursor: default; }
.timeline-row.upcoming .row-check { opacity: 0.35; cursor: not-allowed; }

/* expand accordion */
.row-detail {
    grid-column: 3 / 4;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    font-size: 0.86rem;
    color: var(--text-dark);
    line-height: 1.55;
}
/* No cap when open: a row rendered already-expanded shows its whole synopsis, and the
   click-to-expand animation sets an exact pixel height inline (see expandDetail). */
.timeline-row.expanded .row-detail { max-height: none; padding-top: 8px; }
.row-detail-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    text-decoration: none;
}
.chip-btn.trailer { background: var(--text-dark); color: var(--bg-light); border-color: var(--text-dark); }
.chip-btn svg { width: 14px; height: 14px; }

.results-meta { font-size: 0.78rem; color: var(--text-muted); margin: 12px 0 6px; }
.empty-state { padding: 60px 10px; text-align: center; color: var(--text-muted); }
.empty-state h3 { color: var(--text-dark); margin-bottom: 6px; }

/* ---------------------------------------------------------------- */
/* Config modal                                                       */
/* ---------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.config-modal {
    background: var(--bg-white);
    border-radius: 8px;
    width: 100%;
    max-width: 520px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px var(--modal-shadow);
    border: 1px solid var(--border-color);
    transform: translateY(10px);
    transition: transform .2s, background-color .15s;
}
.modal-overlay.open .config-modal { transform: translateY(0); }

.config-modal h2 { font-size: 1.1rem; font-weight: 600; margin: 0; padding: 20px 24px 4px; }
.config-scroll { overflow-y: auto; padding: 4px 24px 8px; }
#accountTabs { padding: 18px 24px 0; margin-top: 0; gap: 20px; }
.account-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.account-tabs .tab svg { width: 16px; height: 16px; flex-shrink: 0; }

.config-section { padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.config-label { display: block; font-size: 0.85rem; color: var(--text-dark); margin-bottom: 8px; font-weight: 500; }
.config-label.block { margin-bottom: 10px; }
.config-label.settings-title { font-size: 1.1rem; font-weight: 600; }
.config-subsection { padding-top: 12px; }
.config-subsection:first-of-type { padding-top: 4px; }

.help-text { font-size: 0.86rem; line-height: 1.6; color: var(--text-dark); margin: 0; }
.help-text a { color: var(--link-blue); font-weight: 600; text-decoration: none; }
.help-text a:hover { text-decoration: underline; }
.help-text + .help-text { margin-top: 8px; }
/* Kept smaller than the app's own branding, per TMDB's attribution terms. */
.tmdb-attribution-logo { display: inline-block; margin-bottom: 10px; }
.tmdb-attribution-logo img { height: 14px; width: auto; }

.radio-opt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 22px;
    font-size: 0.88rem;
    color: var(--text-dark);
    cursor: pointer;
    position: relative;
}
.radio-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #9e9e9e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.radio-dot::after {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--primary-blue);
    transform: scale(0);
    transition: transform .1s;
}
.radio-opt input:checked ~ .radio-dot { border-color: var(--primary-blue); }
.radio-opt input:checked ~ .radio-dot::after { transform: scale(1); }

.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-pill {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--tag-inactive-bg);
    color: var(--tag-inactive-text);
    transition: all .12s;
}
.filter-pill.active { background: var(--primary-blue); color: #fff; }

.config-footer { padding: 14px 24px 20px; display: flex; gap: 10px; }
.btn-close {
    background: var(--tag-inactive-bg);
    border: none;
    border-radius: 4px;
    padding: 10px 22px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
}
.btn-close:hover { background: var(--btn-close-hover); }
.btn-primary {
    background: var(--primary-blue);
    border: none;
    border-radius: 4px;
    padding: 10px 22px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}
.btn-primary:hover { opacity: 0.9; }

/* ---------------------------------------------------------------- */
/* Settings → User: Google sign-in + sync status (js/account.js)      */
/* ---------------------------------------------------------------- */
.sync-fine-print { color: var(--text-muted); font-size: 0.8rem; }
.sync-message { color: #c62828; }
:root[data-theme="dark"] .sync-message { color: #ef9a9a; }
.sync-state { color: var(--text-muted); }
.sync-synced { color: var(--success); }
.sync-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn-primary:disabled { opacity: 0.55; cursor: default; }
.link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--link-blue); cursor: pointer; text-decoration: underline; }
.sync-delete { display: block; margin-top: 14px; font-size: 0.8rem; color: var(--text-muted); }

/* "Sign in with Google" — Google's branding guidelines: white with a #747775 border on light,
   #131314 with a #8E918F border on dark, 14px medium text beside the 18px "G". */
.google-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    border-radius: 4px;
    border: 1px solid #747775;
    background: #ffffff;
    color: #1f1f1f;
    font-family: 'Roboto', var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.google-btn:hover { background: #f5f5f5; }
.google-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
:root[data-theme="dark"] .google-btn { background: #131314; border-color: #8e918f; color: #e3e3e3; }
:root[data-theme="dark"] .google-btn:hover { background: #1f1f20; }

/* Small dot on the Settings button while sync waits for the user to reconnect. */
.icon-btn.needs-attention::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffb300;
    box-shadow: 0 0 0 2px var(--topbar-bg);
}

/* ---------------------------------------------------------------- */
/* Notice (non-blocking message, e.g. progress couldn't be saved)     */
/* ---------------------------------------------------------------- */
.notice {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 150;
    width: max-content;
    max-width: calc(100% - 32px);
    background: var(--text-dark);
    color: var(--bg-light);
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 0.85rem;
    line-height: 1.45;
    box-shadow: 0 6px 24px var(--modal-shadow);
}
.notice[hidden] { display: none; }

/* ---------------------------------------------------------------- */
/* Responsive                                                        */
/* ---------------------------------------------------------------- */
@media (max-width: 860px) {
    .sidebar-toggle { display: flex; }
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--topbar-h);
        z-index: 40;
        transform: translateX(-100%);
        transition: transform .2s;
        box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    }
    .sidebar.open { transform: translateX(0); }
    .content { padding: 18px 16px 60px; }
}

@media (max-width: 480px) {
    .timeline-row { grid-template-columns: 34px 16px 28px 1fr 22px; column-gap: 8px; }
    .timeline-row::before { left: 50px; }
    .row-year { font-size: 0.68rem; }
}
