:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1f2328;
    --sub: #6b7280;
    --line: #eceef1;
    --brand: #2f6fed;
    --danger: #e5484d;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 14px 60px;
}

/* 顶部 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 10px;
}

.topbar h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.back {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 26px;
    line-height: 1;
    padding: 0;
    margin-left: -6px;
}

.add-btn {
    border: 0;
    background: var(--brand);
    color: #fff;
    padding: 7px 14px;
    border-radius: 16px;
    font-size: 13px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trash-link {
    font-size: 13px;
    color: var(--sub);
    text-decoration: none;
}

.trash-link b {
    font-weight: 500;
    color: var(--danger);
}

/* 统计 */
.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}

.sum-item {
    background: var(--card);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}

.sum-item b {
    display: block;
    font-size: 17px;
    font-weight: 600;
}

.sum-item span {
    font-size: 11px;
    color: var(--sub);
}

/* 月份索引 */
.month-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0 10px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 5;
    -webkit-overflow-scrolling: touch;
}

.month-bar::-webkit-scrollbar {
    display: none;
}

.month-chip {
    flex: 0 0 auto;
    padding: 6px 13px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--sub);
    font-size: 13px;
    white-space: nowrap;
}

.month-chip.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* 时间线 */
.day-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 18px 2px 8px;
    font-size: 14px;
    font-weight: 600;
}

.day-title span {
    font-size: 12px;
    font-weight: 400;
    color: var(--sub);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.cell {
    position: relative;
    padding: 0;
    border: 0;
    background: #e9ecf1;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: block;
    cursor: pointer;
}

.cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cell.noimg img {
    display: none;
}

.cell.noimg::after {
    content: "处理中";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #9aa3af;
}

/* 空状态 */
.empty {
    padding: 60px 20px;
    text-align: center;
}

.empty-art {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    border-radius: 20px;
    background: #e6ebf2;
    position: relative;
}

.empty-art::after {
    content: "";
    position: absolute;
    left: 20px;
    top: 24px;
    width: 36px;
    height: 26px;
    border: 2px solid #b3bcc8;
    border-radius: 4px;
}

.empty p {
    color: var(--sub);
    margin: 0 0 18px;
}

.empty-btn {
    border: 1px solid var(--brand);
    background: transparent;
    color: var(--brand);
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 14px;
}

/* 全屏预览 */
.viewer {
    position: fixed;
    inset: 0;
    background: #0b0d10;
    display: none;
    flex-direction: column;
    z-index: 100;
}

.viewer.show {
    display: flex;
}

.viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #e8eaed;
    font-size: 13px;
}

.viewer-close {
    border: 0;
    background: transparent;
    color: #e8eaed;
    font-size: 24px;
    line-height: 1;
    padding: 0 4px;
}

.viewer img {
    flex: 1;
    width: 100%;
    min-height: 0;
    object-fit: contain;
    background: #0b0d10;
}

.viewer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 22px;
}

.viewer-actions a,
.viewer-actions button {
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: transparent;
    color: #e8eaed;
    padding: 8px 16px;
    border-radius: 18px;
    font-size: 13px;
    text-decoration: none;
}

.viewer-actions button {
    border-color: rgba(229, 72, 77, 0.6);
    color: #ff8a8e;
}

/* 上传进度 */
.progress {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 35, 40, 0.94);
    color: #fff;
    padding: 12px 16px;
    font-size: 13px;
    display: none;
    z-index: 120;
}

.progress.show {
    display: block;
}

.progress-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: #4c8dff;
    transition: width 0.2s;
}

/* toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%) translateY(10px);
    background: rgba(31, 35, 40, 0.92);
    color: #fff;
    padding: 9px 16px;
    border-radius: 18px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 130;
    max-width: 80vw;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loading-tip {
    text-align: center;
    color: var(--sub);
    font-size: 13px;
    padding: 18px 0;
}

/* 回收站 */
.trash-tip {
    background: #fff7e6;
    border: 1px solid #ffe1a8;
    color: #8a6100;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    line-height: 1.6;
    margin: 4px 0 14px;
}

.sheet {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
}

.sheet.show {
    display: block;
}

.sheet-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 22, 0.55);
}

.sheet-body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 16px 16px 22px;
    max-width: 480px;
    margin: 0 auto;
}

.sheet-preview {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.sheet-preview img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: #e9ecf1;
    flex: 0 0 64px;
}

.sheet-meta {
    font-size: 13px;
    color: var(--sub);
    min-width: 0;
}

.sheet-meta b {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-all;
}

.sheet-btn {
    display: block;
    width: 100%;
    border: 0;
    background: #f2f4f7;
    color: var(--text);
    padding: 13px;
    border-radius: 10px;
    font-size: 15px;
    margin-bottom: 8px;
}

.sheet-btn.primary {
    background: var(--brand);
    color: #fff;
}

.sheet-btn.danger {
    background: #fdecec;
    color: var(--danger);
}

.sheet-btn.plain {
    background: transparent;
    color: var(--sub);
    margin-bottom: 0;
}

/* 多选 */
.text-btn {
    border: 0;
    background: transparent;
    color: var(--sub);
    font-size: 13px;
    padding: 6px 2px;
}

.cell .tick {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.28);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    display: none;
}

.cell.selectable .tick {
    display: block;
}

.cell.selected::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(47, 111, 237, 0.22);
    pointer-events: none;
}

.cell.selected .tick {
    background: var(--brand);
    border-color: var(--brand);
}

.cell.selected .tick::after {
    content: "✓";
    color: #fff;
    font-size: 13px;
    line-height: 19px;
    display: block;
    text-align: center;
}

.selbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 10px 16px 14px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 60;
}

.selbar.show {
    display: flex;
}

.selbar-btn {
    border: 0;
    background: #f2f4f7;
    color: var(--text);
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 13px;
    flex: 0 0 auto;
}

.selbar-btn.danger {
    background: var(--danger);
    color: #fff;
}

.selbar-count {
    font-size: 13px;
    color: var(--sub);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

body.selecting {
    padding-bottom: 64px;
}

/* 下拉刷新提示 */
.pull-tip {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--sub);
    background: var(--bg);
    z-index: 50;
    transition: height 0.15s ease;
}
