:root {
    color-scheme: dark;
    --bg: #0d0e11;
    --panel: #16171c;
    --panel2: #1e2026;
    --border: #2b2d35;
    --gold: #d5b477;
    --gold-light: #f1d79e;
    --muted: #8d919c;
    --text: #f2f3f5;
    --green: #4bd1a0;
    --red: #f16f78;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
    font-size: 14px;
}

button, input, select, textarea {
    font: inherit;
}

button {
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    background: var(--panel2);
    padding: 11px 16px;
    cursor: pointer;
    transition: 0.15s;
}

button:hover {
    border-color: var(--gold);
    transform: translateY(-1px);
}

button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

button.primary {
    background: linear-gradient(120deg, #b99456, #e9cd92);
    color: #17130b;
    font-weight: 800;
    border: 0;
}

button.danger {
    color: var(--red);
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    color: var(--text);
    background: #101116;
    padding: 12px;
    border-radius: 8px;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
}

input[type="checkbox"] {
    width: auto;
}

input[type="color"] {
    padding: 3px;
    height: 40px;
}

label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin: 12px 0 6px;
}

h1, h2, h3, p {
    margin-top: 0;
}

p, small {
    color: var(--muted);
}

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

.hidden {
    display: none !important;
}

.eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--gold);
}

.brand-logo {
    color: var(--gold-light);
    font-size: 39px;
    font-weight: 950;
    letter-spacing: 8px;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(ellipse at 30% 0%, #302518 0%, transparent 50%),
        var(--bg);
}

.login-card {
    width: min(420px, 100%);
    background: #17181d;
    border: 1px solid #39352e;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 100px #0008;
}

.login-card h1 {
    font-size: 35px;
    margin: 30px 0 10px;
}

.login-card button {
    width: 100%;
    margin-top: 22px;
}

.login-card small {
    display: block;
    text-align: center;
    margin-top: 20px;
}

.error {
    color: var(--red);
    padding-top: 10px;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 245px;
    background: #121318;
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.brand {
    text-align: center;
    padding: 10px 0 28px;
}

.brand strong, .brand small {
    display: block;
    letter-spacing: 3px;
    margin-top: 6px;
}

.nav-label {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 2px;
    margin: 15px 10px;
}

nav button {
    display: block;
    width: 100%;
    text-align: left;
    border-color: transparent;
    background: transparent;
    margin: 3px 0;
    padding: 14px;
}

nav button.active {
    color: var(--gold-light);
    background: #29251e;
    border-color: #514431;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 20px 10px;
}

.sidebar-bottom small {
    display: block;
    margin-top: 8px;
}

.online {
    color: var(--green);
    font-size: 12px;
}

.main {
    margin-left: 245px;
    padding: 25px 30px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 25px;
}

.topbar h2 {
    margin: 8px 0 0;
    font-size: 27px;
}

.account {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account small {
    display: block;
    margin-top: 5px;
}

.hero {
    background:
        radial-gradient(ellipse at right, #59412366, transparent 60%),
        linear-gradient(120deg, #24201b, #18191f);
    border: 1px solid #5d4b32;
    border-radius: 18px;
    padding: 32px;
    margin-bottom: 25px;
}

.hero h1 {
    font-size: 32px;
}

.hero p {
    max-width: 650px;
    line-height: 1.7;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}

.card {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 20px;
    min-width: 0;
}

.metric {
    color: var(--gold-light);
    font-size: 34px;
    font-weight: 800;
    margin-top: 12px;
}

.section-title {
    margin: 30px 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.section-title h2 {
    margin: 0;
}

.templates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 18px;
}

.template {
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
}

.template:hover {
    border-color: var(--gold);
}

.poster {
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 8px;
    background: linear-gradient(145deg, #67491d, #0a0a0a 60%, #35260d);
    color: #f9df9e;
    padding: 20px;
    overflow: hidden;
}

.poster.battle {
    background: linear-gradient(120deg, #8c1525, #0a0c15 50%, #16428f);
    color: white;
}

.poster.editorial {
    background: linear-gradient(120deg, #414246, #0b0c0e);
    color: white;
}

.poster.gaming {
    background: linear-gradient(130deg, #511aac, #101021, #00a4ae);
    color: white;
}

.poster strong {
    font-size: clamp(22px, 3vw, 38px);
    font-weight: 950;
    line-height: 1.1;
}

.poster span {
    font-size: 11px;
    letter-spacing: 5px;
    margin: 15px 0;
}

.poster b {
    font-size: 24px;
    border: 1px solid currentColor;
    padding: 10px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    text-align: left;
}

td, th {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

tr:last-child td {
    border-bottom: 0;
}

.status {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 20px;
    background: #18352b;
    color: var(--green);
}

.status.off {
    background: #3a2026;
    color: var(--red);
}

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

.creator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.creator-image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 8px;
    background: #22242c;
}

.avatar-placeholder {
    display: grid;
    place-items: center;
    color: var(--gold);
    font-size: 44px;
    font-weight: 800;
}

dialog {
    width: min(650px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #494033;
    border-radius: 16px;
    padding: 24px;
    background: #191a20;
    color: var(--text);
}

dialog::backdrop {
    background: #000b;
    backdrop-filter: blur(5px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
}

.modal-submit {
    width: 100%;
    margin-top: 20px;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    max-width: 420px;
    border: 1px solid #52694d;
    background: #21342a;
    color: white;
    padding: 16px 22px;
    border-radius: 10px;
    box-shadow: 0 10px 40px #0009;
}

.toast.bad {
    background: #452329;
    border-color: #76434b;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.editor {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) 240px;
    gap: 12px;
    align-items: start;
}

.editor-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    max-height: 78vh;
    overflow-y: auto;
}

.editor-panel h3 {
    color: var(--gold);
    font-size: 14px;
}

.editor-panel button {
    width: 100%;
    margin-bottom: 7px;
}

.canvas-area {
    background: #08090b;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

#flyerCanvas {
    display: block;
    max-width: 100%;
    max-height: 76vh;
    width: auto;
    height: auto;
    box-shadow: 0 10px 40px #000;
    touch-action: none;
}

.layer {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    margin-bottom: 6px;
    cursor: pointer;
}

.layer.active {
    border-color: var(--gold);
    background: #30291d;
}

.layer span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer button {
    width: auto;
    margin: 0;
    padding: 4px 7px;
}

.photo-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.photo-list img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 8px;
}

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

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

.notice {
    background: #27241e;
    color: #e7cb96;
    border: 1px solid #554630;
    padding: 12px;
    border-radius: 8px;
    line-height: 1.6;
}

@media (max-width: 1100px) {
    .editor {
        grid-template-columns: 175px minmax(0, 1fr);
    }

    .editor > :last-child {
        grid-column: 1/-1;
    }

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

@media (max-width: 700px) {
    .sidebar {
        position: relative;
        width: 100%;
        padding: 12px;
    }

    .brand {
        padding: 8px;
    }

    nav {
        display: flex;
        overflow-x: auto;
        gap: 5px;
    }

    nav button {
        width: auto;
        white-space: nowrap;
    }

    .sidebar-bottom, .nav-label {
        display: none;
    }

    .main {
        margin: 0;
        padding: 15px;
    }

    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

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

    .editor-panel {
        max-height: none;
    }

    .hero {
        padding: 20px;
    }
}
