:root {
    --bg: #09100d;
    --bg-2: #101a16;
    --panel: rgba(18, 28, 24, 0.88);
    --panel-solid: #111d18;
    --line: rgba(220, 255, 235, 0.14);
    --line-strong: rgba(220, 255, 235, 0.28);
    --text: #ecfff4;
    --muted: #9fb3a7;
    --gold: #f0c86a;
    --green: #2ee892;
    --red: #ff6d6d;
    --cyan: #53d6ff;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(46, 232, 146, 0.14), transparent 32%),
        radial-gradient(circle at 88% 10%, rgba(240, 200, 106, 0.11), transparent 24%),
        linear-gradient(135deg, #070b0a 0%, #0e1914 52%, #11100a 100%);
}

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

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

.auth-body {
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 24px;
}

.market-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.55;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 72px 72px;
    animation: gridDrift 18s linear infinite;
}

.market-background span {
    position: absolute;
    bottom: 12%;
    width: 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--green), rgba(46, 232, 146, 0.08));
    animation: candlePulse 2.8s ease-in-out infinite;
}

.market-background span:nth-child(1) { left: 12%; height: 150px; animation-delay: 0.1s; }
.market-background span:nth-child(2) { left: 24%; height: 90px; animation-delay: 0.5s; background: linear-gradient(180deg, var(--red), rgba(255, 109, 109, 0.08)); }
.market-background span:nth-child(3) { right: 28%; height: 190px; animation-delay: 0.9s; }
.market-background span:nth-child(4) { right: 17%; height: 120px; animation-delay: 1.4s; background: linear-gradient(180deg, var(--gold), rgba(240, 200, 106, 0.08)); }
.market-background span:nth-child(5) { right: 8%; height: 220px; animation-delay: 1.9s; }

@keyframes gridDrift {
    from { background-position: 0 0; }
    to { background-position: 72px 72px; }
}

@keyframes candlePulse {
    0%, 100% { transform: translateY(0) scaleY(0.72); opacity: 0.55; }
    50% { transform: translateY(-26px) scaleY(1); opacity: 1; }
}

.login-wrap {
    position: relative;
    z-index: 2;
    width: min(100%, 440px);
}

