:root {
    color-scheme: dark;

    --bg: #0b090c;
    --bg-soft: #121014;
    --panel: #171319;
    --panel-soft: #1d1820;
    --panel-hover: #241d27;

    --text: #f7eef5;
    --text-soft: #b9aeb8;
    --text-muted: #817680;

    --pink: #ff3da8;
    --pink-soft: #ff74bf;
    --pink-dark: #b61669;
    --pink-glow: rgba(255, 61, 168, 0.18);

    --green: #56e39f;
    --yellow: #f6c75c;
    --red: #ff667a;
    --blue: #6aa9ff;

    --border: rgba(255, 255, 255, 0.075);
    --border-pink: rgba(255, 61, 168, 0.30);

    --radius: 18px;
    --radius-small: 11px;

    --shadow:
        0 18px 50px rgba(0, 0, 0, 0.32);
}


* {
    box-sizing: border-box;
}


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


body {
    font-family:
        Inter,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    background:
        radial-gradient(
            circle at 10% 0%,
            rgba(255, 61, 168, 0.09),
            transparent 32rem
        ),
        radial-gradient(
            circle at 100% 10%,
            rgba(177, 22, 105, 0.08),
            transparent 28rem
        ),
        var(--bg);

    color: var(--text);
}


button {
    font: inherit;
}


.app-shell {
    width: min(
        1480px,
        calc(100% - 32px)
    );

    margin: 0 auto;
    padding-bottom: 32px;
}


.topbar {
    min-height: 102px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;
}


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


.brand-mark {
    width: 50px;
    height: 50px;

    display: grid;
    place-items: center;

    border-radius: 15px;

    background:
        linear-gradient(
            145deg,
            var(--pink),
            #b71674
        );

    color: white;
    font-size: 23px;
    font-weight: 800;

    box-shadow:
        0 0 0 1px rgba(255,255,255,.07),
        0 0 28px var(--pink-glow);
}


.brand h1 {
    margin: 0;

    font-size: 21px;
    line-height: 1.2;

    letter-spacing: -0.02em;
}


.subtitle {
    margin-top: 4px;

    color: var(--text-muted);
    font-size: 12px;
}


.connection-box {
    display: flex;
    align-items: center;
    gap: 9px;

    padding: 9px 13px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: rgba(255,255,255,.025);

    color: var(--text-soft);
    font-size: 12px;
}


.live-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: var(--yellow);

    box-shadow:
        0 0 10px rgba(246,199,92,.6);
}


.live-dot.online {
    background: var(--green);

    box-shadow:
        0 0 10px rgba(86,227,159,.65);
}


.live-dot.offline {
    background: var(--red);

    box-shadow:
        0 0 10px rgba(255,102,122,.65);
}


.nav-tabs {
    display: flex;
    align-items: center;
    gap: 5px;

    padding: 6px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: rgba(20,16,22,.72);

    backdrop-filter: blur(12px);

    overflow-x: auto;
}


.nav-tab {
    appearance: none;

    padding: 10px 15px;

    border: 0;
    border-radius: 10px;

    background: transparent;

    color: var(--text-soft);

    cursor: pointer;

    transition:
        background .18s ease,
        color .18s ease,
        transform .18s ease;
}


.nav-tab:hover:not(:disabled) {
    color: white;
    background: rgba(255,255,255,.045);
}


.nav-tab.active {
    color: white;

    background:
        linear-gradient(
            135deg,
            rgba(255,61,168,.22),
            rgba(255,61,168,.08)
        );

    box-shadow:
        inset 0 0 0 1px
        rgba(255,61,168,.20);
}


.nav-tab.disabled {
    opacity: .42;
    cursor: default;
}


.soon {
    margin-left: 6px;

    padding: 2px 6px;

    border-radius: 999px;

    background: rgba(255,61,168,.13);

    color: var(--pink-soft);

    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .08em;
}


main {
    padding-top: 26px;
}


.view {
    display: none;
}


.view.active {
    display: block;
}


.section-heading {
    margin-bottom: 21px;

    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 20px;
}


.section-heading h2 {
    margin: 0 0 5px;

    font-size: 27px;
    letter-spacing: -.025em;
}


.section-heading p,
.panel-header p {
    margin: 0;

    color: var(--text-muted);
    font-size: 13px;
}


.last-refresh {
    color: var(--text-muted);
    font-size: 11px;
}


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

    gap: 14px;

    margin-bottom: 18px;
}


