/* css/2-layout.css - Design tokens referenced from css/1-base.css */

/* ============================================================
   DESIGN TOKEN ENFORCEMENT
   Do NOT add raw hex (#xxx) or rgb/rgba values.
   Use tokens from css/1-base.css instead.
   Allowed exceptions: literal 1px borders, calc() with tokens
   ============================================================ */

/* ============================================================
   LAYOUT BRIDGE CLASSES (l-*)
   Reusable layout patterns for inline style migration
   ============================================================ */

/* Horizontal row with gap */
.l-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Horizontal row with space-between */
.l-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Vertical stack with gap */
.l-stack {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- Header --- */
.header {
    background: linear-gradient(to bottom, var(--color-bg-secondary), var(--color-bg-tertiary));
    /* YRH-HEADER-RESET-022: subtle extra breathing room (do not change layout structure) */
    padding: calc(10px + env(safe-area-inset-top, 0px)) var(--spacing-lg) 10px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--app-header-height);
    position: relative;
    z-index: var(--z-header);
    gap: 16px;
}

/* Left header cluster: logo + primary nav */
.header-left-cluster {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0; /* Allow shrinking on narrow screens */
}

/* Header logo container with icon and text */
.header-logo-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    color: var(--color-text-secondary);
}

/* Reusable: inline SVG watermark (inherits currentColor) */
.yrh-watermark-svg {
    display: block;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
}

.header-watermark-icon {
    width: 20px;
    height: 20px;
}

/* YRH-HEADER-RESET-022: modern, calm wordmark (UI only)
   - Remove serif
   - Humanist/system sans (existing base stack)
   - Reduce scale and weight
   - Warm charcoal (neutral, no branding) */
.header-logo-text {
    font-size: 1.55em; /* ~11% smaller than 1.75em */
    font-family: var(--font-family-base);
    /* YRH-HEADER-PRESENCE-023: add a touch more presence without getting loud */
    font-weight: 500;
    color: currentColor;
    letter-spacing: 0.02em;
}

/* Header primary navigation (Home/Canvas) */
.header-primary-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}


.header-nav-link {
    display: flex;
    align-items: center;
    padding: 8px 4px;
    border-radius: 0;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: 0.95em;
    font-weight: 400;
    transition: color 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    position: relative;
    opacity: 0.55;
}

/* Optical alignment: nav labels sit slightly high vs brand text due to font/baseline differences.
   Nudge ONLY the primary nav label text (not the link box) to keep header geometry unchanged. */
.header-primary-nav .header-nav-link > span {
    display: inline-block;
    transform: translateY(2px);
}

.header-nav-link:hover {
    color: var(--color-text-primary);
    opacity: 0.75;
}

.header-nav-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.header-nav-link.is-active {
    color: var(--color-primary);
    font-weight: 500;
    opacity: 1;
    border-bottom-color: transparent;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* buttons stay tight on the right */
}

/* Ensure both button groups in header are flex */
.header-buttons #auth-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    overflow: visible;
}

/* Canonical header nav geometry (used by #app-buttons) */
.nav-action-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    overflow: visible;
}

/* Reset base icon circle styles inside the nav bar.
   The base .account-icon-circle has a gray bg + person SVG fallback
   that creates unwanted gray blobs behind inline-SVG icons in the nav.
   This scope prevents the flash without needing !important overrides. */
.nav-action-bar .account-icon-circle {
    background-color: transparent;
    background-image: none;
    border: none;
    box-shadow: none;
}

.nav-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    position: relative;
    width: 60px;
    overflow: visible;
}

.nav-action-item:hover {
    background-color: var(--color-overlay-dark-08);
}

/* --- Header Auth/Account Buttons --- */
#signin-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    width: 60px;
}

#signin-btn-wrapper:hover {
    background-color: var(--color-overlay-dark-08);
}

#signin-icon-circle {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23888'%3E%3Cpath d='M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    background-size: 80%; 
}

#signin-btn-text {
    font-size: 0.75em;
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
    font-weight: 500;
}

#account-btn-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

#account-btn-wrapper:hover {
    background-color: var(--color-overlay-dark-08);
}

/* Desktop header tonal harmonization refinement.
   - Desktop only (no mobile changes)
   - Calm neutral tone that matches sidebar temperature
   - Replace heavier drop shadow with a subtle 1px bottom divider (no layout shift) */
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    .header {
        background: var(--color-bg-secondary);
        box-shadow: inset 0 -1px 0 var(--color-border-lightest);
    }

    /* Interaction states within header: extremely subtle */
    .nav-action-item:hover,
    #signin-btn-wrapper:hover,
    #account-btn-wrapper:hover {
        background-color: var(--color-overlay-dark-05);
    }
}

#home-icon-circle {
    /* Thin-line home glyph (timeline + waypoint) */
    background-image: none;
    position: relative;
    overflow: visible;
}

