/* =========================================================
   后台 · 纪念日控制台
   ========================================================= */

body.admin {
    padding: 0;
}

.admin-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 20px 24px 40px;
    align-items: start;
}

/* ---------------- 侧边栏 ---------------- */
.side {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    padding: 22px 16px 18px;
    min-height: calc(100vh - 60px);
    animation: fadeUp .55s var(--ease) both;
}

.side-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 8px 18px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 14px;
}
.brand-logo {
    width: 42px; height: 42px; flex: 0 0 auto;
    border-radius: 13px;
    display: grid; place-items: center;
    color: #fff;
    background: linear-gradient(140deg, var(--brand), var(--brand-3));
    box-shadow: 0 12px 24px rgba(109, 94, 252, .32);
    position: relative;
    overflow: hidden;
}
.brand-logo::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, .5), transparent 45%);
    opacity: .55;
}
.side-brand b { display: block; font-size: 14.5px; letter-spacing: -.01em; }
.side-brand span { display: block; font-size: 10px; letter-spacing: .16em; color: var(--muted); font-weight: 700; }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-label {
    font-size: 10.5px; font-weight: 800; letter-spacing: .18em;
    color: var(--muted);
    padding: 12px 12px 6px;
    text-transform: uppercase;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: 13px;
    font-size: 13.5px; font-weight: 600; color: var(--ink-3);
    transition: all .2s var(--ease);
    position: relative;
}
.nav-item .ico { display: grid; place-items: center; width: 22px; }
.nav-item:hover { color: var(--brand); background: var(--glass-2); transform: translateX(2px); }
.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 10px 22px rgba(109, 94, 252, .3);
}
.nav-item.active .count { background: rgba(255, 255, 255, .22); color: #fff; }
.nav-item .count {
    margin-left: auto;
    font-size: 11px; font-weight: 700;
    padding: 1px 8px; border-radius: 99px;
    background: var(--glass-2);
    color: var(--ink-3);
    border: 1px solid var(--line);
}

.side-foot { padding-top: 14px; border-top: 1px solid var(--line-soft); display: grid; gap: 12px; }
.side-user { display: flex; align-items: center; gap: 11px; padding: 4px 6px; border-radius: 12px; }
.side-user:hover { background: var(--glass-2); }
.avatar {
    width: 38px; height: 38px; border-radius: 12px;
    display: grid; place-items: center;
    font-size: 16px; font-weight: 800; color: #fff;
    background: linear-gradient(140deg, var(--brand-2), var(--brand-3));
    box-shadow: var(--neu-sm);
}
.side-user .grow b { display: block; font-size: 13.5px; }
.side-user .grow span { display: block; font-size: 11px; color: var(--muted); }
.btn-block { width: 100%; }

/* ---------------- 主区 ---------------- */
.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.main-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    animation: fadeUp .5s var(--ease) both;
}
.crumb {
    display: flex; align-items: center; gap: 7px;
    font-size: 11.5px; color: var(--muted); letter-spacing: .06em;
    margin-bottom: 6px;
}
.crumb svg { opacity: .6; }
.main-head h1 { font-size: 25px; letter-spacing: -.015em; }
.main-head .desc { margin-top: 5px; font-size: 13px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.side-toggle { display: none; }

.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px;
    border-radius: var(--r-md);
    font-size: 13.5px; font-weight: 600;
    animation: fadeUp .45s var(--ease) both;
}
.flash.ok  { background: rgba(20, 184, 166, .12); color: #0d8f81; border: 1px solid rgba(20, 184, 166, .22); }
.flash.err { background: rgba(239, 85, 112, .12); color: #c93552; border: 1px solid rgba(239, 85, 112, .22); }
[data-theme="dark"] .flash.ok  { color: #6fe3d6; }
[data-theme="dark"] .flash.err { color: #ff9db1; }

/* ---------------- 指标卡 ---------------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.kpi {
    padding: 18px 20px;
    border-radius: var(--r-lg);
    background: var(--glass);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    position: relative;
    overflow: hidden;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
    animation: fadeUp .55s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 60ms);
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi b {
    display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.kpi span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi i {
    position: absolute; right: 14px; top: 14px;
    width: 32px; height: 32px; border-radius: 10px;
    display: grid; place-items: center;
    background: rgba(109, 94, 252, .1); color: var(--brand);
}
.kpi.k2 i { background: rgba(239, 85, 112, .1); color: var(--rose); }
.kpi.k3 i { background: rgba(20, 184, 166, .12); color: var(--mint); }
.kpi.k4 i { background: rgba(240, 160, 58, .14); color: var(--amber); }

/* ---------------- 面板 ---------------- */
.panel {
    padding: 22px 24px;
    border-radius: var(--r-xl);
    background: var(--glass);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(22px) saturate(155%);
    -webkit-backdrop-filter: blur(22px) saturate(155%);
    animation: fadeUp .55s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 60ms);
}
.panel h2 {
    font-size: 14.5px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 9px;
    letter-spacing: -.01em;
}
.panel h2::before {
    content: ""; width: 4px; height: 15px; border-radius: 3px;
    background: linear-gradient(180deg, var(--brand), var(--brand-3));
}
.panel h2 .grow { margin-left: auto; font-weight: 500; }
.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
}
.form-grid .span2 { grid-column: 1 / -1; }

/* ---------------- 列表 ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.list { display: grid; gap: 9px; }

.day-row {
    display: flex; align-items: center; gap: 13px;
    padding: 13px 15px;
    border-radius: var(--r-md);
    background: var(--glass-3);
    border: 1px solid var(--line);
    transition: all .22s var(--ease);
    animation: fadeUp .5s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 40ms);
}
.day-row:hover { background: var(--glass-2); transform: translateX(3px); box-shadow: var(--shadow-sm); }

.day-row .e {
    width: 40px; height: 40px; flex: 0 0 auto;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 19px;
    background: var(--glass-2);
    border: 1px solid var(--stroke);
    box-shadow: var(--neu-sm);
}
.day-row .info { flex: 1; min-width: 0; }
.day-row .info b {
    display: flex; align-items: center; gap: 7px;
    font-size: 14px; font-weight: 650;
}
.day-row .info b .cat { font-size: 11px; font-weight: 600; color: var(--muted); }
.day-row .info span {
    display: block; font-size: 12px; color: var(--muted); margin-top: 1px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.day-row .when {
    text-align: right; flex: 0 0 auto;
    font-size: 12.5px; color: var(--ink-3); font-weight: 650;
    font-variant-numeric: tabular-nums;
    min-width: 76px;
}
.day-row .when small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.day-row .ops { display: flex; gap: 5px; flex: 0 0 auto; }

.row-actions { display: flex; gap: 6px; }

.bar {
    height: 5px; border-radius: 99px;
    background: rgba(126, 142, 178, .18);
    overflow: hidden;
    min-width: 70px;
}
.bar i {
    display: block; height: 100%; border-radius: 99px;
    width: var(--w, 0%);
    background: linear-gradient(90deg, var(--c, #6d5efc), var(--c2, #ff7a9c));
    transition: width .8s var(--ease);
}

/* 分类色点 */
.cat-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px rgba(255,255,255,.55); }
[data-theme="dark"] .cat-dot { box-shadow: 0 0 0 3px rgba(20,24,40,.6); }

/* ---------------- 工具栏 ---------------- */
.toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 13px;
    border-radius: var(--r-lg);
    background: var(--glass-3);
    border: 1px solid var(--line);
    flex-wrap: wrap;
}
.toolbar .search-box { flex: 1 1 200px; position: relative; min-width: 170px; }
.toolbar .search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search-box input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    font-family: inherit; font-size: 13.5px; color: var(--ink);
    background: var(--glass-2);
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    box-shadow: var(--neu-in);
    transition: all .2s var(--ease);
}
.toolbar .search-box input:focus {
    outline: none; border-color: rgba(109, 94, 252, .45);
    box-shadow: var(--neu-in), 0 0 0 4px rgba(109, 94, 252, .12);
}