.stat-card {
    min-height: 125px;

    padding: 20px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background:
        linear-gradient(
            150deg,
            rgba(255,255,255,.025),
            transparent
        ),
        var(--panel);

    box-shadow: var(--shadow);
}


.stat-card.success {
    border-color:
        rgba(86,227,159,.16);
}


.stat-card.archive {
    border-color:
        rgba(106,169,255,.16);
}


.stat-card.attention {
    border-color:
        rgba(246,199,92,.16);
}


.stat-label {
    color: var(--text-muted);
    font-size: 12px;
}


.stat-value {
    margin-top: 15px;

    font-size: 38px;
    line-height: 1;

    font-weight: 750;

    letter-spacing: -.04em;
}


.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);

    background:
        rgba(20,16,22,.78);

    box-shadow: var(--shadow);

    overflow: hidden;
}


.panel-header {
    padding: 19px 21px;

    border-bottom: 1px solid var(--border);
}


.panel-header h3 {
    margin: 0 0 5px;
    font-size: 15px;
}


.job-list {
    display: grid;
    gap: 10px;
}


.panel .job-list {
    padding: 12px;
}


.job-card {
    width: 100%;

    display: grid;
    grid-template-columns:
        minmax(0, 1.7fr)
        minmax(0, 1fr)
        auto;

    align-items: center;
    gap: 20px;

    padding: 16px 18px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--panel-soft);

    color: inherit;

    text-align: left;

    cursor: pointer;

    transition:
        border-color .18s ease,
        background .18s ease,
        transform .18s ease;
}


.job-card:hover {
    background: var(--panel-hover);
    border-color: var(--border-pink);

    transform: translateY(-1px);
}


.job-number {
    font-size: 14px;
    font-weight: 750;
}


.job-recipient {
    margin-top: 5px;

    color: var(--text-soft);
    font-size: 12px;
}


.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    margin-top: 9px;
}


.meta-chip {
    padding: 4px 7px;

    border-radius: 7px;

    background: rgba(255,255,255,.045);

    color: var(--text-muted);

    font-size: 10px;
}


.job-middle {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.7;
}


.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 7px 10px;

    border-radius: 999px;

    font-size: 10px;
    font-weight: 750;

    letter-spacing: .03em;
    text-transform: uppercase;

    white-space: nowrap;
}


.status-badge::before {
    content: "";

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: currentColor;
}


.status-completed {
    color: var(--green);
    background: rgba(86,227,159,.09);
}


.status-awaiting_confirmation {
    color: var(--yellow);
    background: rgba(246,199,92,.09);
}


.status-needs_attention,
.status-failed {
    color: var(--red);
    background: rgba(255,102,122,.09);
}


.status-queued,
.status-preparing,
.status-sending,
.status-retrying {
    color: var(--blue);
    background: rgba(106,169,255,.09);
}


.status-draft {
    color: var(--text-soft);
    background: rgba(255,255,255,.05);
}


.danger-banner {
    margin-bottom: 18px;

    display: flex;
    align-items: center;
    gap: 14px;

    padding: 15px 17px;

    border: 1px solid
        rgba(255,102,122,.30);

    border-radius: 14px;

    background:
        rgba(255,102,122,.08);

    color: #ffdce1;
}


.danger-icon {
    width: 31px;
    height: 31px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 9px;

    background:
        rgba(255,102,122,.16);

    color: var(--red);

    font-weight: 800;
}


.danger-banner strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
}


.danger-banner div div {
    color: #cdaeb4;
    font-size: 11px;
}


.hidden {
    display: none !important;
}


.empty-state {
    padding: 35px;

    border: 1px dashed var(--border);
    border-radius: 14px;

    color: var(--text-muted);

    text-align: center;
    font-size: 12px;
}


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

    gap: 14px;
}


.system-card {
    padding: 20px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--panel);

    box-shadow: var(--shadow);
}


.system-card h3 {
    margin: 0 0 15px;

    font-size: 14px;
}


.system-row {
    min-height: 31px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 16px;

    border-bottom: 1px solid
        rgba(255,255,255,.035);

    color: var(--text-muted);

    font-size: 11px;
}


.system-row:last-child {
    border-bottom: 0;
}


.system-value {
    color: var(--text-soft);
    text-align: right;
}


.good {
    color: var(--green);
}


.bad {
    color: var(--red);
}


footer {
    margin-top: 23px;

    display: flex;
    justify-content: center;
    gap: 15px;

    color: #5d555d;

    font-size: 10px;
}