.account-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.account-more {
    display: flex;
    align-items: flex-start;
    padding-top: 0;
}

.account-icon-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

#account-btn-text {
    font-size: 0.75em;
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
    font-weight: 500;
}

#global-user-menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

#global-user-menu-wrapper .profile-options-btn {
    margin: 0;
    padding: 0;
    width: 24px;
    height: 24px;
    background: none;
    border-radius: var(--radius-sm);
    opacity: 0.6;
    transition: all 0.2s ease;
    transform: translateY(2px);
}

#global-user-menu-wrapper .profile-options-btn:hover {
    background-color: var(--color-bg-tertiary);
    opacity: 1;
}

#global-user-menu-wrapper .profile-options-btn svg {
    width: 16px;
    height: 16px;
}

/* --- Library Button (top-right nav) --- */
#library-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    position: relative;
    width: 60px;
}
#library-btn-wrapper:hover {
    background-color: var(--color-overlay-dark-08);
}

#library-icon-circle {
    background-image: none;
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

#you-icon-circle {
    /* Avatar: JS applies background-image when user has a profile photo.
       This element deliberately has NO .account-icon-circle class — so it
       never inherits the generic person SVG fallback from 3-components.css. */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #eceff3;
    background-image: var(--yrh-startup-you-icon-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%23eceff3'/%3E%3C/svg%3E"));
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border: none;
    position: relative;
    overflow: hidden;
}

#you-icon-circle .yrh-profile-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
    pointer-events: none;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Bottom nav icon glyphs (iPhone + desktop)
    NOTE: #you-icon-circle is intentionally excluded — its visuals
    are set entirely by JS (initials → photo). Including it here
    caused a flash of the gray pseudo-element on iOS WebKit. */
#home-icon-circle::before,
#header-account-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: var(--bnav-icon-size, 1.125rem);
    height: var(--bnav-icon-size, 1.125rem);
    background-color: var(--color-text-secondary);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

/* Inline SVG nav glyphs render more reliably than CSS masks in Safari/WKWebView. */
#home-icon-circle::before,
#library-icon-circle::before,
#header-account-icon::before {
    content: none;
    display: none;
}

#home-icon-circle,
#library-icon-circle,
#header-account-icon {
    color: var(--color-text-secondary);
}

.nav-action-item.is-active #home-icon-circle,
#library-btn-wrapper.is-active #library-icon-circle,
#account-btn-wrapper.is-active #header-account-icon {
    color: var(--color-primary);
}

#home-icon-circle .bnav-icon,
#library-icon-circle .bnav-icon,
#header-account-icon .bnav-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: var(--bnav-icon-size, 1.125rem);
    height: var(--bnav-icon-size, 1.125rem);
    display: block;
    overflow: visible;
    stroke: var(--color-text-secondary);
}

@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    #header-account-icon .bnav-icon {
        width: 24px;
        height: 24px;
    }
}

.nav-action-item.is-active #home-icon-circle .bnav-icon,
#library-btn-wrapper.is-active #library-icon-circle .bnav-icon,
#account-btn-wrapper.is-active #header-account-icon .bnav-icon {
    stroke: var(--color-primary);
}

/* Home: timeline + waypoint marker */
#home-icon-circle::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.2c-2.6 0-4.7 2.1-4.7 4.7 0 3.3 4.7 8.2 4.7 8.2s4.7-4.9 4.7-8.2c0-2.6-2.1-4.7-4.7-4.7z'/%3E%3Ccircle cx='12' cy='7.9' r='1.6' fill='%23fff' stroke='none'/%3E%3Ccircle cx='6' cy='18' r='1.4' fill='%23fff' stroke='none'/%3E%3Ccircle cx='12' cy='18' r='1.4' fill='%23fff' stroke='none'/%3E%3Ccircle cx='18' cy='18' r='1.4' fill='%23fff' stroke='none'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.2c-2.6 0-4.7 2.1-4.7 4.7 0 3.3 4.7 8.2 4.7 8.2s4.7-4.9 4.7-8.2c0-2.6-2.1-4.7-4.7-4.7z'/%3E%3Ccircle cx='12' cy='7.9' r='1.6' fill='%23fff' stroke='none'/%3E%3Ccircle cx='6' cy='18' r='1.4' fill='%23fff' stroke='none'/%3E%3Ccircle cx='12' cy='18' r='1.4' fill='%23fff' stroke='none'/%3E%3Ccircle cx='18' cy='18' r='1.4' fill='%23fff' stroke='none'/%3E%3C/svg%3E");
}


#library-icon-circle .bnav-icon {
    width: calc(var(--bnav-icon-size, 1.125rem) + 0.125rem);
    height: calc(var(--bnav-icon-size, 1.125rem) + 0.125rem);
}

.bnav-icon-library path {
    display: none;
}

/* #you-icon-circle has no ::before — removed from grouped selector above.
   JS exclusively controls the background-image (initials → photo). */

