/* ==================== DOCUMENTS — Editorial Header ==================== */
.doc-editorial-header {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    margin-bottom: 28px;
}

.doc-editorial-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(150deg, rgba(246,244,248,0.5) 0%, rgba(248,246,250,0.3) 40%, rgba(250,248,252,0.15) 100%);
    z-index: 0;
}

.doc-editorial-bg::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -8%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, transparent 60%);
    border-radius: 50%;
}

.doc-editorial-inner {
    position: relative;
    z-index: 1;
    padding: 32px 36px 24px;
}

.doc-editorial-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.doc-editorial-title {
    font-size: 36px;
    font-weight: 700;
    font-family: var(--font-editorial);
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.06;
    margin: 0;
}

.doc-editorial-sub {
    font-size: 15px;
    font-weight: 440;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}

.doc-editorial-stats {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 6px;
}



/* ==================== FAMILY INFO STYLES ==================== */
.fi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.fi-category {
    background: var(--glass-bg);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.48);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.fi-category:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }

.fi-cat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.fi-cat-header:hover { background: rgba(0,0,0,0.02); }

.fi-cat-icon {
    width: 28px;
    height: 28px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: none !important;
    overflow: hidden;
}
.fi-cat-icon .material-symbols-outlined {
    width: 28px;
    height: 28px;
    overflow: hidden;
}

.fi-cat-info { flex: 1; }

.fi-cat-name {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.fi-cat-count {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.fi-cat-chevron {
    font-size: 12px;
    color: var(--text-quaternary);
    transition: transform 0.25s var(--ease-default);
}

.fi-category.collapsed .fi-cat-chevron { transform: rotate(-90deg); }
.fi-category.collapsed .fi-cat-body { display: none; }

.fi-cat-body {
    padding: 4px 18px 16px;
    border-top: 1px solid rgba(0,0,0,0.04);
}

.fi-item {
    background: #f8f8fa;
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 10px;
    border: 1px solid rgba(0,0,0,0.03);
    cursor: pointer;
    transition: background 0.15s ease;
}
.fi-item:hover { background: #f0f0f4; }

.fi-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.fi-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    outline: none;
    border-bottom: 1px dashed transparent;
    cursor: text;
}
.fi-item-title:focus { border-bottom-color: var(--system-blue); }

.fi-item-delete {
    border: none;
    background: transparent;
    color: var(--text-quaternary);
    cursor: pointer;
    font-size: 11px;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-out-expo);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fi-item:hover .fi-item-delete,
.fi-item:hover .fi-item-attach-btn { opacity: 1; }
.fi-item .fi-item-attach-btn { opacity: 0; transition: all var(--duration-fast) var(--ease-out-expo); }
.fi-item-delete:hover { color: var(--system-red); background: rgba(255,59,48,0.06); }

.fi-item-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 6px;
    outline: none;
    min-height: 20px;
}

.fi-item-content:empty::before {
    content: attr(data-placeholder);
    color: var(--text-quaternary);
}

.fi-item-content:focus { border-left: 2px solid var(--system-blue); padding-left: 8px; }

.fi-item-content-preview {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.4;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fi-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-quaternary);
}

.fi-empty i { font-size: 24px; margin-bottom: 8px; display: block; opacity: 0.3; }
.fi-empty p { font-size: 13px; }

.fi-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    background: transparent;
    border: 1.5px dashed rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-out-expo);
}

.fi-add-btn:hover { border-color: currentColor; background: rgba(0,0,0,0.01); }

/* ==================== HOME HUB ==================== */
.hub-section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: 20px 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hub-section-label i { font-size: 11px; opacity: 0.5; }

.hub-list-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 4px;
}

.hub-lists {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.hub-list-card {
    break-inside: avoid;
}

.hub-list-header:hover {
    background: rgba(0,122,255,0.04);
}

.hub-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hub-item-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.hub-expand-icon {
    font-size: 11px;
    color: var(--text-tertiary);
    transition: transform 0.3s var(--ease-default);
}

.hub-list-card.collapsed .hub-expand-icon {
    transform: rotate(-90deg);
}

.hub-list-card.collapsed .hub-list-body {
    display: none;
}

.hub-list-body {
    padding: var(--space-lg) var(--space-lg) var(--space-lg);
}

.hub-item {
    background: var(--bg-elevated);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-md);
    margin-bottom: var(--space-sm);
    border: 1px solid var(--separator);
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.hub-item:hover {
    border-color: var(--system-blue-light);
    box-shadow: 0 2px 8px rgba(0,122,255,0.08);
}

.hub-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.hub-item-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    padding: 2px 4px;
    border-radius: 4px;
    flex: 1;
}

