:root {
    --bg: #09101f;
    --bg-soft: #10192f;
    --surface: #111c34;
    --surface-soft: #152242;
    --text: #f4f7ff;
    --muted: #91a3ca;
    --primary: #ff7f3f;
    --secondary: #35d0ff;
    --danger: #ff6b6b;
    --success: #5ad68c;
    --border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(180deg, #050816, #0b1630);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    padding: 1.5rem;
    border-right: 1px solid var(--border);
    background: rgba(8, 13, 28, 0.9);
    display: grid;
    gap: 1.5rem;
}

.admin-brand,
.admin-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.admin-brand img {
    width: 72px;
}

.admin-brand strong,
.admin-topbar h1,
.login-card h1 {
    font-family: 'Space Grotesk', sans-serif;
}

.admin-brand span,
.admin-topbar p,
.metric-card p,
.table-card td,
.table-card th,
.empty-state,
.helper,
.login-card p {
    color: var(--muted);
}

.admin-nav {
    display: grid;
    gap: 0.45rem;
}

.admin-nav a,
.admin-meta a,
.ghost-link,
.small-button,
.table-actions a,
.table-actions button,
.action-button,
.danger-button {
    padding: 0.85rem 1rem;
    border-radius: 16px;
    transition: 0.2s ease;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(53, 208, 255, 0.12);
    color: var(--secondary);
}

.admin-meta {
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.admin-content {
    padding: 1.5rem;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.4rem;
}

.ghost-link,
.small-button,
.action-button,
.danger-button,
.login-button,
button {
    border: 0;
    font: inherit;
    cursor: pointer;
}

.ghost-link,
.small-button {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.action-button,
.login-button,
button[type='submit'] {
    background: linear-gradient(90deg, var(--primary), #ffc15e);
    color: #1f1404;
    font-weight: 700;
}

.danger-button {
    background: rgba(255, 107, 107, 0.12);
    color: #ffd9d9;
}

.dashboard-grid,
.metrics-grid,
.form-grid,
.two-column,
.gallery-grid {
    display: grid;
    gap: 1rem;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-grid {
    display: grid;
    gap: 1rem;
}

.quick-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-grid-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-grid-actions .small-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    text-align: center;
}

.metric-card,
.table-card,
.form-card,
.login-card,
.gallery-item {
    background: rgba(17, 28, 52, 0.92);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 1.25rem;
}

.metric-card strong {
    font-size: 2rem;
}

.table-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.table-card {
    overflow: auto;
}

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

th,
td {
    padding: 0.95rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    vertical-align: top;
}

.status-pill {
    display: inline-flex;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.status-pill.published {
    color: var(--success);
}

.status-pill.draft {
    color: #ffd479;
}

.status-pill.hidden {
    color: #ff9fa0;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-actions form {
    margin: 0;
}

.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    color: var(--muted);
    cursor: grab;
    font-weight: 700;
    letter-spacing: 0.1em;
}

tr[data-sortable-item] {
    cursor: grab;
}

tr[data-sortable-item].is-dragging {
    opacity: 0.45;
}

tr[data-sortable-item]:hover {
    background: rgba(53, 208, 255, 0.04);
}

.admin-form,
.inline-form,
.login-form {
    display: grid;
    gap: 1rem;
}

.editor-field {
    display: grid;
    gap: 0.75rem;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.editor-button {
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.editor-button:hover {
    background: rgba(53, 208, 255, 0.14);
    color: var(--secondary);
}

.editor-help {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.rich-editor {
    min-height: 240px;
}

.form-grid,
.two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 0.45rem;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font: inherit;
}

textarea {
    min-height: 180px;
    resize: vertical;
}

.flash {
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 18px;
}

.flash-success {
    background: rgba(90, 214, 140, 0.15);
    color: #c6ffe0;
}

.flash-error {
    background: rgba(255, 107, 107, 0.15);
    color: #ffd9d9;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.login-card {
    width: min(460px, 100%);
}

.login-card img {
    width: 88px;
    margin-bottom: 1rem;
}

.helper {
    font-size: 0.92rem;
}

.gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 18px;
    margin-bottom: 0.85rem;
}

@media (max-width: 1100px) {
    .metrics-grid,
    .quick-grid-four,
    .quick-grid-actions,
    .form-grid,
    .two-column,
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 920px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .metrics-grid,
    .quick-grid-four,
    .quick-grid-actions,
    .form-grid,
    .two-column,
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .admin-topbar,
    .table-head,
    .admin-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}