/* Account: archive cabinet */
#header-account-icon {
    background-image: none;
    position: relative;
    overflow: visible;
}

#header-account-icon::before {
    width: calc(var(--bnav-icon-size, 1.125rem) + 0.375rem);
    height: calc(var(--bnav-icon-size, 1.125rem) + 0.375rem);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5.2' y='3.8' width='13.6' height='16.4' rx='2.0'/%3E%3Cpath d='M5.2 9.4h13.6'/%3E%3Cpath d='M5.2 14.8h13.6'/%3E%3Cpath d='M9 7.1h6'/%3E%3Cpath d='M9 12.3h6'/%3E%3Cpath d='M9 17.6h6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5.2' y='3.8' width='13.6' height='16.4' rx='2.0'/%3E%3Cpath d='M5.2 9.4h13.6'/%3E%3Cpath d='M5.2 14.8h13.6'/%3E%3Cpath d='M9 7.1h6'/%3E%3Cpath d='M9 12.3h6'/%3E%3Cpath d='M9 17.6h6'/%3E%3C/svg%3E");
}

#you-btn-wrapper {
    position: relative;
    width: 60px;
}
#you-btn-wrapper:hover {
    background-color: var(--color-overlay-dark-08);
}

#you-btn-text {
    font-size: 0.75em;
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
    font-weight: 500;
}

#library-btn-text {
    font-size: 0.75em;
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
    font-weight: 500;
}

#library-btn-wrapper.is-active #library-btn-text,
#account-btn-wrapper.is-active #account-btn-text,
#you-btn-wrapper.is-active #you-btn-text,
#home-btn-wrapper.is-active #home-btn-text {
    color: var(--color-primary);
}

/* --- Activity Button (top-right nav) --- */
#activity-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    position: relative;
    width: 60px;
}

#activity-btn-wrapper:hover {
    background-color: var(--color-overlay-dark-08);
}

#activity-icon-circle {
    /* Activity / pulse icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-3l-3 9-4-18-3 9H2'/%3E%3C/svg%3E");
    background-size: 80%;
}

#activity-btn-text {
    font-size: 0.75em;
    color: var(--color-text-secondary);
    margin-top: var(--spacing-xs);
    font-weight: 500;
}

/* --- Main Layout --- */
.main-container {
    display: flex;
    flex-direction: row-reverse;
    /* Use custom --vh property set by JS for accurate mobile Safari height.
       Fallback chain: JS var → -webkit-fill-available → 100vh */
    height: calc(100vh - 80px - env(safe-area-inset-top, 0px));
    height: calc(var(--vh, 1vh) * 100 - 80px - env(safe-area-inset-top, 0px)); 
    gap: 0;
    position: relative;
}

html.yrh-shell-desktop .main-container {
    --desktop-canvas-header-height: var(--yrh-shell-header-height, 58px);
    padding-top: var(--desktop-canvas-header-height);
    height: calc(var(--vh, 1vh) * 100 - env(safe-area-inset-top, 0px));
}

/* Tablet (iPad): fill FULL viewport. Header extends behind status bar,
   so padding-top must include safe-area-inset-top. */
html.yrh-shell-tablet .main-container {
    height: calc(var(--vh, 1vh) * 100);
    padding-top: calc(var(--yrh-shell-header-height, 64px) + env(safe-area-inset-top, 0px));
    padding-bottom: 0;
}

/* Desktop: full-width header, sidebar under header, remove bottom frame */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
    .main-container {
        /* Header is fixed at top; content starts below it */
        /* Desktop refinement pass: header comfort, floating add, sidebar search divider, tutorial access via brand icon. */
        --desktop-canvas-header-height: 58px;
        padding-top: var(--desktop-canvas-header-height);

        /* Remove the legacy "-80px" gap that created a bottom frame */
        height: calc(var(--vh, 1vh) * 100 - env(safe-area-inset-top, 0px));
    }
}

/* --- Sidebar --- */
.sidebar {
    width: var(--yrh-sidebar-width, 400px);
    min-width: var(--yrh-sidebar-width, 400px);
    /* Sidebar journal tone refinement – mobile + desktop */
    background: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border-lightest);
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    transition: width 0.28s ease, min-width 0.28s ease, border-left-color 0.18s ease, box-shadow 0.18s ease;
    position: relative; 
    z-index: var(--z-sidebar);        
}

.sidebar-header {
    display: none;
    padding: var(--spacing-lg);
    overflow: hidden; 
    transition: opacity 0.1s linear; 
    white-space: normal;
}

.sidebar-header.visible {
    display: block;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; 
    padding: 0;
    scroll-behavior: smooth;
    transition: opacity 0.1s linear; 
}

/* --- Sidebar Controls --- */

.timeline-filter-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}
.timeline-filter-group #timelineFilter {
    flex-grow: 1;
    margin-bottom: 0;
}