.hub-item-title:focus {
    background: rgba(0,122,255,0.06);
    box-shadow: 0 0 0 2px var(--system-blue-light);
}

.hub-item-delete {
    opacity: 0;
    border: none;
    background: none;
    color: var(--system-red);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    transition: opacity 0.2s;
}

.hub-item:hover .hub-item-delete {
    opacity: 0.6;
}

.hub-item-delete:hover {
    opacity: 1 !important;
}

.hub-item-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 20px;
    outline: none;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: pre-wrap;
}

.hub-item-content:empty:before {
    content: attr(data-placeholder);
    color: var(--text-tertiary);
    opacity: 0.5;
}

.hub-item-content:focus {
    background: rgba(0,122,255,0.04);
    box-shadow: 0 0 0 2px var(--system-blue-light);
}

.hub-item-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.hub-tag {
    font-size: 10px;
    background: rgba(0,122,255,0.1);
    color: var(--system-blue);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.hub-empty {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-tertiary);
    font-size: 13px;
}

.hub-add-item {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 2px dashed var(--separator-opaque);
    border-radius: var(--radius-md);
    background: none;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: var(--space-sm);
}

.hub-add-item:hover {
    border-color: var(--system-blue);
    color: var(--system-blue);
    background: rgba(0,122,255,0.04);
}

.hub-add-list {
    margin-top: var(--space-lg);
}

/* ==================== HUB LIST CONTROLS ==================== */
.hub-list-header {
    cursor: default;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hub-list-title-row {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    min-width: 0;
}

.hub-list-controls {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.hub-list-header:hover .hub-list-controls {
    opacity: 1;
}

.hub-list-ctrl-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.hub-list-ctrl-btn:hover {
    background: var(--system-blue-light);
    color: var(--system-blue);
}

.hub-list-ctrl-btn.danger:hover {
    background: rgba(255,59,48,0.1);
    color: var(--system-red);
}

.hub-list-name-text.editing {
    background: var(--system-blue-light);
    padding: 2px 8px;
    border-radius: 6px;
    outline: none;
    min-width: 80px;
}

/* ==================== HUB V2 — Apple Health Module Cards ==================== */
.hub-v2-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin: 32px 0 16px;
}
.hub-v2-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.hub-v2-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.hub-v2-customize {
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--system-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}
.hub-v2-customize:hover { opacity: 0.7; }

.hub-v2-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.hub-v2-card {
    background: rgba(255,255,255,0.60);
    border-radius: 16px;
    border: 0.5px solid rgba(0,0,0,0.04);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    position: relative;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.hub-v2-card:hover {
    box-shadow: var(--shadow-md);
}
.hub-v2-card:active {
    transform: scale(0.98);
    transition: transform 80ms var(--ease-spring);
}
.hub-v2-card:hover .hub-v2-card-overflow { opacity: 1; }

.hub-v2-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.hub-v2-card-header:hover { background: rgba(0,0,0,0.02); }

.hub-v2-icon {
    width: 24px;
    height: 24px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: none !important;
    overflow: hidden;
    position: relative;
}
/* Constrain icon span to container bounds — prevents ligature-failure text bleed */
.hub-v2-icon .material-symbols-outlined {
    font-size: 20px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hub-v2-card-info {
    flex: 1;
    min-width: 0;
}
.hub-v2-card-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-v2-card-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
}

.hub-v2-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.hub-v2-add-btn {
    border: none;
    background: rgba(0,0,0,0.04);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--duration-fast) var(--ease-out-expo);
}
.hub-v2-add-btn:hover {
    background: var(--system-blue);
    color: white;
}

.hub-v2-chevron {
    font-size: 10px;
    color: var(--text-quaternary);
    transition: transform 0.2s ease;
}
.hub-v2-card.collapsed .hub-v2-chevron { transform: rotate(90deg); }

.hub-v2-card-body {
    padding: 0;
}

.hub-v2-preview-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    transition: background 0.15s ease;
    cursor: pointer;
}
.hub-v2-preview-row.bordered {
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
}
.hub-v2-preview-row:hover { background: rgba(0,0,0,0.015); }

