:root {
    --bg: #06132c;
    --bg2: #0b1735;
    --card: rgba(18, 32, 62, 0.82);
    --card2: rgba(13, 25, 50, 0.92);
    --border: rgba(154, 179, 255, 0.18);
    --text: #f8fbff;
    --muted: #aebbd4;
    --purple: #8b4cff;
    --blue: #2687ff;
    --green: #53c84f;
    --danger: #ff4d5e;
    --gold: #ffd166;
    --radius: 18px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--text);
}

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

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

input, select, textarea {
    width: 100%;
    border: 1px solid rgba(168, 190, 255, 0.25);
    background: rgba(6, 16, 35, 0.76);
    color: var(--text);
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(139, 76, 255, .95);
    box-shadow: 0 0 0 3px rgba(139, 76, 255, .15);
}

textarea {
    resize: vertical;
}

label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}

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

.btn {
    border: 0;
    border-radius: 12px;
    padding: 13px 18px;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, opacity .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #226cff, #8b35ff);
    box-shadow: 0 12px 32px rgba(75, 82, 255, .28);
}

.btn-glow {
    background: linear-gradient(135deg, #9d4dff, #2d8cff);
    box-shadow: 0 0 22px rgba(137, 77, 255, .55), inset 0 0 20px rgba(255, 255, 255, .12);
    font-size: 18px;
    text-transform: uppercase;
}

.btn-soft {
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .15);
}

.btn-full {
    width: 100%;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.alert-success {
    background: rgba(63, 202, 97, .15);
    border: 1px solid rgba(63, 202, 97, .35);
    color: #b9ffca;
}

.alert-danger {
    background: rgba(255, 77, 94, .15);
    border: 1px solid rgba(255, 77, 94, .35);
    color: #ffc5cc;
}

/* Login */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(139, 76, 255, .22), transparent 34%),
        radial-gradient(circle at 80% 15%, rgba(37, 135, 255, .20), transparent 30%),
        linear-gradient(135deg, #061128, #0b1735 54%, #160b38);
}

.glass-card {
    background: rgba(13, 25, 50, .82);
    border: 1px solid rgba(154, 179, 255, .18);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.login-card {
    width: min(420px, 92vw);
    padding: 34px;
    border-radius: 26px;
}

.brand-center {
    text-align: center;
    margin-bottom: 22px;
}

.brand-logo, .app-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, #8b4cff, #1c90ff);
    box-shadow: 0 14px 30px rgba(77, 96, 255, .35);
    font-weight: 900;
}

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

/* Admin */
.admin-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 10%, rgba(36, 129, 255, .16), transparent 30%),
        radial-gradient(circle at 88% 0%, rgba(139, 76, 255, .18), transparent 25%),
        linear-gradient(135deg, #061128, #0b1735 60%, #0e1b3d);
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: rgba(4, 14, 34, .88);
    border-right: 1px solid rgba(154, 179, 255, .14);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand h1, .user-brand h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1;
}

.brand h1 span, .user-brand h1 span {
    color: #8b4cff;
}

.brand p, .user-brand p {
    margin: 6px 0 0;
    color: var(--muted);
}

.side-nav {
    display: grid;
    gap: 8px;
}

.nav-label {
    margin: 22px 8px 8px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-size: 12px;
}

.side-nav a {
    padding: 14px 16px;
    border-radius: 12px;
    color: #f5f8ff;
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 700;
}

.side-nav a:hover, .side-nav a.active {
    background: linear-gradient(135deg, #236cff, #883bff);
    box-shadow: 0 12px 26px rgba(62, 84, 255, .24);
}

.sidebar-stat {
    margin-top: auto;
    border: 1px solid rgba(154, 179, 255, .18);
    border-radius: 14px;
    padding: 18px;
    background: rgba(255, 255, 255, .03);
}

.sidebar-stat small, .sidebar-stat span {
    display: block;
    color: var(--muted);
}

.sidebar-stat strong {
    display: block;
    font-size: 34px;
    margin: 8px 0 2px;
}

.logout-link {
    color: #ff707d;
    border: 1px solid rgba(255, 77, 94, .34);
    background: rgba(255, 77, 94, .08);
    padding: 14px;
    border-radius: 12px;
    font-weight: 800;
    text-align: center;
}

.admin-main {
    padding: 26px;
    overflow: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

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

.topbar p {
    color: var(--muted);
    margin: 6px 0 0;
}

.admin-pill {
    border: 1px solid rgba(154, 179, 255, .18);
    background: rgba(255, 255, 255, .04);
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 800;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    display: flex;
    gap: 22px;
    align-items: center;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .18);
}

.stat-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 32px;
}