.timeline-filter-group .profile-options-container {
    flex-shrink: 0;
}
.timeline-filter-group .profile-options-btn {
    width: 42px;
    height: 42px;
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
}
.timeline-filter-group .profile-options-btn:hover {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}
.timeline-filter-group .profile-options-btn svg {
    fill: var(--color-text-secondary);
}

#timelineFilter {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-md);
    font-size: 1em;
    cursor: pointer;
    margin-bottom: var(--spacing-lg);
}

.sidebar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: var(--spacing-lg); 
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: 0;
    justify-content: flex-start;
}

.sort-controls label {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.sort-controls select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: transparent;
    border: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: var(--spacing-xs) 25px var(--spacing-xs) 0;
    margin: 0;
    cursor: pointer;
    width: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
}

#sort-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: transparent;
    border: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9em;
    font-weight: 300;
    color: var(--color-text-secondary);
    padding: var(--spacing-xs) 25px var(--spacing-xs) 0;
    margin: 0;
    cursor: pointer;
    width: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
}

#sort-select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.filter-controls {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-lg);
}

.btn-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    color: var(--color-text-secondary);
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-filter:hover {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.btn-filter svg {
    width: 24px;
    height: 24px;
}

.btn-filter.active {
    background-color: var(--color-alert-error-bg-light);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.btn-filter.active:hover {
    background-color: var(--color-alert-error-bg);
    border-color: var(--color-danger);
}

@media (min-width: 769px) {
    #home-btn-wrapper {
        display: none !important;
    }
}

#sidebar-event-btn {
    color: var(--color-primary);
}
#sidebar-event-btn:hover {
    background-color: var(--color-alert-info-bg);
    color: var(--color-primary-dark);
}

/* --- Sidebar Collapse --- */
.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-sort-controls,
.sidebar.collapsed .sidebar-filter-panel,
.sidebar.collapsed .iphone-pull-search-host,
.sidebar.collapsed .sidebar-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sidebar.collapsed {
    width: 0px;
    min-width: 0px; 
    padding: 0;
    border-left-color: transparent;
    box-shadow: none;
    overflow: hidden; 
}

.sidebar:not(.collapsed) {
    width: var(--yrh-sidebar-width, 400px) !important;
    min-width: var(--yrh-sidebar-width, 400px) !important;
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sidebar:not(.collapsed) .sidebar-header,
.sidebar:not(.collapsed) .sidebar-sort-controls,
.sidebar:not(.collapsed) .sidebar-filter-panel,
.sidebar:not(.collapsed) .iphone-pull-search-host,
.sidebar:not(.collapsed) .sidebar-content {
    opacity: 1 !important;
    visibility: visible !important;
}

.sidebar.collapsed {
    width: 0px !important;
    min-width: 0px !important;
}

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    background: white;
}

/* Main canvas card (replaces timeline-area) */
.main-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.timeline-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 8px;
    margin-bottom: 0px;
    min-height: 10px;
    width: 100%;
    flex-shrink: 0;
}

/* --- Sidebar Event List Items --- */
.sidebar-content.yrh-event-year-list {
    --yrh-year-section-gap-before: 26px;
    --yrh-year-section-gap-after: 8px;
    --yrh-year-header-gap-to-first-row: 2px;
    --yrh-year-header-font-size: 0.94rem;
    --yrh-year-header-min-height: 38px;
}

.event-item {
    /* Sidebar journal tone refinement – mobile + desktop */
    background: transparent;
    color: var(--color-text-primary);
    padding: 13px var(--yrh-apple-list-padding-x, 20px);
    border-radius: 0;
    margin-bottom: 0;
    cursor: pointer;
    transition: background 0.18s;
    position: relative;
    display: block;
    /* Ultra-light separation; prefer whitespace over hard rules */
    box-shadow: inset 0 -1px var(--color-overlay-dark-03, rgba(0, 0, 0, 0.03));
}

html.yrh-tier-desktop[data-layout-input="touch"] .event-item {
    padding: 15px var(--yrh-shell-inline-gutter, 28px);
}

.event-item:first-child {
    box-shadow: inset 0 -1px var(--color-overlay-dark-03, rgba(0, 0, 0, 0.03));
}

/* Inner flex container for event card content */
.event-item-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

/* Date column on the left */
.event-date-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    min-width: 48px;
    flex-shrink: 0;
    line-height: 1.1;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: var(--font-weight-normal, 400);
    letter-spacing: 0.01em;
    text-transform: none;
    user-select: none;
}

.event-date-md {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    letter-spacing: inherit;
}

.yrh-event-year-section {
    position: relative;
    padding-bottom: var(--yrh-year-section-gap-after);
}

.yrh-event-year-section + .yrh-event-year-section {
    margin-top: var(--yrh-year-section-gap-before);
}

.yrh-event-year-items {
    padding-top: var(--yrh-year-header-gap-to-first-row);
}