.hub-v2-preview-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.6;
}
.hub-v2-preview-info {
    flex: 1;
    min-width: 0;
}
.hub-v2-preview-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-v2-preview-sub {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hub-v2-attach-badge {
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 3px;
}
.hub-v2-row-chevron {
    font-size: 9px;
    color: var(--text-quaternary);
}

.hub-v2-view-all {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--system-blue);
    cursor: pointer;
}
.hub-v2-view-all:hover { opacity: 0.7; }

.hub-v2-card-empty {
    padding: 10px 16px 14px;
}
.hub-v2-card-empty span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-quaternary);
    font-style: italic;
}

.hub-v2-card-overflow {
    position: absolute;
    top: 11px;
    right: 85px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}
.hub-v2-ctrl {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: none;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all var(--duration-fast) var(--ease-out-expo);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.hub-v2-ctrl:hover { background: var(--system-blue-light); color: var(--system-blue); }
.hub-v2-ctrl.danger:hover { background: rgba(255,59,48,0.1); color: var(--system-red); }

/* Compact empty cards — no tall blank rectangle */
.hub-v2-card-compact {
    min-height: auto;
}
.hub-v2-card-compact .hub-v2-card-header {
    padding-bottom: 14px;
}

/* Preview row thumbnails */
.hub-v2-preview-thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 0.5px solid rgba(0,0,0,0.06);
}
.hub-v2-preview-file-icon {
    width: 22px;
    height: 22px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: none;
    color: var(--text-tertiary);
    overflow: hidden;
}
.hub-v2-preview-file-icon .material-symbols-outlined {
    font-size: 16px;
    width: 22px;
    height: 22px;
    overflow: hidden;
}

/* Uploading state */
.hub-v2-card.uploading { opacity: 0.7; pointer-events: none; }

/* ==================== HOME DOCS — Recent Files Row ==================== */
.home-docs-recent-row {
    margin-bottom: 14px;
}
.home-docs-recent-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.home-docs-recent-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.home-docs-recent-scroll::-webkit-scrollbar { display: none; }

.home-docs-recent-file {
    flex-shrink: 0;
    width: 130px;
    background: rgba(255,255,255,0.60);
    border-radius: 12px;
    border: 0.5px solid rgba(0,0,0,0.04);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    padding: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    flex-direction: column;
    gap: 6px;
}
.home-docs-recent-file:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.home-docs-recent-thumb {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    background: rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.home-docs-recent-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.home-docs-recent-thumb i {
    font-size: 20px;
}
.home-docs-recent-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.home-docs-recent-type {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-quaternary);
}

/* Docs tiles grid (inside homeDocsGrid) */
.home-doc-tiles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
@media (max-width: 1200px) {
    .home-doc-tiles-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .home-doc-tiles-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Upload tile accent */
.home-doc-upload-tile {
    border: 1.5px dashed rgba(0,122,255,0.2);
    background: rgba(0,122,255,0.02);
}
.home-doc-upload-tile:hover {
    border-color: rgba(0,122,255,0.35);
    background: rgba(0,122,255,0.04);
}

/* Category doc count badge */
.home-doc-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.07);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make doc tiles relative for count badge */
.home-doc-tile { position: relative; }

/* ==================== FAMILY INFO — Attachment Chips ==================== */
.fi-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}
.fi-item-attach-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--duration-fast) var(--ease-out-expo);
}
.fi-item-attach-btn:hover {
    background: rgba(0,122,255,0.08);
    color: var(--system-blue);
}

