:root {
    --sidebar-width: 240px;
    --bg: #f8fafc;
    --surface: #ffffff;
    --sidebar-bg: #1e293b;
    --divider: transparent;
    --text: #1e293b;
    --muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-soft: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 6px 24px rgba(15, 23, 42, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.65);
    outline-offset: 2px;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

body.sidebar-open {
    overflow: hidden;
}

.wrap {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 10px 0 24px rgba(15, 23, 42, 0.18);
}

.sidebar-brand {
    padding: 18px 16px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-brand .brand {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.mobile-icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    color: inherit;
    background: transparent;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.mobile-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.4);
}

.sidebar-close-btn {
    color: var(--sidebar-text);
}

.header-menu-btn {
    color: var(--text);
    border-color: rgba(148, 163, 184, 0.3);
}

.header-menu-btn:hover {
    background: #eff6ff;
    border-color: rgba(59, 130, 246, 0.35);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 95;
    border: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin-bottom: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-active);
    transform: translateX(2px);
}

.sidebar-link.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-footer .btn {
    width: 100%;
    justify-content: flex-start;
    color: var(--sidebar-text);
    padding: 10px 12px;
    font-size: 0.8125rem;
}

.sidebar-footer .btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-active);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    backdrop-filter: blur(8px);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.main-header h1 {
    font-size: 1.25rem;
    font-weight: 650;
    color: var(--text);
}

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

.main-body {
    padding: 20px 24px 28px;
}

.panel {
    background: var(--surface);
    margin-bottom: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.panel-head {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.panel-body {
    padding: 16px 20px 20px;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

h2 {
    font-size: 1rem;
    font-weight: 650;
}

.subhead {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.muted {
    color: var(--muted);
    font-size: 0.8125rem;
}

.row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
}

.input {
    background: var(--bg);
    border: 1px solid transparent;
    color: var(--text);
    padding: 9px 12px;
    font-size: 0.875rem;
    min-width: 180px;
    flex: 1;
    max-width: 280px;
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input:focus {
    outline: none;
    background: #fff;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.input::placeholder {
    color: var(--muted);
}

select.input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    border-radius: var(--radius-sm);
}

.btn:hover {
    background: var(--bg);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.btn-danger {
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.status {
    min-height: 18px;
    color: var(--muted);
    font-size: 0.8125rem;
    margin-top: 10px;
    padding: 0 20px 4px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius-md);
    margin: 0 20px 20px;
    background: #fff;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 12px 12px;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr {
    border-top: 1px solid rgba(226, 232, 240, 0.7);
    transition: background-color 0.15s ease;
}

.table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.65);
}

.table tbody tr:hover {
    background: #eef5ff;
}

.table td:nth-child(2) a {
    display: inline-block;
    max-width: 560px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.posts-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px 12px;
}

.posts-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.posts-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.posts-search .input {
    min-width: 240px;
    max-width: 360px;
}

.posts-date-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.posts-date-input {
    min-width: 160px;
    max-width: 170px;
    flex: 0 0 auto;
}

.posts-date-sep {
    color: var(--muted);
    font-size: 0.78rem;
}

.posts-meta {
    font-size: 0.78rem;
}

.posts-table th,
.posts-table td {
    padding: 8px 10px;
    font-size: 0.84rem;
}

.posts-table .posts-index-cell {
    width: 58px;
    color: var(--muted);
}

.posts-table .posts-title-cell {
    min-width: 280px;
    max-width: 560px;
}

.posts-title-link {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.posts-title-link:hover {
    color: var(--accent);
}

.posts-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 18px;
}

.page-btn {
    min-width: 34px;
    height: 32px;
    padding: 0 10px;
    font-size: 0.8rem;
}

.page-btn.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.page-btn:disabled {
    opacity: 0.45;
}

.page-ellipsis {
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0 2px;
}

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

.cell-actions .btn {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.mono {
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace;
    font-size: 0.875em;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: #f1f5f9;
    font-size: 0.75rem;
    color: var(--muted);
    border-radius: 999px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

#login-panel {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    margin-left: 0;
}

#login-panel.panel {
    max-width: 380px;
    width: 100%;
    padding: 32px;
}

#login-panel h2 {
    margin-bottom: 20px;
    font-size: 1.25rem;
}

#login-panel .row {
    width: 100%;
    justify-content: center;
}

#login-panel .input {
    max-width: none;
    width: 100%;
}

#login-panel .status {
    text-align: center;
}

#login-panel .muted {
    max-width: 380px;
    line-height: 1.5;
}

[data-panel] {
    animation: fadeIn 0.15s ease;
}

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

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 20px 20px;
}

