:root {
    --pink: #ff9eb5;
    --pink-deep: #f06292;
    --blue-soft: #aecdff;
    --bg0: #fceeff;
    --bg1: #e6f0ff;
    --card: rgba(255, 255, 255, 0.88);
    --text: #4a4a5a;
    --muted: #8888a0;
    --radius: 16px;
    --shadow: 0 12px 40px rgba(255, 158, 181, 0.22);
    --font: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.admin-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: linear-gradient(135deg, var(--bg0) 0%, var(--bg1) 55%, #fff5fb 100%);
    background-attachment: fixed;
}

.admin-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.admin-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow);
    border: 2px solid rgba(255, 255, 255, 0.95);
}

.admin-login-card h1 {
    margin: 0 0 0.35em;
    font-size: 1.65rem;
    background: linear-gradient(120deg, var(--pink-deep), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.admin-login-card .sub {
    margin: 0 0 1.75rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.admin-field {
    margin-bottom: 1.1rem;
}

.admin-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.admin-field input,
.admin-field textarea,
.admin-field select {
    width: 100%;
    padding: 0.72rem 1rem;
    border: 1px solid rgba(255, 158, 181, 0.45);
    border-radius: 12px;
    font: inherit;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-field input:focus,
.admin-field textarea:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(255, 158, 181, 0.25);
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.35rem;
    border: none;
    border-radius: 12px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.2s;
}

.admin-btn:active {
    transform: scale(0.98);
}

.admin-btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--pink), var(--pink-deep));
    color: #fff;
    box-shadow: 0 6px 20px rgba(240, 98, 146, 0.35);
}

.admin-btn-primary:hover {
    box-shadow: 0 8px 26px rgba(240, 98, 146, 0.45);
}

.admin-btn-ghost {
    background: rgba(255, 255, 255, 0.7);
    color: var(--pink-deep);
    border: 1px solid rgba(255, 158, 181, 0.5);
}

.admin-btn-danger {
    background: #fff0f3;
    color: #c2185b;
    border: 1px solid #f8bbd0;
}

.admin-hint {
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
}

/* Dashboard layout */
.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }
    .admin-aside {
        position: sticky;
        top: 0;
        z-index: 20;
    }
}

.admin-aside {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 240, 248, 0.92) 100%);
    border-right: 1px solid rgba(255, 158, 181, 0.25);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--pink-deep);
    padding: 0 0.5rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-nav button {
    text-align: left;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    font: inherit;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.admin-nav button:hover {
    background: rgba(255, 158, 181, 0.15);
}

.admin-nav button.active {
    background: linear-gradient(90deg, rgba(255, 158, 181, 0.35), rgba(174, 205, 255, 0.25));
    color: var(--pink-deep);
    font-weight: 600;
}

.admin-aside-footer {
    margin-top: auto;
    padding: 0.5rem;
}

.admin-main {
    padding: 1.5rem 2rem 3rem;
    max-width: 1200px;
    width: 100%;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-topbar h2 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--text);
}

.admin-panels section.panel {
    display: none;
    animation: fadeIn 0.25s ease;
}

.admin-panels section.panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.stat-card strong {
    display: block;
    font-size: 1.85rem;
    color: var(--pink-deep);
    margin-bottom: 0.25rem;
}

.stat-card span {
    font-size: 0.88rem;
    color: var(--muted);
}

.links-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.links-card a {
    color: var(--pink-deep);
    margin-right: 1.25rem;
    font-weight: 500;
}

.admin-table-wrap {
    overflow: auto;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.admin-table th,
table.admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 158, 181, 0.15);
}

table.admin-table th {
    background: rgba(255, 240, 248, 0.6);
    font-weight: 600;
    color: var(--muted);
}

table.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.5);
}

.cell-muted {
    color: var(--muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-actions {
    white-space: nowrap;
}

.site-editor {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.site-editor textarea {
    width: 100%;
    min-height: 420px;
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 158, 181, 0.35);
    resize: vertical;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.msg {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}

.msg-err {
    background: #ffebee;
    color: #b71c1c;
}

.msg-ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(39, 40, 51, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-backdrop.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

.modal.modal-wide {
    max-width: 640px;
}

.post-form-hint {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0 0 1rem;
    line-height: 1.5;
}

.post-media-upload-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.post-media-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.6rem;
}

.post-media-chip {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 158, 181, 0.45);
    background: #f5f5fa;
}

.post-media-chip img,
.post-media-chip video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-media-chip .chip-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.admin-table .cell-thumb {
    width: 64px;
    text-align: center;
    vertical-align: middle;
    padding: 8px !important;
}

.modal h3 {
    margin: 0 0 1rem;
    color: var(--pink-deep);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}