.fi-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0 2px;
}
.fi-attach-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    border: 0.5px solid rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out-expo);
    max-width: 220px;
}
.fi-attach-chip:hover {
    background: rgba(0,122,255,0.06);
    border-color: rgba(0,122,255,0.15);
}
.fi-attach-chip i {
    font-size: 12px;
    flex-shrink: 0;
}
.fi-attach-thumb {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.fi-attach-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.fi-attach-remove {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-quaternary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    flex-shrink: 0;
    transition: all var(--duration-fast) var(--ease-out-expo);
}
.fi-attach-remove:hover {
    background: rgba(255,59,48,0.1);
    color: var(--system-red);
}

/* Hub item uploading */
.fi-item.uploading { opacity: 0.6; }

/* ==================== DOCUMENT UPLOAD & MANAGEMENT ==================== */

/* Drop Zone */
/* ==================== iCloud-Style Upload Zone ==================== */
.doc-dropzone {
    position: relative;
    border: 1.5px dashed rgba(0,0,0,0.08);
    border-radius: 16px;
    background: rgba(255,255,255,0.68);
    transition: all 0.25s ease;
    overflow: hidden;
    margin: 0 0 16px 0;
    padding: 16px 20px;
}
.doc-dropzone:hover {
    border-color: rgba(0,122,255,0.2);
    background: rgba(0,122,255,0.03);
}
.doc-dropzone.dragover {
    border-color: var(--system-blue);
    border-style: solid;
    background: rgba(0,122,255,0.06);
    box-shadow: 0 0 0 4px rgba(0,122,255,0.08);
}
.doc-dropzone-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}
.doc-dropzone-icon {
    width: 28px;
    height: 28px;
    border-radius: 0;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--system-blue);
    flex-shrink: 0;
}
.doc-dropzone-text {
    flex: 1;
}
.doc-dropzone-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.doc-dropzone-browse {
    border: none;
    background: none;
    color: var(--system-blue);
    font-weight: 600;
    font-size: inherit;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-decoration: none;
}
.doc-dropzone-browse:hover {
    text-decoration: underline;
}
.doc-dropzone-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 2px 0 0;
}
.doc-dropzone-active {
    position: absolute;
    inset: 0;
    background: rgba(0,122,255,0.08);
    border-radius: inherit;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--system-blue);
}
.doc-dropzone.dragover .doc-dropzone-active { display: flex; }
.doc-dropzone.dragover .doc-dropzone-inner { opacity: 0.15; }

/* Upload Progress */
.doc-upload-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.doc-upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    padding: 10px 14px;
    border: 0.5px solid rgba(0,0,0,0.06);
}
.doc-upload-item.done .doc-upload-fill { background: var(--system-green); }
.doc-upload-item.error .doc-upload-fill { background: var(--system-red); }
.doc-upload-icon { font-size: 18px; flex-shrink: 0; }
.doc-upload-info { flex: 1; min-width: 0; }
.doc-upload-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}
.doc-upload-bar {
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.doc-upload-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--system-blue);
    transition: width 0.3s ease;
    width: 0%;
}
.doc-upload-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}
.doc-upload-item.done .doc-upload-pct { color: var(--system-green); }

/* Document Toolbar — Editorial */
/* ── Document Toolbar ── */
.doc-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 16px 0;
}
.doc-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 10px 14px;
}
.doc-search .material-symbols-outlined {
    color: var(--text-tertiary);
    font-size: 18px;
    flex-shrink: 0;
}
.doc-search i { color: var(--text-tertiary); font-size: 13px; }
.doc-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text-primary);
    font-family: var(--font-system);
}
.doc-search input::placeholder { color: var(--text-quaternary); }

/* ── Filter Pills ── */
.doc-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.doc-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px 5px 8px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(0,0,0,0.02);
    color: var(--text-secondary);
    transition: all 0.18s ease;
    white-space: nowrap;
}
.doc-filter-pill:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}
.doc-filter-pill.active {
    font-weight: 600;
}
.doc-pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: rgba(0,0,0,0.06);
    font-size: 11px;
    font-weight: 600;
    padding: 0 4px;
}
.doc-filter-pill.active .doc-pill-count {
    background: rgba(0,0,0,0.1);
}

/* ── Search Results ── */
.doc-search-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.doc-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin-bottom: 4px;
}
.doc-search-label {
    font-size: 14px;
    color: var(--text-secondary);
}
.doc-search-label em {
    font-style: normal;
    color: var(--text-primary);
    font-weight: 500;
}
.doc-search-clear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--system-blue);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
    font-family: var(--font-system);
}
.doc-search-clear:hover { background: rgba(0,122,255,0.08); }
.doc-search-clear .material-symbols-outlined { font-size: 15px; }

.doc-search-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: 14px 14px 6px;
}
.doc-search-section-label .material-symbols-outlined { font-size: 14px; }