.yrh-event-year-items .event-item:last-child {
    box-shadow: inset 0 -1px var(--color-overlay-dark-03, rgba(0, 0, 0, 0.03));
}

.yrh-event-year-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--yrh-year-header-min-height);
    padding: 13px var(--yrh-shell-inline-gutter, var(--yrh-apple-list-padding-x, 20px)) 6px;
    margin: 0;
    font-size: var(--yrh-year-header-font-size);
    font-weight: 500;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-secondary);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(255, 255, 255, 0.97) 74%, rgba(255, 255, 255, 0.94) 100%);
    box-shadow: 0 1px 0 var(--color-overlay-dark-03, rgba(0, 0, 0, 0.03));
}

.yrh-event-year-header::after {
    content: '';
    flex: 0 1 auto;
    width: min(9rem, 34%);
    height: 1px;
    background: linear-gradient(90deg, var(--color-overlay-dark-03, rgba(0, 0, 0, 0.03)), transparent 68%);
    transform: translateY(1px);
}

.event-date-yr {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.event-item.hidden {
    opacity: 0.45;
    color: var(--color-text-primary);
}

/* Hover styles can get "stuck" on iOS Safari after a tap.
   Apply hover effects only on devices that truly support hover. */
@media (hover: hover) and (pointer: fine) {
    .event-item:hover {
        transform: none;
        /* Hover: extremely soft (desktop only) */
        background: rgba(0, 0, 0, 0.03);
    }

    .event-item.hidden:hover {
        background: rgba(0, 0, 0, 0.03);
        transform: none;
    }
}

.event-item.selected {
    /* Selected row: soft, low-contrast tint */
    background: rgba(123, 107, 192, 0.06);
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
    .sidebar-content.yrh-event-year-list {
        --yrh-year-section-gap-before: 26px;
        --yrh-year-section-gap-after: 11px;
        --yrh-year-header-gap-to-first-row: 3px;
        --yrh-year-header-font-size: 1rem;
        --yrh-year-header-min-height: 41px;
    }

    .yrh-event-year-header {
        padding-left: calc(var(--yrh-apple-list-padding-x, 20px) - 4px);
    }

    .event-item {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

/* Prevent hover from affecting selected rows */
@media (hover: hover) and (pointer: fine) {
    .event-item.selected:hover {
        background: rgba(123, 107, 192, 0.08);
    }
}

.event-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (hover: hover) and (pointer: fine) {
    .event-item.disabled:hover {
        transform: none;
        box-shadow: inset 0 -1px var(--color-overlay-dark-03, rgba(0, 0, 0, 0.03));
    }
}

/* Event text container (title + date) */
.event-text {
    flex: 1;
    min-width: 0;
}

.event-item h3,
.event-text h3 {
    font-size: 0.92em;
    font-weight: 500;
    margin-bottom: 0;
    color: var(--color-text-primary);
    /* Allow up to 3 lines, with newline support */
    white-space: pre-line;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    max-height: 4.05em;
}

.event-item.selected h3,
.event-item.selected .event-text h3 {
    font-weight: 600;
}

.event-item p,
.event-text p {
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 0; 
}

/* Hide legacy <p> date in event-text when meta-row is present */
.event-text:has(.event-meta-row) > p {
    display: none;
}

/* Status cluster (toggle + lock, horizontal) - Sidebar UI Contract compliant */
.event-status-cluster {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Cluster headers - demote visually, subtle accent only */
.event-cluster-header {
    background: transparent !important;
    border-left: 3px solid rgba(123, 107, 192, 0.25) !important;
    padding-left: 12px !important; /* Compensate for border */
    box-shadow: none !important;
    transform: none !important;
    border-radius: 0 !important;
    outline: none !important;
}

.event-cluster-header:hover {
    background: rgba(0, 0, 0, 0.03) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Remove any pseudo-elements that might create double-stack effect */
.event-cluster-header::before,
.event-cluster-header::after {
    display: none !important;
}

/* Edit button container */
.event-actions {
    display: flex;
    align-items: center;
    order: 3;
    flex-shrink: 0;
}

/* Legacy event-controls - keep for backwards compatibility */
.event-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 10px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.event-menu-container {
    position: relative;
}

.event-visibility,
.event-edit-btn {
    background: transparent;
    border: none;
    /* Sidebar journal tone refinement – mobile + desktop */
    color: var(--color-text-primary);
    border-radius: 5px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.event-edit-btn {
    font-size: 0.9em;
}

.event-visibility:hover {
    background: rgba(0, 0, 0, 0.06);
}

.event-edit-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Status Toggle on Event Cards (white version for purple gradient) */
.event-status-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.event-status-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.event-status-slider {
    position: relative;
    width: 28px;
    height: 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.event-status-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: all 0.25s ease;
    box-shadow: 0 1px 2px var(--color-overlay-dark-15);
}

.event-status-checkbox:checked + .event-status-slider {
    background: rgba(34, 197, 94, 0.4);
}

.event-status-checkbox:checked + .event-status-slider::before {
    transform: translateX(12px);
    background: rgba(34, 197, 94, 0.8);
}

.event-status-checkbox:focus-visible + .event-status-slider {
    outline: 2px solid rgba(75, 54, 130, 0.4);
    outline-offset: 2px;
}

.event-status-toggle:hover .event-status-slider {
    background: rgba(0, 0, 0, 0.22);
}

.event-status-toggle:hover .event-status-checkbox:checked + .event-status-slider {
    background: rgba(34, 197, 94, 0.55);
}

/* Lock Indicator on Event Cards - Informational only, not clickable */
.event-lock-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    opacity: 0.35;
    color: var(--color-text-primary);
    cursor: default;
    pointer-events: none;
}

.event-lock-indicator.visibility-me { opacity: 0.45; }

.event-lock-indicator svg {
    width: 14px;
    height: 14px;
}

/* --- Sidebar Card: Metadata Row (date + visibility icon) --- */
.event-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 1px;
}

.event-meta-date {
    font-size: 0.85em;
    opacity: 0.7;
    margin: 0;
    line-height: 1.3;
    color: var(--color-text-primary);
}

.event-meta-visibility {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    pointer-events: none;
    color: var(--color-text-primary);
}

.event-meta-visibility svg {
    width: 11px;
    height: 11px;
}

.event-meta-visibility.visibility-me { opacity: 0.35; }


.event-menu-btn {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    border-radius: 5px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.event-menu-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.event-menu-dropdown {
    position: absolute;
    top: 32px;
    right: 0;
    background: white;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xs);
    box-shadow: var(--shadow-sm);
    z-index: var(--z-modal-base);
    min-width: 120px;
}

.event-menu-dropdown button {
    width: 100%;
    padding: var(--spacing-lg) var(--spacing-lg);
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
    text-align: left;
    font-size: 0.9em;
    transition: background 0.2s;
}

.event-menu-dropdown button:hover {
    background: var(--color-bg-secondary);
}

.event-menu-dropdown button:first-child {
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}

.event-menu-dropdown button:last-child {
    border-radius: 0 0 var(--radius-xs) var(--radius-xs);
}

/* --- Fix for expanded sidebar timeline menu --- */
#timeline-options-container #timeline-options-menu {
    right: auto;
    left: 0;
}

/* --- Friend View Back Button --- */
#header-back-btn {
    background: transparent;
    border: none;
    padding: 0;
    font: inherit;
}

#header-back-btn:focus,
#header-back-btn:focus-visible {
    outline: none;
    box-shadow: none;
}


/* --- View Mode Toolbar Dropdown --- */
.view-mode-dropdown-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.view-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-text-secondary);
    background-color: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.view-mode-btn:hover {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.view-mode-btn .view-mode-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

#view-mode-label {
    font-size: 13px;
    line-height: 1;
}