.settings-section {
    background: #f8fafc;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.settings-section:nth-child(5),
.settings-section:nth-child(6) {
    grid-column: span 2;
}

.form-row {
    margin-bottom: 12px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-row .input {
    width: 100%;
    max-width: none;
}

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

.stat-card {
    background: var(--surface);
    padding: 16px;
    text-align: center;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}

.env-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.env-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.env-key {
    font-size: 0.8125rem;
    font-weight: 500;
}

.env-value {
    font-size: 0.75rem;
    color: var(--muted);
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", monospace;
}

.env-value.configured {
    color: var(--success);
}

.env-value.not-configured {
    color: var(--warning);
}

.empty-state {
    padding: 32px 16px;
    text-align: center;
    color: var(--muted);
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--muted);
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table td:nth-child(2) a {
        max-width: 360px;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 210px;
    }

    .sidebar {
        width: var(--sidebar-width);
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-section:nth-child(5),
    .settings-section:nth-child(6) {
        grid-column: span 1;
    }

    .table td:nth-child(2) a {
        max-width: 280px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: min(280px, 86vw);
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        box-shadow: 10px 0 26px rgba(15, 23, 42, 0.24);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close-btn,
    .header-menu-btn {
        display: inline-flex;
    }

    .main-content {
        margin-left: 0;
    }

    .main-header {
        padding: 12px 16px;
    }

    .main-header h1 {
        font-size: 1.1rem;
        line-height: 1.25;
    }

    .main-body {
        padding: 16px;
    }

    .panel {
        border-radius: 14px;
    }

    .panel-head {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-body {
        padding: 14px 16px 18px;
    }

    .panel-actions {
        width: 100%;
    }

    .status {
        padding: 0 16px 8px;
    }

    .table-wrap {
        margin: 0 16px 16px;
    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tbody tr {
        padding: 12px;
        background: #fff;
        border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    }

    .table tbody tr:nth-child(even) {
        background: #fff;
    }

    .table tbody tr:last-child {
        border-bottom: none;
    }

    .table th,
    .table td {
        padding: 7px 0;
    }

    .table td {
        display: flex;
        gap: 10px;
        justify-content: space-between;
        align-items: flex-start;
        text-align: right;
        font-size: 0.86rem;
    }

    .table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.72rem;
        font-weight: 650;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        flex: 0 0 auto;
    }

    .table td .cell-actions {
        justify-content: flex-end;
    }

    .table td:nth-child(2) a {
        max-width: 180px;
        white-space: normal;
        text-align: right;
    }

    .posts-tools {
        padding: 0 16px 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .posts-filters {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .posts-search {
        width: 100%;
    }

    .posts-search .input {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .posts-date-filter {
        width: 100%;
        align-items: center;
    }

    .posts-date-input {
        flex: 1 1 42%;
        min-width: 0;
        max-width: none;
    }

    .posts-meta {
        text-align: left;
    }

    .posts-pagination {
        justify-content: flex-start;
        padding: 0 16px 16px;
    }

    .posts-table .posts-title-link {
        text-align: right;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .btn {
        padding: 6px 12px;
    }

    .input {
        min-width: 140px;
    }

    h2 {
        font-size: 0.9375rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-grid {
        padding: 0 16px 16px;
    }

    .card-grid {
        padding: 0 16px 16px;
        gap: 14px;
    }

    .dashboard-grid {
        padding: 0 16px;
        gap: 14px;
    }

    .dashboard-content-row {
        padding: 0 16px 16px;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: min(260px, 90vw);
    }

    .row {
        flex-direction: column;
        align-items: stretch;
    }

    .row .input {
        max-width: none;
        width: 100%;
    }

    .row .btn {
        width: 100%;
    }

    .cell-actions {
        flex-direction: column;
    }

    .cell-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .main-header {
        padding: 12px;
    }

    .main-header h1 {
        font-size: 1rem;
    }

    .settings-grid {
        gap: 12px;
    }

    .table td:nth-child(2) a {
        max-width: 120px;
    }

    .page-btn {
        min-width: 30px;
        height: 30px;
        padding: 0 8px;
        font-size: 0.75rem;
    }

    .posts-date-sep {
        width: 100%;
        text-align: left;
        margin: -2px 0;
    }

    .card-grid,
    .dashboard-grid,
    .dashboard-content-row {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* --- New Styles for Card Layout & Avatar --- */

/* Card Grid Layout */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 20px 20px;
}

.admin-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.admin-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.card-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.card-cover:hover img {
    transform: scale(1.05);
}

.card-cover .upload-hint {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
}

.card-cover:hover .upload-hint {
    opacity: 1;
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-field label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
}

.card-field textarea.input {
    width: 100%;
    max-width: none;
    resize: vertical;
    line-height: 1.6;
}

.portfolio-desc-input {
    min-height: 120px;
}

.card-drag-handle {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    color: #64748b;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    transform: scale(0.8);
}

.card-drag-handle:active {
    cursor: grabbing;
}

.admin-card:hover .card-drag-handle,
.admin-card.drag-ready .card-drag-handle,
.admin-card.dragging .card-drag-handle {
    opacity: 1;
    transform: scale(1);
}

.card-drag-handle:hover {
    color: var(--accent);
    background: #ffffff;
}

.card-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    transform: scale(0.8);
}

.admin-card:hover .card-delete-btn {
    opacity: 1;
    transform: scale(1);
}

.card-delete-btn:hover {
    background: #ef4444;
    color: #fff;
}

.admin-card.dragging {
    opacity: 0.72;
    transform: scale(0.985);
    box-shadow: 0 18px 28px rgba(15, 23, 42, 0.2);
}

.admin-card.drag-over-before {
    box-shadow: inset 0 3px 0 var(--accent);
}

.admin-card.drag-over-after {
    box-shadow: inset 0 -3px 0 var(--accent);
}

/* Avatar Uploader */
.avatar-uploader {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg);
    margin-bottom: 12px;
    border: 2px solid var(--surface);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.avatar-uploader img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
}

.avatar-uploader:hover .avatar-overlay {
    opacity: 1;
}

/* --- Comment Cards (Inbox Style) --- */
.comment-card-modern {
    display: flex;
    gap: 16px;
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--bg);
    transition: transform 0.2s, box-shadow 0.2s;
}

.comment-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.comment-avatar {
    width: 44px;
    height: 44px;
    background: #eff6ff; /* light blue */
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-user-info {
    display: flex;
    flex-direction: column;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
    display: block;
}

.comment-time {
    font-size: 12px;
    color: var(--muted);
}

.comment-context {
    font-size: 12px;
    color: var(--accent);
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
    align-self: flex-start;
}

.comment-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.comment-text.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

.comment-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--bg);
    color: var(--muted);
    transition: all 0.2s;
}

.action-btn.approve:hover {
    background: #dcfce7;
    color: var(--success);
}

.action-btn.reject:hover {
    background: #fee2e2;
    color: var(--danger);
}

.action-btn.delete:hover {
    background: #334155;
    color: #fff;
}

/* --- Modern Dashboard Stats --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columns for desktop */
    gap: 20px;
    padding: 0 20px;
    margin: 8px 0 24px;
}

.stat-card-modern {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.stat-card-modern .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-card-modern .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-card-modern .stat-label {
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.stat-card-modern.highlight {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: white;
}

.stat-card-modern.highlight .stat-icon {
    background: rgba(255,255,255,0.2);
    color: white;
}

.stat-card-modern.highlight .stat-value,
.stat-card-modern.highlight .stat-label {
    color: white;
}

/* Dashboard Layout Adjustments */
.dashboard-content-row {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Charts take 2/3, Timeline takes 1/3 */
    gap: 24px;
    padding: 0 20px 20px;
}

.chart-card-modern {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.05);
    height: 100%;
}

/* --- Vertical Timeline --- */
.timeline-modern {
    position: relative;
    padding-left: 24px;
}

.timeline-modern::before {
    content: '';
    position: absolute;
    left: 7px; /* Center the line */
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bg);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -21px; /* Adjust based on padding-left */
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--accent);
    z-index: 1;
}

.timeline-marker.post {
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-marker.comment {
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success);
}

.timeline-content {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
}

.timeline-time {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
    display: block;
}

.timeline-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
    display: block;
}

.timeline-desc {
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.4;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-content-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .comment-card-modern {
        flex-direction: column;
    }

    .comment-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .comment-actions {
        justify-content: flex-start;
    }

    .admin-card .card-delete-btn {
        opacity: 1;
        transform: scale(1);
    }

    .admin-card .card-drag-handle {
        opacity: 1;
        transform: scale(1);
    }
}

.comments-section {
    margin-bottom: 24px;
}

.comments-section .subhead {
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: none;
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Image Picker & Modal */
.image-picker-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.image-preview {
    width: 64px;
    height: 64px;
    background: var(--bg);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.image-picker-actions {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-picker-actions .input {
    max-width: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-head {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--bg);
}

.modal-head h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.image-upload-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg);
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s;
}

.upload-btn:hover {
    background: var(--accent-hover);
}

.upload-status {
    font-size: 0.8125rem;
    color: var(--muted);
}

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

.image-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
    transition: transform 0.15s, box-shadow 0.15s;
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-thumb {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-name {
    padding: 8px;
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .image-picker-field {
        flex-direction: column;
    }
    
    .image-preview {
        width: 100%;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Chart Dots */
.chart-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 2px solid var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    z-index: 10;
}

.chart-dot:hover {
    transform: translate(-50%, -50%) scale(1.4);
    background: var(--accent);
}