.doc-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
    transition: background 0.15s, border-color 0.15s;
}
.doc-search-row:hover {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.1);
}
.doc-search-row-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.doc-search-row-icon .material-symbols-outlined { font-size: 18px; }
.doc-search-row-info { flex: 1; min-width: 0; }
.doc-search-row-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-search-row-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-search-row-chevron {
    font-size: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.doc-search-row-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.doc-search-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.doc-search-action-btn:hover { background: rgba(0,0,0,0.06); color: var(--text-primary); }
.doc-search-action-btn.danger:hover { background: rgba(255,59,48,0.1); color: #FF3B30; }
.doc-search-action-btn .material-symbols-outlined { font-size: 17px; }

.doc-search-tag {
    display: inline-flex;
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(0,0,0,0.05);
    font-size: 11px;
    color: var(--text-secondary);
    margin-right: 3px;
}

mark.doc-highlight {
    background: rgba(255,204,0,0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.doc-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 48px 24px;
    color: var(--text-tertiary);
    text-align: center;
}
.doc-search-empty .material-symbols-outlined { font-size: 40px; opacity: 0.5; }
.doc-search-empty p { font-size: 16px; font-weight: 500; color: var(--text-secondary); margin: 0; }
.doc-search-empty span { font-size: 13px; }

/* Legacy pill compat */
.doc-pill {
    border: none;
    background: rgba(0,0,0,0.04);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.doc-pill:hover { background: rgba(0,0,0,0.06); }
.doc-pill.active {
    background: var(--system-blue);
    color: white;
}

/* Document Grid */
.doc-grid {
    margin-bottom: 32px;
}
.doc-card {
    background: var(--glass-bg);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.48);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.doc-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.doc-card.pinned {
    border-color: rgba(0,122,255,0.15);
    box-shadow: 0 1px 3px rgba(0,122,255,0.06);
}

.doc-card-thumb {
    height: 80px;
    background: rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}
.doc-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.doc-card-thumb i { font-size: 30px; color: var(--text-tertiary); }

.doc-card-body {
    padding: 12px 14px 10px;
}
.doc-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    outline: none;
    line-height: 1.3;
    margin-bottom: 4px;
    border-radius: 4px;
    padding: 1px 2px;
}
.doc-card-name:focus {
    background: rgba(0,122,255,0.06);
    box-shadow: 0 0 0 2px var(--system-blue-light);
}
.doc-card-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}
.doc-card-type { font-weight: 600; }
.doc-card-cat { }
.doc-cat-select {
    border: none;
    background: rgba(0,0,0,0.04);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-system);
}
.doc-cat-select:hover { background: rgba(0,0,0,0.06); }

.doc-card-actions {
    display: flex;
    gap: 2px;
    padding: 6px 14px 10px;
}
.doc-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: rgba(0,0,0,0.04);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--duration-fast) var(--ease-out-expo);
    text-decoration: none;
}
.doc-action-btn:hover { background: var(--system-blue-light); color: var(--system-blue); }
.doc-action-btn.active { color: var(--system-blue); background: rgba(0,122,255,0.1); }
.doc-action-btn.danger:hover { background: rgba(255,59,48,0.1); color: var(--system-red); }

.doc-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary);
}
.doc-empty-state i { font-size: 40px; opacity: 0.25; margin-bottom: 12px; }
.doc-empty-state p { font-size: 15px; font-weight: 600; color: var(--text-secondary); }
.doc-empty-state span { font-size: 13px; }

/* Document Preview Modal */
/* ==================== ITEM EDITOR MODAL ==================== */
.item-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.item-editor-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.item-editor-modal {
    background: #F5F5F7;
    border-radius: 20px;
    corner-shape: squircle;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.16), 0 0 0 0.5px rgba(0,0,0,0.04);
    transform: scale(0.94) translateY(8px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.18s ease-out;
}
.item-editor-overlay.visible .item-editor-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.item-editor-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 0.5px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}
.item-editor-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.06);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.item-editor-close:hover { background: rgba(0,0,0,0.1); }

.item-editor-title-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.item-editor-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}
.item-editor-icon .material-symbols-outlined {
    font-size: 16px;
    color: white;
}
.item-editor-list-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-editor-save {
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--system-blue);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}
.item-editor-save:hover { opacity: 0.7; }

.item-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.item-editor-field {}
.item-editor-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.item-editor-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    corner-shape: squircle;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(0,0,0,0.02);
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}
.item-editor-input:focus {
    border-color: var(--system-blue);
    background: rgba(255, 255, 255, 0.6);
}
.item-editor-textarea {
    min-height: 100px;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    corner-shape: squircle;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: rgba(0,0,0,0.02);
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}
.item-editor-textarea:focus {
    border-color: var(--system-blue);
    background: rgba(255, 255, 255, 0.6);
}
.item-editor-textarea:empty::before {
    content: attr(data-placeholder);
    color: var(--text-quaternary);
    pointer-events: none;
}