.stat-card.purple .stat-icon { background: radial-gradient(circle, #8b4cff, rgba(139, 76, 255, .25)); }
.stat-card.blue .stat-icon { background: radial-gradient(circle, #2687ff, rgba(38, 135, 255, .22)); }
.stat-card.green .stat-icon { background: radial-gradient(circle, #53c84f, rgba(83, 200, 79, .22)); }

.stat-card p {
    margin: 0 0 10px;
    color: #dbe5ff;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    font-size: 34px;
}

.stat-card span {
    color: var(--muted);
}

.panel-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .18);
    padding: 24px;
    margin-bottom: 18px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.section-title.compact {
    margin-bottom: 0;
}

.section-title h3 {
    margin: 0;
    font-size: 20px;
}

.round-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b4cff, #226cff);
    font-weight: 900;
}

.admin-form {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 28px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group small {
    display: block;
    margin-top: 8px;
}

.upload-box {
    min-height: 155px;
    border: 1px dashed rgba(174, 187, 212, .55);
    border-radius: 14px;
    display: grid;
    place-items: center;
    text-align: center;
    background: rgba(0, 0, 0, .10);
    cursor: pointer;
    overflow: hidden;
    margin: 0;
    padding: 18px;
}

.upload-box input {
    display: none;
}

.upload-box img {
    max-width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 12px;
}

.upload-cloud {
    display: block;
    font-size: 38px;
    opacity: .7;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 8px;
}

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

.filter-row {
    display: flex;
    gap: 12px;
}

.filter-row select {
    width: 190px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

th, td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(154, 179, 255, .12);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #e8eeff;
    font-size: 13px;
    background: rgba(6, 16, 35, .40);
}

td {
    font-size: 14px;
}

.thumb {
    width: 64px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.16);
}

.empty-thumb {
    display: grid;
    place-items: center;
    color: var(--muted);
    background: rgba(255,255,255,.04);
    font-size: 12px;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.badge-purple { background: rgba(139, 76, 255, .18); color: #d8c7ff; }
.badge-blue { background: rgba(38, 135, 255, .18); color: #cde3ff; }
.badge-green { background: rgba(83, 200, 79, .18); color: #c8ffc5; }
.badge-gray { background: rgba(255,255,255,.1); color: #fff; }

.status {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}
.status.active { background: rgba(83, 200, 79, .18); color: #9cff92; }
.status.inactive { background: rgba(255, 77, 94, .18); color: #ffb3bb; }

.muted-text {
    color: var(--muted);
    max-width: 360px;
}

.action-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    cursor: pointer;
    border: 1px solid rgba(154, 179, 255, .22);
    color: #fff;
}

.icon-btn.edit { border-color: rgba(38, 135, 255, .55); color: #69a7ff; }
.icon-btn.delete { border-color: rgba(255, 77, 94, .55); color: #ff6b78; }

.empty-row {
    text-align: center;
    color: var(--muted);
    padding: 36px;
}

/* User */
.user-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 0%, rgba(139, 76, 255, .24), transparent 26%),
        radial-gradient(circle at 90% 30%, rgba(38, 135, 255, .14), transparent 28%),
        linear-gradient(135deg, #051028, #08193a 56%, #180b38);
}

.user-header {
    max-width: 1540px;
    margin: 0 auto;
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(154, 179, 255, .12);
}

.user-brand {
    display: flex;
    gap: 14px;
    align-items: center;
}

.app-icon {
    margin: 0;
}

.user-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-nav a {
    padding: 12px 18px;
    border-radius: 12px;
    color: #e8eeff;
    border: 1px solid transparent;
    font-weight: 800;
}

.user-nav a.active, .user-nav a:hover {
    background: rgba(139, 76, 255, .18);
    border-color: rgba(139, 76, 255, .38);
}

.user-main {
    max-width: 1540px;
    margin: 0 auto;
    padding: 32px 28px 40px;
}

.hero-section {
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    gap: 28px;
    align-items: center;
    margin-bottom: 26px;
}

.hero-section h2 {
    margin: 0;
    font-size: clamp(34px, 4vw, 62px);
    line-height: 1.04;
}

.hero-section h2 span {
    background: linear-gradient(135deg, #b66cff, #3ea2ff);
    -webkit-background-clip: text;
    color: transparent;
}

.hero-section p {
    color: #d8e3ff;
    font-size: 18px;
    margin: 18px 0;
}

.hero-points {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-points div {
    padding: 12px 16px;
    border: 1px solid rgba(154, 179, 255, .18);
    background: rgba(255, 255, 255, .05);
    border-radius: 12px;
    font-weight: 800;
}

.hero-orb {
    min-height: 190px;
    position: relative;
    display: grid;
    place-items: center;
}

.hero-orb:before {
    content: '';
    width: 300px;
    height: 160px;
    border-radius: 50%;
    position: absolute;
    background: radial-gradient(circle, rgba(139, 76, 255, .35), transparent 62%);
    filter: blur(2px);
}

.floating-card {
    position: relative;
    width: 120px;
    height: 140px;
    border-radius: 22px;
    background: linear-gradient(135deg, #8b4cff, #315dff);
    display: grid;
    place-items: center;
    font-size: 42px;
    font-weight: 900;
    box-shadow: 0 18px 50px rgba(83, 92, 255, .35);
    transform: rotate(-8deg);
}

.floating-card.image {
    position: absolute;
    width: 104px;
    height: 94px;
    right: 80px;
    bottom: 22px;
    transform: rotate(10deg);
    background: linear-gradient(135deg, #1e99ff, #7d4dff);
}

.builder-grid {
    display: grid;
    grid-template-columns: 1.55fr .9fr;
    gap: 26px;
}

.builder-left, .builder-right {
    display: grid;
    gap: 14px;
    align-content: start;
}

.step-card, .input-panel, .generate-panel, .output-panel, .poster-preview, .tips-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 15px 36px rgba(0,0,0,.18);
}

.step-card {
    padding: 18px;
}

.step-title, .panel-heading {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.step-title span, .panel-heading span {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #8b4cff, #2a7dff);
    box-shadow: 0 0 18px rgba(139, 76, 255, .4);
    font-weight: 900;
    font-size: 20px;
    flex: 0 0 auto;
}

.step-title h3, .panel-heading h3 {
    margin: 0;
    font-size: 19px;
}

.step-title p, .panel-heading p {
    color: var(--muted);
    margin: 4px 0 0;
}

.choice-grid {
    display: grid;
    gap: 14px;
}

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

.choice-card {
    margin: 0;
    position: relative;
    display: grid;
    gap: 10px;
    border: 1px solid rgba(154, 179, 255, .18);
    border-radius: 14px;
    background: rgba(6, 16, 35, .52);
    padding: 10px;
    cursor: pointer;
    min-height: 132px;
}

.choice-card input {
    display: none;
}

.choice-card img, .choice-placeholder {
    width: 100%;
    height: 76px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.12);
}

.choice-placeholder {
    display: grid;
    place-items: center;
    font-size: 34px;
    background: linear-gradient(135deg, rgba(139, 76, 255, .22), rgba(38, 135, 255, .16));
}

.choice-card strong {
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
}

.choice-card.selected {
    border-color: rgba(159, 95, 255, .98);
    box-shadow: 0 0 0 2px rgba(139, 76, 255, .25), 0 0 24px rgba(139, 76, 255, .28);
}

.checkmark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: none;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #ab6cff, #2d8cff);
    z-index: 2;
}

.choice-card.selected .checkmark {
    display: grid;
}

.empty-choice {
    color: var(--muted);
    border: 1px dashed rgba(154, 179, 255, .25);
    border-radius: 14px;
    padding: 20px;
}

.progress-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(154, 179, 255, .14);
}

.progress-strip span {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.05);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.progress-strip span.on {
    background: rgba(139, 76, 255, .22);
    color: #fff;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 14px;
}

.poster-preview, .tips-card, .input-panel, .generate-panel, .output-panel {
    padding: 18px;
}

.poster-preview h3, .tips-card h3 {
    margin: 0 0 14px;
}

.poster-preview h3 span {
    color: #75b7ff;
}

.sample-poster {
    min-height: 250px;
    border-radius: 16px;
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    background:
        radial-gradient(circle at 80% 35%, rgba(139, 76, 255, .55), transparent 24%),
        radial-gradient(circle at 20% 20%, rgba(38, 135, 255, .35), transparent 24%),
        linear-gradient(135deg, #061c48, #120743 70%);
    border: 1px solid rgba(154, 179, 255, .22);
}

.sample-poster h4 {
    font-size: 34px;
    line-height: 1;
    margin: 0 0 12px;
    max-width: 330px;
}

.sample-poster p {
    color: #d7e4ff;
}

.mini-label {
    display: inline-block;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.24);
    background: rgba(0,0,0,.16);
    font-weight: 900;
}

.sample-person {
    width: 145px;
    height: 180px;
    border-radius: 28px;
    background: rgba(255,255,255,.12);
    display: grid;
    place-items: center;
    font-size: 74px;
    box-shadow: inset 0 0 60px rgba(255,255,255,.08);
}

.tips-card ul {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 12px;
    color: #dbe5ff;
}

.plain-list {
    margin: 8px 0 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
    color: #dbe5ff;
}

.input-panel, .generate-panel, .output-panel {
    background: rgba(18, 32, 62, .92);
}

.output-panel textarea {
    min-height: 270px;
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 12px;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    background: linear-gradient(135deg, #168d44, #32c76b);
    color: #fff;
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0,0,0,.3);
    transform: translateY(30px);
    opacity: 0;
    pointer-events: none;
    transition: all .25s;
    font-weight: 900;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 1180px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
    }
    .stat-grid, .admin-form, .builder-grid, .hero-section, .preview-grid {
        grid-template-columns: 1fr;
    }
    .small-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .admin-main, .user-main {
        padding: 18px;
    }
    .user-header, .topbar, .table-head, .form-actions, .user-nav {
        flex-direction: column;
        align-items: stretch;
    }
    .small-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .two-col, .stat-grid {
        grid-template-columns: 1fr;
    }
    .hero-section h2 {
        font-size: 38px;
    }
}