.view-mode-caret {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: transform 0.2s ease;
    margin-left: -2px;
}

.view-mode-dropdown-container.open .view-mode-caret {
    transform: rotate(180deg);
}

/* View Mode Menu */
.view-mode-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px var(--color-overlay-dark-15);
    z-index: var(--z-modal-base);
    overflow: hidden;
}

.view-mode-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.view-mode-menu-item:hover {
    background-color: var(--color-bg-secondary);
}

.view-mode-menu-item.selected {
    background-color: var(--color-bg-tertiary);
}

.view-mode-check {
    width: 16px;
    color: var(--color-primary);
    font-weight: bold;
    visibility: hidden;
}

.view-mode-menu-item.selected .view-mode-check {
    visibility: visible;
}


/* --- Responsive adjustments --- */


@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Members Tab --- */
.members-container {
    max-width: 1000px;
    margin: 0 auto;
}

.members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.members-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.members-count {
    font-size: 14px;
    color: var(--color-text-secondary);
    background-color: var(--color-bg-tertiary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
}

.members-empty-state svg {
    color: var(--color-border-light);
    margin-bottom: 20px;
}

.members-empty-state p {
    margin: 0;
    font-size: 16px;
    color: var(--color-text-muted);
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    background-color: white;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.member-item:hover {
    border-color: var(--color-border-medium);
    box-shadow: var(--shadow-sm);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.member-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.member-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.member-name {
    font-weight: 500;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.member-email {
    font-size: 13px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-current,
.badge-owner {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-owner {
    background-color: var(--color-badge-owner-bg);
    color: var(--color-danger);
}

.badge-current {
    background-color: var(--color-status-success-bg);
    color: var(--color-success);
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.member-role-select {
    padding: var(--spacing-xs) var(--spacing-md);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xs);
    background-color: white;
    color: var(--color-text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.member-role-select:hover {
    border-color: var(--color-border-dark);
    background-color: var(--color-bg-secondary);
}

.member-role-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-brand-primary-10);
}

.member-role-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.member-remove-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xs);
    background-color: white;
    color: var(--color-danger);
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 32px;
}

.member-remove-btn:hover {
    background-color: var(--color-badge-error-bg);
    border-color: var(--color-danger);
}

.member-remove-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.member-role-badge {
    font-size: 13px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-xs);
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.tab-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 16px;
}

@media (max-width: 768px) {
    

    .member-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .member-actions {
        width: 100%;
        margin-top: var(--spacing-lg);
        gap: var(--spacing-lg);
    }

    .member-role-select,
    .member-remove-btn {
        flex: 1;
    }

    .members-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .members-count {
        align-self: flex-start;
    }
}

@media (max-width: 768px) {
    

    

    

    

}

/* --- Invite Modal Styling --- */
.btn-small-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-small-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-small-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.invite-tabs {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    border-bottom: 2px solid var(--color-border-light);
}

.invite-tab-btn {
    padding: var(--spacing-lg) 0;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 1em;
    transition: all 0.2s;
    padding-bottom: var(--spacing-lg);
}

.invite-tab-btn.active {
    color: var(--color-primary);
    border-bottom: 3px solid var(--color-primary);
    margin-bottom: -2px;
}

.invite-tab-btn:hover {
    color: var(--color-primary);
}

.invite-tab-content {
    display: none;
}

.invite-tab-content.active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* GROUP TIMELINES STYLING */
/* ═══════════════════════════════════════════════════════════════════════════ */

.timelines-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0;
}

.timeline-card {
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    background: var(--color-bg-secondary);
    transition: all 0.2s ease;
}

.timeline-card:hover {
    border-color: var(--color-primary);
    background: white;
    box-shadow: var(--shadow-sm);
}

.timeline-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
    gap: var(--spacing-lg);
}

.timeline-card-title {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: var(--spacing-lg);
}

.timeline-name {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-text-primary);
}