.modal {
    position: fixed;
    inset: 0;

    z-index: 1000;

    display: grid;
    place-items: center;

    padding: 18px;
}


.modal-backdrop {
    position: absolute;
    inset: 0;

    background:
        rgba(3,2,4,.74);

    backdrop-filter: blur(8px);
}


.modal-card {
    position: relative;

    z-index: 1;

    width: min(850px, 100%);
    max-height: min(820px, 90vh);

    overflow: auto;

    border: 1px solid
        rgba(255,61,168,.20);

    border-radius: 22px;

    background:
        linear-gradient(
            150deg,
            rgba(255,61,168,.035),
            transparent 20rem
        ),
        #151117;

    box-shadow:
        0 35px 90px
        rgba(0,0,0,.65);
}


.modal-header {
    position: sticky;
    top: 0;

    z-index: 3;

    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    padding: 21px 23px;

    border-bottom: 1px solid var(--border);

    background:
        rgba(21,17,23,.94);

    backdrop-filter: blur(12px);
}


.modal-number {
    margin-bottom: 4px;

    color: var(--pink-soft);
    font-size: 11px;
    font-weight: 700;
}


.modal-header h2 {
    margin: 0;
    font-size: 19px;
}


.modal-close {
    width: 35px;
    height: 35px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: rgba(255,255,255,.025);

    color: var(--text-soft);

    cursor: pointer;

    font-size: 22px;
}


.modal-content {
    padding: 22px;
}


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

    gap: 10px;

    margin-bottom: 20px;
}


.detail-box {
    padding: 13px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: rgba(255,255,255,.018);
}


.detail-label {
    margin-bottom: 5px;

    color: var(--text-muted);
    font-size: 9px;

    text-transform: uppercase;
    letter-spacing: .08em;
}


.detail-value {
    overflow-wrap: anywhere;

    color: var(--text-soft);
    font-size: 12px;
}


.timeline-title {
    margin: 22px 0 10px;

    font-size: 13px;
}


.timeline {
    display: grid;
    gap: 8px;
}


.timeline-item {
    padding: 11px 13px;

    border-left: 2px solid
        rgba(255,61,168,.30);

    background: rgba(255,255,255,.018);
}


.timeline-type {
    color: var(--pink-soft);
    font-size: 10px;
    font-weight: 700;
}


.timeline-time {
    margin-top: 3px;

    color: var(--text-muted);
    font-size: 9px;
}


.timeline-message {
    margin-top: 5px;

    color: var(--text-soft);
    font-size: 11px;
}


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

    .job-card {
        grid-template-columns:
            1fr auto;
    }

    .job-middle {
        display: none;
    }

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


@media (
    max-width: 600px
) {
    .app-shell {
        width:
            min(100% - 18px, 1480px);
    }

    .topbar {
        min-height: 88px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand-mark {
        width: 43px;
        height: 43px;
    }

    .connection-box {
        padding: 8px;
    }

    #connection-text {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        min-height: 105px;
        padding: 15px;
    }

    .stat-value {
        font-size: 31px;
    }

    .job-card {
        gap: 10px;
        padding: 14px;
    }

    .status-badge {
        padding: 6px 8px;
        font-size: 8px;
    }

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

    footer {
        flex-wrap: wrap;
    }
}


.top-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}


.user-box {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 7px 8px 7px 12px;

    border: 1px solid var(--border);
    border-radius: 13px;

    background:
        rgba(255,255,255,.025);
}


.user-box > div {
    display: grid;
}


.user-box strong {
    font-size: 11px;
}


.user-box span {
    margin-top: 2px;

    color: var(--pink-soft);

    font-size: 8px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: .07em;
}


.user-box button {
    padding: 7px 9px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background:
        rgba(255,255,255,.025);

    color: var(--text-muted);

    cursor: pointer;

    font-size: 9px;
}


.user-box button:hover {
    border-color: var(--border-pink);
    color: var(--text);
}


@media (max-width: 650px) {
    .user-box > div {
        display: none;
    }

    .user-box {
        padding: 5px;
    }
}


/* =========================================================
   Header / grid structural safeguards
   ========================================================= */

.topbar {
    width: 100%;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    align-items: center;

    column-gap: 24px;
}


.brand {
    min-width: 0;
}


.brand-copy {
    min-width: 0;
}