.item-editor-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.item-editor-att {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
    border: 0.5px solid rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out-expo);
    max-width: 260px;
}
.item-editor-att:hover {
    background: rgba(0,122,255,0.05);
    border-color: rgba(0,122,255,0.15);
}
.item-editor-att-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.item-editor-att-icon {
    width: 22px;
    height: 22px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: none;
    color: var(--text-tertiary);
}
.item-editor-att-info {
    flex: 1;
    min-width: 0;
}
.item-editor-att-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
.item-editor-att-meta {
    font-size: 11px;
    color: var(--text-quaternary);
}
.item-editor-att-remove {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-quaternary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    transition: all var(--duration-fast) var(--ease-out-expo);
}
.item-editor-att-remove:hover {
    background: rgba(255,59,48,0.1);
    color: var(--system-red);
}

.item-editor-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1.5px dashed rgba(0,0,0,0.12);
    border-radius: 10px;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--system-blue);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out-expo);
}
.item-editor-attach-btn:hover {
    border-color: var(--system-blue);
    background: rgba(0,122,255,0.04);
}

.item-editor-footer {
    padding: 12px 18px;
    border-top: 0.5px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.item-editor-delete {
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--system-red);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}
.item-editor-delete:hover { opacity: 1; }

/* ==================== LIFE BUCKETS — Unified Category System ==================== */
/* ==================== Category Collections Grid ==================== */
.life-buckets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
@media (max-width: 640px) {
    .life-buckets-grid { grid-template-columns: 1fr; }
}

/* --- Category Card --- */
.life-bucket {
    background: #fff;
    border-radius: 20px;
    corner-shape: squircle;
    padding: 0;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    position: relative;
}
/* Subtle colored top accent bar (uses category color from icon) */
.life-bucket::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 20px 20px 0 0;
}
.life-bucket:hover {
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.life-bucket:hover::before {
    opacity: 0.5;
}
.life-bucket.empty {
    background: #FAFAFA;
    border-style: dashed;
    border-color: rgba(0,0,0,0.08);
}
.life-bucket.empty::before { display: none; }
.life-bucket.empty .life-bucket-name {
    color: var(--text-tertiary);
}
.life-bucket.empty:hover {
    background: #fff;
    border-color: rgba(0,0,0,0.12);
    transform: none;
    box-shadow: none;
}
.life-bucket.open {
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}
.life-bucket.open::before {
    opacity: 1;
    height: 3px;
}
.life-bucket.drag-over {
    border-color: var(--system-blue);
    border-style: solid;
    background: rgba(0,122,255,0.03);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
    transform: scale(1.01);
}

/* --- Category Header (clickable) --- */
.life-bucket-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.life-bucket-header:hover {
    background: rgba(0,0,0,0.015);
}
/* Icon tile — colored background tint using currentColor */
.life-bucket-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    corner-shape: squircle;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: currentColor;
    position: relative;
    box-shadow: 0 2px 8px color-mix(in srgb, currentColor 25%, transparent);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.life-bucket-icon .material-symbols-outlined {
    font-size: 22px;
    color: #fff;
    position: relative;
    z-index: 1;
}
.life-bucket:hover .life-bucket-icon {
    transform: scale(1.05);
    box-shadow: 0 3px 12px color-mix(in srgb, currentColor 30%, transparent);
}
.life-bucket.empty .life-bucket-icon {
    background: rgba(0,0,0,0.06);
    box-shadow: none;
}
.life-bucket.empty .life-bucket-icon .material-symbols-outlined {
    color: var(--text-quaternary);
}
.life-bucket-info {
    flex: 1;
    min-width: 0;
}
.life-bucket-name {
    font-size: 15px;
    font-weight: 650;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.life-bucket-sub {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
    font-weight: 450;
}
.life-bucket-chevron {
    font-size: 18px;
    color: var(--text-quaternary);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    flex-shrink: 0;
}
.life-bucket.open .life-bucket-chevron {
    transform: rotate(180deg);
}

/* --- Accordion Wrapper (CSS-only smooth expand) --- */
.life-bucket-detail-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4,0,0.2,1);
}
.life-bucket.open .life-bucket-detail-wrap {
    grid-template-rows: 1fr;
}
.life-bucket-detail-wrap > .life-bucket-detail {
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s ease 0s;
}
.life-bucket.open .life-bucket-detail-wrap > .life-bucket-detail {
    opacity: 1;
    transition: opacity 0.3s ease 0.08s;
}

