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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: #1a1a2e;
    color: #fff;
    padding: 1.5rem 0;
}

.sidebar h2 {
    padding: 0 1.5rem 1.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar nav {
    padding: 1rem 0;
}

.sidebar a {
    display: block;
    padding: .6rem 1.5rem;
    color: #ccc;
    text-decoration: none;
    font-size: .9rem;
    transition: background .2s;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.main {
    margin-left: 220px;
    padding: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header .user-info {
    font-size: .85rem;
    color: #666;
}

/* Burger button */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: .4rem;
    border-radius: 6px;
    transition: background .2s;
}

.sidebar-toggle:hover {
    background: rgba(0,0,0,.05);
}

.sidebar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #333;
    margin: 5px 0;
    border-radius: 1px;
    transition: transform .3s, opacity .3s;
}

/* Mobile sidebar */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .3s ease;
        z-index: 101;
    }

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

    .main {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,.5);
        z-index: 100;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .card {
        overflow-x: auto;
    }

    th, td {
        white-space: nowrap;
        padding: .5rem .4rem;
        font-size: .8rem;
    }

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

    /* Dict inline rename input */
    .card table input[type="text"][style*="width:300px"] {
        width: 140px !important;
    }

    .pagination a,
    .pagination span {
        padding: .3rem .5rem;
        font-size: .75rem;
    }
}

.header .user-info a {
    color: #e74c3c;
    text-decoration: none;
    margin-left: 1rem;
}

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

th, td {
    text-align: left;
    padding: .75rem .5rem;
    border-bottom: 1px solid #eee;
    font-size: .9rem;
}

th {
    font-weight: 600;
    color: #555;
    background: #fafafa;
}

th a.sortable {
    color: #333;
    text-decoration: none;
    display: block;
    cursor: pointer;
    user-select: none;
}

th a.sortable:hover {
    color: #4a6cf7;
}

th a.sortable .sort-arrow {
    font-size: .7rem;
    margin-left: 2px;
}

th a.sortable .sort-hint {
    color: #bbb;
    font-size: .7rem;
    margin-left: 2px;
}

tr:hover {
    background: #f9f9f9;
}

.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: 6px;
    font-size: .85rem;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    border: none;
    line-height: normal;
    vertical-align: middle;
    transition: background .2s;
}

.btn-primary {
    background: #4a6cf7;
    color: #fff;
}

.btn-primary:hover {
    background: #3b5de7;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #e67e22;
    color: #fff;
}

.btn-warning:hover {
    background: #d35400;
}

.btn-sm {
    padding: .3rem .6rem;
    font-size: .8rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: .3rem;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: .9rem;
    outline: none;
    transition: border .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #4a6cf7;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: .5rem;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: .4rem .8rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: .85rem;
}

.pagination a {
    background: #fff;
    border: 1px solid #ddd;
    color: #4a6cf7;
}

.pagination a:hover {
    background: #f0f0f0;
}

.pagination .current {
    background: #4a6cf7;
    color: #fff;
    border: 1px solid #4a6cf7;
}

.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 500;
}

.badge-admin { background: #e74c3c; color: #fff; }
.badge-editor { background: #f39c12; color: #fff; }
.badge-user { background: #3498db; color: #fff; }

.expand-badge {
    display: inline-block;
    cursor: pointer;
    font-size: .75rem;
    color: #4a6cf7;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 4px;
    transition: background .15s;
    vertical-align: middle;
    user-select: none;
}

.expand-badge:hover {
    background: #eef1ff;
}

.expand-row td {
    background: #fafbfc;
    border-bottom: 2px solid #e0e0e0;
    padding: 1.25rem 1.5rem;
}

.expand-row .detail-grid {
    margin-bottom: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item label {
    font-size: .8rem;
    color: #777;
    display: block;
}

.detail-item span {
    font-size: 1rem;
    font-weight: 500;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .5rem;
    margin-top: 1rem;
}

.image-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform .2s;
}

.image-grid img:hover {
    transform: scale(1.05);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.filters .form-group {
    margin-bottom: 0;
}

.filters .form-group label {
    font-size: .8rem;
}

.filters button[type="submit"] {
    padding: .5rem .75rem;
    font-size: .9rem;
    border: 1px solid #3b5de7;
}

.filters .btn {
    align-self: flex-end;
}

/* Status checkboxes */
.filter-section {
    margin: -.5rem 0 1rem;
}

.filter-section-label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    margin-bottom: .35rem;
    color: #555;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .9rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: #4a6cf7;
}

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eee;
}

.tabs a {
    padding: .6rem 1.2rem;
    text-decoration: none;
    color: #666;
    font-size: .9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}

.tabs a:hover {
    color: #333;
}

.tabs a.active {
    color: #4a6cf7;
    border-bottom-color: #4a6cf7;
}

.inline-form {
    display: inline-flex;
    vertical-align: middle;
}

.logout-form {
    display: inline;
    margin-left: 1rem;
}

.link-button {
    background: none;
    border: none;
    color: #e74c3c;
    text-decoration: none;
    cursor: pointer;
    font-size: .85rem;
    font-family: inherit;
    padding: 0;
}

.link-button:hover {
    text-decoration: underline;
}

.auth-form {
    max-width: 400px;
    margin: 4rem auto;
}

.auth-form .card {
    padding: 2rem;
}

.auth-form h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}