.timeline-creator {
    font-size: 0.85em;
    color: var(--color-text-tertiary);
    font-weight: 400;
}

.timeline-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.btn-icon-small {
    padding: var(--spacing-xs) var(--spacing-md);
    border: none;
    background: var(--color-border-light);
    color: var(--color-text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
    min-width: 32px;
    text-align: center;
}

.btn-icon-small:hover {
    background: var(--color-primary);
    color: var(--color-text-on-brand);
}

.btn-icon-small.btn-danger:hover {
    background: var(--color-danger);
}

.timeline-description {
    margin: var(--spacing-md) 0;
    color: var(--color-text-secondary);
    font-size: 0.95em;
    line-height: 1.4;
}

.timeline-metadata {
    display: flex;
    gap: var(--spacing-xl);
    margin: var(--spacing-lg) 0;
    font-size: 0.85em;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
}

.timeline-notes {
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md);
    background: var(--color-bg-tertiary);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-xs);
    color: var(--color-text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
}

.timeline-notes strong {
    color: var(--color-text-primary);
}

.timeline-tags {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-lg);
}

.timeline-tag {
    display: inline-block;
    background: var(--color-badge-info-bg);
    color: var(--color-info);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

/* Phase 1: Timeline status badges */
.timeline-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7em;
    font-weight: 600;
    margin-left: var(--spacing-sm);
    vertical-align: middle;
}

