:root {
    color-scheme: dark;
    --color-body-bg: #0f172a;
    --color-surface: #111827;
    --color-surface-elevated: #1b2545;
    --color-border: #1e293b;
    --color-border-strong: #2b3a55;
    --color-text: #e5e7eb;
    --color-text-muted: #cbd5e1;
    --color-primary: #2563eb;
    --color-primary-hover: #3b82f6;
    --color-accent: #38bdf8;
    --color-danger: #dc2626;
    --shadow-soft: 0 12px 30px rgba(2, 6, 23, .35);
    --shadow-elevated: 0 18px 40px rgba(2, 6, 23, .45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
    background: var(--color-body-bg);
    color: var(--color-text);
}

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

a:hover {
    color: #7dd3fc;
}

.overlay {
    min-height: 100vh;
    padding: 28px 20px 40px;
}

.main-content {
    max-width: 1180px;
    margin: auto;
    background: var(--color-surface);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    padding: 24px;
    border: 1px solid var(--color-border);
}

.page-header {
    margin-bottom: 18px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.header-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(2, 6, 23, .45));
}

.page-header h1 {
    margin: 0 0 6px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--color-text);
}

.page-header p {
    margin: 0;
    color: var(--color-text-muted);
}

.top-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--color-surface-elevated);
    border-radius: 12px;
    border: 1px solid var(--color-border-strong);
}

.top-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .5rem .85rem;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff !important;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
}

.top-nav a:hover {
    background: var(--color-primary-hover);
}

.top-nav a.active {
    outline: 2px solid var(--color-accent);
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    padding: 24px;
    margin-bottom: 20px;
}

h1,
h2,
h3 {
    color: var(--color-text);
}

h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

p {
    margin: 0 0 20px;
    color: var(--color-text-muted);
}

.form {
    display: grid;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--color-text);
    font-weight: 600;
}

input,
select,
button {
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid var(--color-border-strong);
    padding: .6rem .75rem;
    font: inherit;
}

input,
select {
    width: 100%;
    background: var(--color-surface-elevated);
    color: var(--color-text);
}

input::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

input:focus,
select:focus {
    outline: 2px solid rgba(56, 189, 248, .7);
    outline-offset: 2px;
    border-color: rgba(56, 189, 248, .5);
}

button {
    width: fit-content;
    border: 0;
    background: var(--color-primary);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
    transition: background .2s ease, transform .2s ease;
}

button:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    overflow: hidden;
}

th,
td {
    border-bottom: 1px solid var(--color-border);
    padding: .65rem .85rem;
    text-align: left;
    vertical-align: top;
    color: var(--color-text);
}

th {
    background: var(--color-surface-elevated);
    font-size: 13px;
    text-transform: uppercase;
    color: var(--color-text);
}

tbody tr:nth-child(even) td {
    background: var(--color-surface-elevated);
}

tbody tr:hover td {
    background: rgba(56, 189, 248, .12);
}

.preview {
    min-height: 260px;
    border: 1px solid var(--color-border-strong);
    border-radius: 14px;
    overflow: auto;
    background: #f8fafc;
    margin-bottom: 16px;
}

.preview svg {
    display: block;
    width: 100%;
    height: auto;
}

.admin-link {
    margin: 12px 0 0;
}

.page-branding {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    padding: .35rem .85rem;
    border-radius: 12px;
    color: var(--color-text-muted);
    font-size: .95rem;
    line-height: 1.1;
    transition: transform .25s ease, background .25s ease, box-shadow .25s ease, color .25s ease;
}

.page-branding img {
    display: block;
    height: 36px;
    width: auto;
    filter: drop-shadow(0 6px 16px rgba(2, 6, 23, .45));
}

.page-branding:hover {
    transform: scale(2);
    transform-origin: bottom right;
    box-shadow: var(--shadow-elevated);
    color: var(--color-text);
}

@media (max-width: 760px) {
    .main-content {
        padding: 14px;
    }

    .header-title {
        align-items: flex-start;
    }

    .header-logo {
        width: 48px;
        height: 48px;
    }

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

    .page-branding {
        position: static;
        margin: 0 20px 20px auto;
        width: fit-content;
    }
}
