/* static/css/imgen.css */
:root {
    --bg: #080a12;
    --panel: #101421;
    --panel-2: #151a2b;
    --panel-3: #1b2135;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f4f7fb;
    --muted: #8c95aa;
    --muted-2: #5f687d;
    --accent: #8b5cf6;
    --accent-2: #22d3ee;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
    --shadow-soft: 0 14px 50px rgba(0, 0, 0, 0.24);
    --radius: 22px;
    --radius-sm: 14px;
    --sidebar-width: 280px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.18), transparent 34rem),
        radial-gradient(circle at top right, rgba(34, 211, 238, 0.12), transparent 28rem),
        var(--bg);
    color: var(--text);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

button {
    border: 0;
}

img,
svg {
    max-width: 100%;
}

/* ==========================================================================
   Shared UI
   ========================================================================== */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-size: 24px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 12px 34px rgba(139, 92, 246, 0.28);
    color: white;
    font-weight: 900;
}

.brand-text {
    white-space: nowrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 750;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

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

.button:active {
    transform: translateY(0);
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: 0 14px 34px rgba(139, 92, 246, 0.22);
}

.button-primary:hover {
    box-shadow: 0 18px 44px rgba(139, 92, 246, 0.28);
}

.button-secondary {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.button-secondary:hover {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.09);
}

.button-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.button-full {
    width: 100%;
}

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

.form-row {
    display: grid;
    gap: 8px;
}

.form-row span,
.form-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.input,
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"] {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    outline: none;
    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

textarea {
    min-height: 120px;
    padding-top: 12px;
    resize: vertical;
}

.input:focus,
select:focus,
textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus {
    border-color: rgba(139, 92, 246, 0.72);
    background: rgba(0, 0, 0, 0.28);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: rgba(140, 149, 170, 0.66);
}

/* ==========================================================================
   Flash messages
   ========================================================================== */

.flash-stack {
    display: grid;
    gap: 10px;
}

.app-main > .flash-stack {
    padding: 0 38px;
}

.auth-page > .flash-stack {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: min(430px, calc(100vw - 32px));
    z-index: 20;
}

.flash {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

.auth-page .flash {
    background: rgba(16, 20, 33, 0.96);
}

.flash-danger {
    border-color: rgba(239, 68, 68, 0.42);
}

.flash-warning {
    border-color: rgba(245, 158, 11, 0.42);
}

.flash-success {
    border-color: rgba(34, 197, 94, 0.42);
}

.flash-info,
.flash-message {
    border-color: rgba(34, 211, 238, 0.34);
}

/* ==========================================================================
   Auth / login / error pages
   ========================================================================== */

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.auth-card {
    width: min(100%, 440px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
        rgba(16, 20, 33, 0.78);
    box-shadow: var(--shadow);
    padding: 32px;
    backdrop-filter: blur(18px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.auth-brand .brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 17px;
    font-size: 20px;
}

.auth-brand h1 {
    margin: 0;
    font-size: 36px;
    line-height: 1;
    letter-spacing: -0.07em;
}

.auth-brand p {
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

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

.auth-form label {
    display: grid;
    gap: 8px;
}

.auth-form label span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.auth-submit {
    width: 100%;
    margin-top: 8px;
}

.auth-meta {
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.error-code {
    font-size: clamp(54px, 11vw, 96px);
    line-height: 0.9;
    letter-spacing: -0.08em;
    margin: 0 0 12px;
}

.error-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    border-right: 1px solid var(--border);
    background: rgba(8, 10, 18, 0.72);
    backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-section {
    margin-top: 18px;
    margin-bottom: 4px;
    color: var(--muted-2);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 800;
}

.nav-item {
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--muted);
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.nav-item:hover,
.nav-item.is-active {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.nav-item.is-muted {
    opacity: 0.55;
    pointer-events: none;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: var(--panel-2);
    font-weight: 800;
}

.user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-meta strong {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-meta span,
.logout-link {
    color: var(--muted);
    font-size: 13px;
}

.logout-link:hover {
    color: var(--text);
}

.app-main {
    min-width: 0;
}

.topbar {
    min-height: 112px;
    padding: 30px 38px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

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

.eyebrow,
.kicker {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 800;
}

.topbar h1 {
    margin: 4px 0 0;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1;
    letter-spacing: -0.06em;
}

.page {
    padding: 10px 38px 38px;
}

/* ==========================================================================
   Cards / dashboard
   ========================================================================== */

.hero-card,
.stat-card,
.panel-card {
    border: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035)),
        rgba(16, 20, 33, 0.52);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.hero-card {
    padding: clamp(24px, 4vw, 42px);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
}

.hero-card h2 {
    margin: 8px 0;
    font-size: clamp(30px, 5vw, 58px);
    line-height: 0.95;
    letter-spacing: -0.07em;
}

.hero-card p {
    max-width: 680px;
    color: var(--muted);
    line-height: 1.65;
}

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

.grid-2,
.grid-3,
.grid-4 {
    margin-top: 22px;
    display: grid;
    gap: 18px;
}

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

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

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

.stat-card {
    padding: 22px;
}

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

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-size: 38px;
    line-height: 1;
    letter-spacing: -0.05em;
}

.panel-card {
    padding: 24px;
}

.panel-card h2,
.panel-card h3 {
    margin-top: 0;
    letter-spacing: -0.04em;
}

.panel-card p {
    color: var(--muted);
    line-height: 1.65;
}

.empty-state {
    padding: 36px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.035);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

td {
    color: var(--text);
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */

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

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

    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar .brand {
        justify-content: space-between;
    }

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

    .nav-section {
        grid-column: 1 / -1;
    }

    .sidebar-footer {
        display: none;
    }

    .topbar {
        min-height: auto;
        padding: 24px 20px 14px;
        align-items: flex-start;
        flex-direction: column;
    }

    .page,
    .app-main > .flash-stack {
        padding-left: 20px;
        padding-right: 20px;
    }

    .hero-card {
        align-items: stretch;
        flex-direction: column;
    }

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

@media (max-width: 560px) {
    .auth-page {
        padding: 16px;
        place-items: stretch;
        align-content: center;
    }

    .auth-card {
        padding: 24px;
    }

    .auth-brand {
        align-items: flex-start;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

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

    .hero-card h2 {
        font-size: 38px;
    }

    .hero-actions,
    .topbar-actions,
    .error-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        width: 100%;
    }
}

.auth-page {
    align-content: center;
}

.auth-hero-mark {
    width: min(980px, 94vw);
    margin: 0 auto 28px;
    display: grid;
    place-items: center;
}

.auth-hero-mark + .auth-card {
    margin-inline: auto;
}

.imgen-red-mark {
    width: 100%;
    height: auto;
    overflow: visible;
}

.auth-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background:
        linear-gradient(
            135deg,
            rgba(255, 45, 85, 0.78),
            rgba(255, 255, 255, 0.08) 28%,
            rgba(34, 211, 238, 0.2) 56%,
            rgba(255, 0, 60, 0.72)
        );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

.auth-card::after {
    content: "";
    position: absolute;
    left: -30%;
    top: -2px;
    width: 42%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 122, 144, 0.15),
        rgba(255, 45, 85, 1),
        rgba(255, 122, 144, 0.15),
        transparent
    );
    filter: drop-shadow(0 0 12px rgba(255, 0, 60, 0.8));
    animation: auth-card-scan 3.8s ease-in-out infinite;
    pointer-events: none;
}

.auth-card-glow {
    position: absolute;
    inset: -35%;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 0, 60, 0.26), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.14), transparent 36%);
    filter: blur(18px);
    opacity: 0.9;
    z-index: -2;
    animation: auth-card-breathe 4s ease-in-out infinite;
}

.auth-brand h1 span {
    color: #ff2d55;
    text-shadow: 0 0 22px rgba(255, 0, 60, 0.55);
}

.brand-mark-red {
    background:
        radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.85), transparent 16%),
        linear-gradient(135deg, #ff335f, #ff003c 48%, #7f001c);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 12px 34px rgba(255, 0, 60, 0.34),
        0 0 44px rgba(255, 0, 60, 0.22);
}

.auth-form input {
    position: relative;
}

.auth-form input:hover {
    border-color: rgba(255, 45, 85, 0.28);
}

.auth-submit {
    position: relative;
    overflow: hidden;
}

.auth-submit::before {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-115%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.28),
        transparent
    );
    animation: auth-button-sheen 3.2s ease-in-out infinite;
}

.auth-card-footer {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.red-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #ff003c;
    box-shadow: 0 0 16px rgba(255, 0, 60, 0.95);
    animation: red-dot-pulse 1.7s ease-in-out infinite;
}

@keyframes auth-card-scan {
    0% {
        left: -38%;
        opacity: 0;
    }

    18% {
        opacity: 1;
    }

    54% {
        opacity: 1;
    }

    100% {
        left: 96%;
        opacity: 0;
    }
}

@keyframes auth-card-breathe {
    0%,
    100% {
        opacity: 0.72;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.04);
    }
}

@keyframes auth-button-sheen {
    0%,
    35% {
        transform: translateX(-115%);
    }

    65%,
    100% {
        transform: translateX(115%);
    }
}

@keyframes red-dot-pulse {
    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.85);
    }

    50% {
        opacity: 1;
        transform: scale(1.25);
    }
}

.button.button-red {
    background: linear-gradient(135deg, #ff335f, #ff003c 48%, #8b001f);
    color: white;
    box-shadow:
        0 14px 34px rgba(255, 0, 60, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.button.button-red:hover {
    box-shadow:
        0 18px 44px rgba(255, 0, 60, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.26);
}