/* Hide preview when open */
.life-bucket.open .life-bucket-preview {
    display: none;
}

/* --- Bucket Detail (expanded content) --- */
.life-bucket-detail {
    border-top: 1px solid rgba(0,0,0,0.04);
    padding: 4px 18px 18px;
}

/* --- Section Headers (Info / Files) with inline actions --- */
.life-bucket-section {
    margin-bottom: 4px;
}
/* life-bucket-section-header base layout in components.css */
.life-bucket-section-header { padding: 12px 0 6px; margin-bottom: 0; }
.life-bucket-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-quaternary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.life-section-count {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-quaternary);
    background: rgba(0,0,0,0.05);
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: none;
    letter-spacing: 0;
}
.life-bucket-section-label i {
    font-size: 10px;
}
.life-bucket-inline-action {
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--system-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
    font-family: var(--font-body);
}
.life-bucket-inline-action:hover {
    background: rgba(0,122,255,0.08);
}
/* Empty state (intentional microcopy) */
.life-bucket-empty-state {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 450;
}
.life-bucket-empty-state .material-symbols-outlined {
    font-size: 18px;
    opacity: 0.4;
}

/* --- Inline Preview Rows (closed state) --- */
.life-bucket-preview {
    padding: 0 18px 14px;
    border-top: 1px solid rgba(0,0,0,0.03);
}
.life-preview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.life-preview-row:hover { opacity: 0.7; }
.life-preview-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.life-preview-file-icon {
    font-size: 11px;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}
.life-preview-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.life-preview-more {
    font-size: 12px;
    font-weight: 600;
    color: var(--system-blue);
    padding: 4px 0;
    cursor: pointer;
}
.life-preview-more:hover { text-decoration: underline; }

/* --- Info Item Row --- */
.life-detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    background: rgba(0,0,0,0.015);
    margin-bottom: 4px;
}
.life-detail-item:hover {
    background: rgba(0,0,0,0.04);
}
.life-detail-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px color-mix(in srgb, currentColor 40%, transparent);
}
.life-detail-info {
    flex: 1;
    min-width: 0;
}
.life-detail-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.life-detail-sub {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.life-detail-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-quaternary);
    background: rgba(0,0,0,0.05);
    padding: 2px 7px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.life-detail-chevron {
    font-size: 10px;
    color: var(--text-quaternary);
    flex-shrink: 0;
}

/* --- File Row --- */
.life-detail-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    transition: background 0.15s ease;
    cursor: grab;
    background: rgba(0,0,0,0.015);
    margin-bottom: 4px;
}
.life-detail-file:hover {
    background: rgba(0,0,0,0.04);
}
.life-detail-file:active {
    cursor: grabbing;
}
.life-detail-file.dragging {
    opacity: 0.35;
}
.life-detail-file-thumb {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
}
.life-detail-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}
.life-detail-file-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.life-detail-cat-select {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.04);
    border: none;
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    max-width: 110px;
}
.life-detail-cat-select:focus {
    outline: 2px solid var(--system-blue);
    outline-offset: 1px;
}
.life-detail-file-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: all 0.12s ease;
}
.life-detail-file-btn:hover {
    background: rgba(0,0,0,0.06);
    color: var(--text-secondary);
}
.life-detail-file-btn.danger:hover {
    background: rgba(255,59,48,0.1);
    color: #FF3B30;
}

/* --- Empty state inside bucket --- */
.life-bucket-empty {
    text-align: center;
    padding: 28px 16px;
}
.life-bucket-empty p {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}
.life-bucket-empty span {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ═══ VAULT HEALTH FOOTER ═══ */
.doc-vault-health {
    margin-top: 24px;
    padding: 16px 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1c1c1e, #2c2c2e);
    color: white;
    display: flex;
    align-items: center;
    gap: 16px;
}
.doc-vault-health-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.doc-vault-health-info {
    flex: 1;
}
.doc-vault-health-title {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-sf);
}
.doc-vault-health-sub {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    font-family: var(--font-sf);
}
.doc-vault-health-pct {
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Draggable doc-card enhancements (back compat) */
.doc-card[draggable="true"] { cursor: grab; }
.doc-card[draggable="true"]:active { cursor: grabbing; }
.doc-card.dragging { opacity: 0.35; transform: scale(0.97); }

.doc-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.doc-preview-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.doc-preview-modal {
    background: #F5F5F7;
    border-radius: 20px;
    corner-shape: squircle;
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.16), 0 0 0 0.5px rgba(0,0,0,0.04);
    transform: scale(0.94) translateY(8px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.18s ease-out;
}
.doc-preview-overlay.visible .doc-preview-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.doc-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 0.5px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}
.doc-preview-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-preview-actions {
    display: flex;
    gap: 6px;
}
.doc-preview-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(0,0,0,0.05);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--duration-fast) var(--ease-out-expo);
    text-decoration: none;
}
.doc-preview-btn:hover { background: rgba(0,0,0,0.08); }