/* ---------------- 选择器（颜色 / 图标） ---------------- */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
    width: 34px; height: 34px;
    border-radius: 11px;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: var(--neu-sm);
    transition: all .22s var(--ease-spring);
    padding: 0;
}
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: #fff; outline: 2.5px solid var(--brand); transform: scale(1.08); box-shadow: 0 8px 18px rgba(109,94,252,.3); }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
}
.emoji-grid button {
    aspect-ratio: 1;
    font-size: 19px;
    border: 0; border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: all .18s var(--ease);
    display: grid; place-items: center;
}
.emoji-grid button:hover { background: var(--glass-2); transform: scale(1.18); }
.emoji-grid button.on { background: rgba(109, 94, 252, .14); box-shadow: inset 0 0 0 2px var(--brand); }

/* ---------------- 预览卡 ---------------- */
.preview-wrap { position: sticky; top: 20px; }
.mini-preview {
    position: relative;
    padding: 18px;
    border-radius: var(--r-lg);
    background: var(--glass-2);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.mini-preview::before {
    content: "";
    position: absolute;
    width: 170px; height: 170px; border-radius: 50%;
    right: -60px; top: -80px;
    background: radial-gradient(circle, var(--c, #6d5efc), transparent 66%);
    opacity: .3;
    filter: blur(10px);
}
.mini-preview .e2 {
    width: 44px; height: 44px; border-radius: 13px;
    display: grid; place-items: center; font-size: 21px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid var(--stroke);
    box-shadow: var(--neu-sm);
    margin-bottom: 10px;
    position: relative;
}
[data-theme="dark"] .mini-preview .e2 { background: rgba(60, 66, 96, .8); }
.mini-preview b { display: block; font-size: 15.5px; position: relative; }
.mini-preview span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; position: relative; }
.mini-preview .bar { margin-top: 12px; position: relative; }

/* ---------------- 表格（日志等） ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left; font-size: 11.5px; letter-spacing: .08em;
    color: var(--muted); font-weight: 700;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}
.table td {
    padding: 10px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink-2);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .18s var(--ease); }
.table tbody tr:hover { background: var(--glass-2); }
.mono { font-family: var(--mono); font-size: 12px; }

.empty-mini {
    padding: 34px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    border: 1px dashed var(--line-soft);
    border-radius: var(--r-md);
}

/* ---------------- 登录页 ---------------- */
.login-wrap {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
}
.login-card {
    width: 100%; max-width: 400px;
    padding: 38px 34px 30px;
    border-radius: var(--r-2xl);
    background: var(--glass);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(26px) saturate(170%);
    -webkit-backdrop-filter: blur(26px) saturate(170%);
    animation: popIn .65s var(--ease-spring) both;
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: "";
    position: absolute; right: -110px; top: -130px;
    width: 300px; height: 300px; border-radius: 50%;
    background: radial-gradient(circle, var(--brand), transparent 64%);
    opacity: .22; filter: blur(14px);
}
.login-logo {
    width: 56px; height: 56px; border-radius: 17px;
    display: grid; place-items: center;
    color: #fff; margin: 0 auto 16px;
    background: linear-gradient(140deg, var(--brand), var(--brand-3));
    box-shadow: 0 16px 32px rgba(109, 94, 252, .35);
    animation: pulseSoft 5s var(--ease) infinite;
}
.login-card h1 { text-align: center; font-size: 21px; margin-bottom: 4px; }
.login-card .sub { text-align: center; font-size: 12.5px; color: var(--muted); margin-bottom: 24px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }
.login-foot a { color: var(--brand); font-weight: 600; }

.err-box {
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(239, 85, 112, .12);
    border: 1px solid rgba(239, 85, 112, .25);
    color: #c93552;
    font-size: 13px; font-weight: 600;
    margin-bottom: 14px;
    animation: fadeUp .4s var(--ease) both;
}
[data-theme="dark"] .err-box { color: #ff9db1; }

/* ---------------- 杂项 ---------------- */
.foot-note {
    text-align: center;
    font-size: 11.5px;
    color: var(--muted);
    padding-top: 10px;
}
.tag-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.checkline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.inline-form { display: inline; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .preview-wrap { position: static; }
}

@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; padding: 14px 14px 30px; }
    .side {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: 272px; max-width: 84vw;
        z-index: 70;
        border-radius: 0 24px 24px 0;
        transform: translateX(-102%);
        transition: transform .35s var(--ease);
        min-height: 100vh;
        overflow-y: auto;
    }
    .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(20, 26, 44, .35); }
    .side-toggle { display: grid; }
    .main-head { flex-wrap: wrap; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi { padding: 14px 16px; }
    .kpi b { font-size: 22px; }
    .panel { padding: 18px; }
    .day-row .when { display: none; }
}