.brand-copy h1,
.brand-copy .subtitle {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


.top-actions {
    min-width: 0;

    margin-left: auto;

    display: flex;
    align-items: center;

    gap: 9px;

    flex-wrap: nowrap;
}


.connection-box,
.user-box {
    flex: 0 0 auto;
}


.user-identity {
    min-width: 0;

    display: grid;
}


.stats-grid {
    width: 100%;
    min-width: 0;

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


.stat-card {
    min-width: 0;
}


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


@media (max-width: 700px) {
    .topbar {
        grid-template-columns:
            minmax(0, 1fr)
            auto;

        column-gap: 10px;
    }

    .connection-box {
        display: none;
    }
}


@media (max-width: 500px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   Kitty Dark Pink Theme Reinforcement
   ========================================================= */

body {
    background:
        radial-gradient(
            circle at 8% 0%,
            rgba(255, 61, 168, 0.16),
            transparent 34rem
        ),
        radial-gradient(
            circle at 92% 8%,
            rgba(182, 22, 105, 0.14),
            transparent 30rem
        ),
        linear-gradient(
            180deg,
            #0b090c 0%,
            #100c12 100%
        );
}


.topbar {
    background:
        linear-gradient(
            180deg,
            rgba(255, 61, 168, 0.035),
            transparent
        );
}


.nav-tabs {
    border-color:
        rgba(255, 61, 168, 0.16);

    background:
        linear-gradient(
            180deg,
            rgba(255, 61, 168, 0.055),
            rgba(20, 16, 22, 0.88)
        );

    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.025);
}


.nav-tab.active {
    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            rgba(255, 61, 168, 0.30),
            rgba(182, 22, 105, 0.16)
        );

    box-shadow:
        inset 0 0 0 1px
            rgba(255, 61, 168, 0.34),
        0 0 18px
            rgba(255, 61, 168, 0.08);
}


.stat-card {
    background:
        linear-gradient(
            145deg,
            rgba(255, 61, 168, 0.045),
            rgba(255, 255, 255, 0.012)
        ),
        #171319;

    border-color:
        rgba(255, 61, 168, 0.12);
}


.stat-card:hover {
    border-color:
        rgba(255, 61, 168, 0.28);
}


.stat-card.success {
    background:
        linear-gradient(
            145deg,
            rgba(86, 227, 159, 0.065),
            rgba(255, 61, 168, 0.025)
        ),
        #171319;

    border-color:
        rgba(86, 227, 159, 0.20);
}


.stat-card.archive {
    background:
        linear-gradient(
            145deg,
            rgba(106, 169, 255, 0.055),
            rgba(255, 61, 168, 0.025)
        ),
        #171319;

    border-color:
        rgba(106, 169, 255, 0.20);
}


.stat-card.attention {
    background:
        linear-gradient(
            145deg,
            rgba(255, 61, 168, 0.16),
            rgba(246, 199, 92, 0.055)
        ),
        #191318;

    border-color:
        rgba(255, 61, 168, 0.34);

    box-shadow:
        0 0 0 1px
            rgba(255, 61, 168, 0.035),
        0 12px 35px
            rgba(255, 61, 168, 0.08);
}


.stat-card.attention .stat-label {
    color: #f2b7d5;
}


.stat-card.attention .stat-value {
    color: #ff74bf;
}


.panel,
.system-card {
    background:
        linear-gradient(
            150deg,
            rgba(255, 61, 168, 0.035),
            transparent 18rem
        ),
        rgba(20, 16, 22, 0.92);

    border-color:
        rgba(255, 61, 168, 0.11);
}


.job-card {
    background:
        linear-gradient(
            145deg,
            rgba(255, 61, 168, 0.035),
            transparent
        ),
        #1d1820;
}


.job-card:hover {
    background:
        linear-gradient(
            145deg,
            rgba(255, 61, 168, 0.085),
            transparent
        ),
        #241d27;

    border-color:
        rgba(255, 61, 168, 0.33);
}


.connection-box,
.user-box {
    border-color:
        rgba(255, 61, 168, 0.14);

    background:
        linear-gradient(
            145deg,
            rgba(255, 61, 168, 0.055),
            rgba(255, 255, 255, 0.018)
        );
}


.user-box strong {
    color: #ffffff;
}


.user-box span {
    color: #ff74bf;
}


.section-heading h2,
.panel-header h3 {
    text-shadow:
        0 0 18px
        rgba(255, 61, 168, 0.05);
}


/* Rendering stability for older Chromium/Edge builds */

.topbar,
.top-actions,
.user-box,
.stats-grid,
.stat-card {
    transform: translateZ(0);
    backface-visibility: hidden;
}