.doc-preview-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.doc-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}
.doc-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.doc-preview-text {
    padding: 24px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    width: 100%;
    max-height: 100%;
    overflow: auto;
}
.doc-preview-fallback {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}
.doc-preview-fallback i { font-size: 48px; opacity: 0.3; margin-bottom: 12px; display: block; }
.doc-preview-fallback p { font-size: 16px; font-weight: 600; }
.doc-preview-fallback span { font-size: 13px; color: var(--text-tertiary); }

/* Family Section inside Documents page */
.doc-family-section { margin-top: 16px; }
.doc-family-header { margin-bottom: 16px; }
.doc-family-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.doc-family-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Home Doc Tile — file variant */
.home-doc-tile-file {
    cursor: pointer;
}
.home-doc-icon-file {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 20px;
    color: var(--text-tertiary);
}
.home-doc-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* ============================================================
   QUICK NOTES WIDGET
   ============================================================ */
.note-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 10px;
}
.note-item {
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}
.note-item:hover {
    background: rgba(0,0,0,0.03);
}
.note-text {
    font-size: 13px;
    font-weight: 520;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.note-pin {
    font-size: 13px;
    color: var(--apple-orange, #FF9500);
    vertical-align: middle;
    margin-right: 4px;
}
.note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 3px;
}
.note-time {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-quaternary);
}
.note-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    color: var(--text-quaternary);
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}
.note-item:hover .note-menu-btn {
    opacity: 1;
}
.note-menu-btn:hover {
    background: rgba(0,0,0,0.06);
}
.note-menu-btn .material-symbols-outlined {
    font-size: 16px;
}
.note-empty {
    padding: 24px;
    text-align: center;
}

/* ============================================================
   LIFE RUNWAY (unified timeline)
   ============================================================ */
.runway-list {
    padding: 0 16px;
}
.runway-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
}
.runway-item:last-child {
    border-bottom: none;
}
.runway-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.runway-info {
    flex: 1;
    min-width: 0;
}
.runway-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.runway-when {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-top: 1px;
}
.runway-urgent {
    color: var(--system-red, #FF3B30);
    font-weight: 650;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.runway-amount {
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
    flex-shrink: 0;
}
.runway-amount.income {
    color: #34C759;
}
.runway-event-icon {
    flex-shrink: 0;
}
.runway-event-icon .material-symbols-outlined {
    font-size: 16px;
}
.runway-type-icon {
    font-size: 15px;
    flex-shrink: 0;
}
.runway-group-header {
    font-size: 11px;
    font-weight: 650;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 0 4px;
    animation: runwayFadeIn 0.35s var(--ease-out-expo) both;
}
.runway-group-header:first-child {
    padding-top: 6px;
}
.runway-group-date {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
@keyframes runwayFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.runway-fade-in {
    animation: runwayFadeIn 0.35s var(--ease-out-expo) both;
}
.runway-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px 14px;
}
.runway-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(0,0,0,0.04);
    font-size: 12px;
    font-weight: 600;
    color: var(--system-blue, #007AFF);
    cursor: pointer;
    transition: background 0.15s ease;
}
.runway-action-btn .material-symbols-outlined {
    font-size: 15px;
}
.runway-action-btn:hover {
    background: rgba(0,122,255,0.08);
}
.runway-add-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px;
    border-radius: 6px;
    color: var(--system-blue, #007AFF);
    transition: background 0.15s ease;
}
.runway-add-btn .material-symbols-outlined {
    font-size: 18px;
}
.runway-add-btn:hover {
    background: rgba(0,122,255,0.08);
}

/* ============================================================
   DARK MODE OVERRIDES
   ============================================================ */