.timeline-status-archived {
    background: var(--color-badge-warning-bg, #fff3cd);
    color: var(--color-warning, #856404);
}

.timeline-status-deleted {
    background: var(--color-badge-danger-bg, #f8d7da);
    color: var(--color-danger, #721c24);
}

.timelines-empty-state svg {
    color: var(--color-border-light);
    margin-bottom: 16px;
    opacity: 0.6;
}

.timelines-empty-state p {
    margin: 8px 0;
    font-size: 1em;
}

.timelines-empty-state .hint-text {
    font-size: 0.9em;
    color: var(--color-border-medium);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* GROUP PHOTOS STYLING */
/* ═══════════════════════════════════════════════════════════════════════════ */

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 0;
}

.photo-card {
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-bg-secondary);
    transition: all 0.2s ease;
}

.photo-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.photo-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 100%;  /* 1:1 aspect ratio */
    overflow: hidden;
    background: var(--color-bg-tertiary);
}

.photo-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--color-danger);
    opacity: 0.9;
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.photo-card:hover .photo-delete-btn {
    opacity: 1;
}

.photo-delete-btn:hover {
    background: var(--color-danger);
    opacity: 1;
}

.photo-info {
    padding: var(--spacing-lg);
}

.photo-name {
    margin: 0;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-meta {
    margin: 4px 0 0 0;
    font-size: 0.75em;
    color: var(--color-text-muted);
}

.photo-description {
    margin: 4px 0 0 0;
    font-size: 0.8em;
    color: var(--color-text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photos-empty-state svg {
    color: var(--color-border-light);
    margin-bottom: 16px;
    opacity: 0.6;
}

.photos-empty-state p {
    margin: 8px 0;
    font-size: 1em;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* GROUP FILES STYLING */
/* ═══════════════════════════════════════════════════════════════════════════ */

.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
}

.file-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-secondary);
    transition: all 0.2s ease;
}

.file-row:hover {
    border-color: var(--color-primary);
    background: white;
    box-shadow: var(--shadow-sm);
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    margin: 0;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    margin: 4px 0 0 0;
    font-size: 0.8em;
    color: var(--color-text-muted);
}

.file-description {
    margin: 4px 0 0 0;
    font-size: 0.85em;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.file-download-btn,
.file-delete-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    border: none;
    background: var(--color-border-light);
    color: var(--color-text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.file-download-btn:hover {
    background: var(--color-primary);
    color: var(--color-text-on-brand);
}

.file-delete-btn:hover {
    background: var(--color-danger);
    color: var(--color-text-on-brand);
}

.files-empty-state svg {
    color: var(--color-border-light);
    margin-bottom: 16px;
    opacity: 0.6;
}

.files-empty-state p {
    margin: 8px 0;
    font-size: 1em;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* FILE UPLOAD STYLING */
/* ═══════════════════════════════════════════════════════════════════════════ */

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.btn-file-select {
    padding: var(--spacing-lg) var(--spacing-lg);
    background: var(--color-primary);
    color: var(--color-text-on-brand);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.btn-file-select:hover {
    background: var(--color-primary-dark);
}

.btn-file-select:active {
    background: var(--color-primary-dark);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--color-border-light);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.plan-warning {
    background: var(--color-alert-warning-bg);
    color: var(--color-warning);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ============================================================
   SCROLL CONTAINER UTILITIES
   For table/list scaffolding cleanup
   ============================================================ */

.u-scroll-60vh {
    max-height: 60vh;
    overflow-y: auto;
}

.u-scroll-400 {
    max-height: 400px;
    overflow-y: auto;
}

.u-w-100 {
    width: 100%;
}

.u-min-w-0 {
    min-width: 0;
}

.u-scroll-85vh-offset {
    max-height: calc(85vh - 280px);
    overflow-y: auto;
}

.u-pb-10 {
    padding-bottom: 10px;
}

.u-flex-1 {
    flex: 1;
}

.u-m-0 {
    margin: 0;
}

.u-p-6-12 {
    padding: 6px 12px;
}

.u-fs-09em {
    font-size: 0.9em;
}

.u-nowrap {
    white-space: nowrap;
}

.u-mt-2 {
    margin-top: 2px;
}

.u-mt-4 {
    margin-top: 4px;
}

.u-mt-8 {
    margin-top: 8px;
}

.u-mt-12 {
    margin-top: 12px;
}

.u-mt-16 {
    margin-top: 16px;
}

.u-mb-10 {
    margin-bottom: 10px;
}

.u-mb-20 {
    margin-bottom: 20px;
}

.u-flex-08 {
    flex: 0.8;
}

.u-flex-06 {
    flex: 0.6;
}

.u-fs-075rem {
    font-size: 0.75rem;
}

.u-fs-078rem {
    font-size: 0.78rem;
}

.u-fs-08rem {
    font-size: 0.8rem;
}

.u-fs-085em {
    font-size: 0.85em;
}

.u-fs-085rem {
    font-size: 0.85rem;
}

.u-fw-500 {
    font-weight: 500;
}

.u-fw-600 {
    font-weight: 600;
}

.u-min-h-16 {
    min-height: 16px;
}

.u-min-h-18 {
    min-height: 18px;
}

.u-min-h-20 {
    min-height: 20px;
}

.u-uppercase {
    text-transform: uppercase;
}

.u-p-4-8 {
    padding: 4px 8px;
}

.u-p-5-10 {
    padding: 5px 10px;
}

.u-p-8-10 {
    padding: 8px 10px;
}

.u-p-8-14 {
    padding: 8px 14px;
}

.u-p-10 {
    padding: 10px;
}

.u-p-15 {
    padding: 15px;
}

.u-flex-1-1-140 {
    flex: 1 1 140px;
}

.u-flex-start {
    align-items: flex-start;
}

.u-flex-wrap {
    flex-wrap: wrap;
}

.u-justify-between {
    justify-content: space-between;
}

/* --- Responsive: Header primary nav --- */
@media (max-width: 600px) {
    .header {
        padding: 8px var(--spacing-md);
    }
    
    .header-left-cluster {
        gap: 12px; /* Reduce gap between logo and nav on small screens */
    }
    
    .header-logo-text {
        display: none; /* Hide "You-R-Here" text on very small screens */
    }
    
    .header-primary-nav {
        gap: 6px;
    }
    
    .header-nav-link {
        padding: 8px 2px;
        font-size: 0.9em;
    }
}