.login-card,
.composer-panel,
.activity-panel,
.settings-panel,
.setup-panel,
.error-panel {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-card {
    padding: 34px;
    overflow: hidden;
}

.login-glow {
    position: absolute;
    inset: -80px -40px auto;
    height: 180px;
    background: linear-gradient(90deg, rgba(46, 232, 146, 0.2), rgba(240, 200, 106, 0.18), rgba(83, 214, 255, 0.12));
    filter: blur(28px);
}

.login-header {
    position: relative;
    text-align: center;
    margin-bottom: 28px;
}

.login-header p,
.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-header h1,
.page-header h1,
.panel-heading h2,
.error-panel h1 {
    margin: 0;
    letter-spacing: 0;
}

.login-header h1 {
    font-size: clamp(2rem, 9vw, 3.7rem);
    line-height: 0.95;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(240, 200, 106, 0.55);
    border-radius: 8px;
    color: #0b120f;
    background: linear-gradient(135deg, var(--gold), #fff2b4);
    font-weight: 900;
    box-shadow: 0 12px 30px rgba(240, 200, 106, 0.18);
}

.brand-mark.large {
    width: 62px;
    height: 62px;
    margin-bottom: 18px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    outline: none;
    padding: 13px 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(46, 232, 146, 0.72);
    box-shadow: 0 0 0 4px rgba(46, 232, 146, 0.12);
    background: rgba(255, 255, 255, 0.09);
}

select option {
    background-color: var(--panel-solid);
    color: var(--text);
}

.login-form {
    position: relative;
    display: grid;
    gap: 18px;
}

.password-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 900;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button {
    color: #07100c;
    background: linear-gradient(135deg, var(--green), #b7ffd9);
    padding: 0 20px;
    box-shadow: 0 16px 34px rgba(46, 232, 146, 0.2);
}

.secondary-button {
    display: inline-grid;
    place-items: center;
    color: var(--text);
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.07);
    padding: 0 18px;
}

.ghost-button,
.icon-button {
    color: var(--text);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    padding: 0 14px;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.full {
    width: 100%;
}

.floating-alert,
.alert {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.floating-alert {
    position: fixed;
    top: 18px;
    z-index: 5;
    width: min(420px, calc(100% - 32px));
}

.alert-success,
.floating-alert-success {
    border-color: rgba(46, 232, 146, 0.35);
    color: #c5ffe1;
}

.alert-error,
.floating-alert-error {
    border-color: rgba(255, 109, 109, 0.42);
    color: #ffd5d5;
}

.admin-body {
    min-height: 100vh;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    border-right: 1px solid var(--line);
    background: rgba(8, 14, 12, 0.82);
    padding: 24px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-lockup strong,
.brand-lockup small {
    display: block;
}

.brand-lockup small,
.sidebar-footer span,
.header-copy,
.form-hint,
.empty-state span,
.post-item span,
.post-item small {
    color: var(--muted);
}

.sidebar-nav {
    display: grid;
    align-content: start;
    gap: 8px;
    margin-top: 34px;
}

.sidebar-nav a {
    border-radius: 8px;
    color: var(--muted);
    padding: 13px 14px;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-footer {
    display: grid;
    gap: 10px;
}

.main-panel {
    padding: clamp(20px, 4vw, 40px);
}

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

.page-header h1 {
    font-size: clamp(2rem, 4vw, 4.4rem);
    line-height: 0.95;
}

.dashboard-grid,
.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 22px;
    align-items: start;
}

.composer-panel,
.activity-panel,
.settings-panel,
.setup-panel,
.error-panel {
    padding: 24px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 14px;
    margin-bottom: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.composer-panel {
    display: grid;
    gap: 18px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 12px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.status-pill.ready,
.status-pill.published {
    color: #b7ffd9;
    border-color: rgba(46, 232, 146, 0.35);
}

.status-pill.warning,
.status-pill.failed {
    color: #ffd5d5;
    border-color: rgba(255, 109, 109, 0.38);
}

.upload-zone {
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 18px;
    transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone.is-dragging {
    border-color: var(--green);
    background: rgba(46, 232, 146, 0.09);
}

.upload-zone input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.upload-zone label {
    place-items: center;
    min-height: 120px;
    border-radius: 8px;
    color: var(--text);
    text-align: center;
    cursor: pointer;
}

.upload-zone label span {
    color: var(--muted);
    font-weight: 600;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.image-preview {
    overflow: hidden;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.image-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 1.25;
    object-fit: cover;
}

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

.composer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.activity-panel {
    min-height: 420px;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 240px;
    gap: 6px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    text-align: center;
}

.post-list {
    display: grid;
    gap: 12px;
}

.post-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 14px;
}

.post-item strong,
.post-item span,
.post-item small {
    display: block;
}

.post-item small {
    grid-column: 1 / -1;
    line-height: 1.45;
}

.settings-grid {
    grid-template-columns: minmax(0, 520px) minmax(320px, 1fr);
}

.lower-grid {
    margin-top: 22px;
}

.settings-panel {
    display: grid;
    gap: 18px;
}

.setup-list {
    display: grid;
    gap: 12px;
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.55;
}

.setup-list strong {
    color: var(--text);
}

.error-panel {
    max-width: 720px;
    margin: 0 auto;
}

@media (max-width: 1080px) {
    .app-shell,
    .dashboard-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        grid-template-columns: 1fr;
        gap: 20px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 720px) {
    .page-header,
    .panel-heading {
        display: grid;
    }

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

    .login-card,
    .composer-panel,
    .activity-panel,
    .settings-panel,
    .setup-panel,
    .error-panel {
        padding: 18px;
    }
}
