:root {
    --page-bg: #07111f;
    --page-bg-2: #0b1b31;
    --surface: rgba(9, 17, 32, 0.78);
    --surface-strong: rgba(11, 19, 37, 0.92);
    --border-soft: rgba(148, 163, 184, 0.18);
    --border-strong: rgba(148, 163, 184, 0.28);
    --text-main: #e5eefb;
    --text-soft: #94a3b8;
    --accent: #4f8cff;
    --accent-2: #22c55e;
    --glow: rgba(79, 140, 255, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(79, 140, 255, 0.22), transparent 28%),
        linear-gradient(180deg, var(--page-bg), var(--page-bg-2));
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 75%);
    opacity: 0.45;
}

.app-shell {
    position: relative;
    z-index: 1;
}

.orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(16px);
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
}

.orb-a {
    width: 240px;
    height: 240px;
    top: -40px;
    left: -40px;
    background: rgba(79, 140, 255, 0.18);
}

.orb-b {
    width: 280px;
    height: 280px;
    right: -70px;
    top: 140px;
    background: rgba(34, 197, 94, 0.14);
}

.orb-c {
    width: 180px;
    height: 180px;
    left: 45%;
    bottom: -50px;
    background: rgba(59, 130, 246, 0.14);
}

.hero-copy .display-6,
.app-card .h5,
.eyebrow {
    letter-spacing: -0.02em;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: #7dd3fc;
}

.lead,
.text-muted,
.small {
    color: var(--text-soft) !important;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--border-soft);
    background: rgba(15, 23, 42, 0.74);
    backdrop-filter: blur(14px);
}

.status-ready {
    color: #86efac;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12), 0 0 24px rgba(34, 197, 94, 0.16);
}

.status-warn {
    color: #fcd34d;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.12), 0 0 24px rgba(250, 204, 21, 0.12);
}

.app-card {
    border: 1px solid var(--border-soft);
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(10, 18, 34, 0.88), rgba(6, 12, 24, 0.9));
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.45);
    color: var(--text-main);
    overflow: hidden;
}

.card-header,
.card-body {
    position: relative;
    z-index: 1;
}

.card-header {
    padding: 1.2rem 1.25rem 0.9rem;
}

.card-body {
    padding: 0 1.25rem 1.25rem;
}

.compose-box,
.quick-section {
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 1rem;
}

.prompt-used-panel {
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.5);
    border-radius: 18px;
    padding: 0.9rem 1rem;
}

.prompt-used-text {
    white-space: pre-wrap;
    line-height: 1.55;
    color: #dbeafe;
    font-size: 0.93rem;
}

.ig-panel {
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.45);
    border-radius: 18px;
    padding: 0.9rem 1rem;
}

.upload-panel {
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.45);
    border-radius: 18px;
    padding: 0.9rem 1rem;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.reference-card {
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(8, 15, 28, 0.72);
    border-radius: 14px;
    overflow: hidden;
}

.reference-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.reference-card-name {
    padding: 0.45rem 0.55rem 0.55rem;
    font-size: 0.72rem;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-list {
    max-height: 260px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.schedule-item {
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(8, 15, 28, 0.72);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
}

.schedule-item-title {
    color: #dbeafe;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.schedule-item-meta {
    color: var(--text-soft);
    line-height: 1.45;
    font-size: 0.78rem;
}

.schedule-status {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.schedule-status.pending {
    background: rgba(250, 204, 21, 0.16);
    color: #fde68a;
}

.schedule-status.published {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
}

.schedule-status.failed {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
}

.scheduler-table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(15, 23, 42, 0.38);
    --bs-table-hover-bg: rgba(30, 41, 59, 0.46);
    --bs-table-color: #dbeafe;
    margin-bottom: 0;
}

.scheduler-table th,
.scheduler-table td {
    vertical-align: middle;
    border-color: rgba(148, 163, 184, 0.16);
    font-size: 0.84rem;
}

.scheduler-thumb {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.55);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 430px;
    max-height: 58vh;
    overflow: auto;
    padding-right: 0.25rem;
}

.message {
    display: flex;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: min(85%, 42rem);
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid transparent;
    white-space: pre-wrap;
    line-height: 1.55;
    font-size: 0.97rem;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
}

.message.assistant .message-bubble {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(148, 163, 184, 0.18);
    color: var(--text-main);
    border-bottom-left-radius: 6px;
}

.form-control,
.form-select {
    background: rgba(8, 15, 28, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: var(--text-main);
    border-radius: 16px;
    padding: 0.85rem 1rem;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(79, 140, 255, 0.65);
    box-shadow: 0 0 0 0.25rem rgba(79, 140, 255, 0.14);
    background: rgba(8, 15, 28, 0.98);
    color: var(--text-main);
}

.form-control::placeholder {
    color: rgba(148, 163, 184, 0.8);
}

.btn {
    border-radius: 14px;
    font-weight: 600;
}

.btn-primary,
.btn-accent {
    border: none;
    background: linear-gradient(135deg, #4f8cff, #2563eb);
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.24);
    color: #fff;
}

.btn-primary:hover,
.btn-accent:hover {
    background: linear-gradient(135deg, #66a3ff, #1d4ed8);
    color: #fff;
}

.btn-outline-light {
    color: #e2e8f0;
    border-color: rgba(226, 232, 240, 0.22);
    background: rgba(15, 23, 42, 0.25);
}

.btn-outline-light:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #fff;
}

.btn-soft {
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.44);
}

.btn-soft:hover {
    color: #fff;
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.7);
}

.quick-chip {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.25);
}

.preview-panel {
    min-height: 320px;
    border: 1px dashed rgba(148, 163, 184, 0.28);
    background: rgba(3, 7, 18, 0.38);
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-placeholder {
    max-width: 22rem;
}

.preview-icon {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #eff6ff;
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.9), rgba(34, 197, 94, 0.88));
    box-shadow: 0 18px 30px rgba(37, 99, 235, 0.22);
}

.generated-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
    border-radius: 18px;
}

@media (max-width: 991.98px) {
    .reference-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chat-messages {
        min-height: 340px;
    }

    .hero-copy .display-6 {
        font-size: clamp(2rem, 6vw, 3rem);
    }
}
