:root {
    --bg: #090d1f;
    --bg-soft: #111735;
    --panel: rgba(255, 255, 255, 0.08);
    --panel-strong: rgba(255, 255, 255, 0.12);
    --line: rgba(255, 255, 255, 0.12);
    --text: #f7f8ff;
    --muted: #aab3d6;
    --purple: #7c3cff;
    --purple-dark: #4b20bd;
    --blue: #1fb6ff;
    --cyan: #67e8f9;
    --green: #37d399;
    --amber: #fbbf24;
    --red: #fb7185;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 10%, rgba(124, 60, 255, 0.34), transparent 28rem),
        radial-gradient(circle at 85% 18%, rgba(31, 182, 255, 0.24), transparent 30rem),
        linear-gradient(135deg, #070a18 0%, #111840 52%, #091123 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

code {
    color: #dbe8ff;
}

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

.login-shell::before {
    position: fixed;
    inset: 10% auto auto 50%;
    width: 520px;
    height: 520px;
    content: "";
    transform: translateX(-50%);
    background: conic-gradient(from 160deg, rgba(124, 60, 255, 0.5), rgba(31, 182, 255, 0.5), transparent, rgba(124, 60, 255, 0.5));
    filter: blur(50px);
    opacity: 0.7;
    animation: pulseGlow 7s ease-in-out infinite;
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(100%, 440px);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(13, 18, 43, 0.82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    animation: riseIn 0.55s ease both;
}

.login-card h1,
.hero-panel h1,
.panel h2 {
    margin: 0;
    letter-spacing: 0;
}

.login-card h1 {
    margin-top: 18px;
    font-size: 2rem;
}

.login-subtitle {
    margin: 10px 0 24px;
    color: var(--muted);
    line-height: 1.5;
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: white;
    font-weight: 900;
    box-shadow: 0 14px 34px rgba(31, 182, 255, 0.22);
}

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

label {
    display: grid;
    gap: 8px;
    color: #d7dcf4;
    font-size: 0.92rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    outline: none;
    background: rgba(7, 11, 29, 0.76);
    color: var(--text);
    padding: 11px 13px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(31, 182, 255, 0.72);
    box-shadow: 0 0 0 3px rgba(31, 182, 255, 0.14);
    background: rgba(9, 14, 37, 0.96);
}

.primary-button,
.filters button,
.copy-line button,
.inline-form button,
.logout-form button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    color: white;
    font-weight: 800;
    background: linear-gradient(135deg, var(--purple), var(--blue));
    box-shadow: 0 14px 30px rgba(31, 182, 255, 0.16);
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.primary-button:hover,
.filters button:hover,
.copy-line button:hover,
.inline-form button:hover,
.logout-form button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow: 0 18px 34px rgba(124, 60, 255, 0.22);
}

.big-action {
    min-width: 170px;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    border-right: 1px solid var(--line);
    background: rgba(5, 8, 22, 0.72);
    backdrop-filter: blur(18px);
}

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

.brand strong,
.brand span {
    display: block;
}

.brand span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.85rem;
}

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

.side-nav a,
.logout-form button {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #e9ecff;
    text-align: left;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
    padding: 12px 14px;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.side-nav a:hover {
    border-color: rgba(31, 182, 255, 0.26);
    background: rgba(31, 182, 255, 0.12);
    transform: translateX(2px);
}

.logout-form {
    position: absolute;
    right: 24px;
    bottom: 24px;
    left: 24px;
}

.logout-form button {
    text-align: center;
    background: rgba(255, 255, 255, 0.07);
    box-shadow: none;
}

.main-content {
    width: 100%;
    max-width: 1480px;
    min-width: 0;
    overflow-x: hidden;
    padding: 28px;
}

.hero-panel,
.panel,
.stat-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(18px);
}

.hero-panel {
    position: relative;
    display: flex;
    min-height: 230px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    overflow: hidden;
    padding: 34px;
}

.hero-panel::after {
    position: absolute;
    right: -130px;
    bottom: -160px;
    width: 430px;
    height: 430px;
    content: "";
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(103, 232, 249, 0.2), transparent 62%);
    animation: orbitGlow 9s ease-in-out infinite;
}

.hero-panel > * {
    position: relative;
    z-index: 1;
}

.eyebrow {
    margin: 0 0 9px;
    color: var(--cyan);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-panel h1 {
    max-width: 820px;
    font-size: clamp(2rem, 4vw, 4.35rem);
    line-height: 1;
    overflow-wrap: anywhere;
}

.hero-panel p:not(.eyebrow) {
    max-width: 720px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.55;
}

.flash {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 15px;
    color: #fff;
}

.flash-success {
    border-color: rgba(55, 211, 153, 0.3);
    background: rgba(55, 211, 153, 0.12);
}

.flash-error {
    border-color: rgba(251, 113, 133, 0.34);
    background: rgba(251, 113, 133, 0.14);
}

.flash-warning {
    border-color: rgba(251, 191, 36, 0.34);
    background: rgba(251, 191, 36, 0.13);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
}

.stat-card::before {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(135deg, rgba(124, 60, 255, 0.18), rgba(31, 182, 255, 0.08));
    opacity: 0;
    transition: opacity 0.18s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card span,
.stat-card strong,
.stat-card small {
    position: relative;
    z-index: 1;
    display: block;
}

.stat-card span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.stat-card strong {
    margin: 8px 0 5px;
    font-size: clamp(1.5rem, 2.2vw, 2.4rem);
}

.stat-card small {
    color: #bfc7e7;
}

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

.stat-card.warning strong {
    color: var(--amber);
}

.stat-card.danger strong {
    color: var(--red);
}

.stat-card.muted strong {
    color: #cad2ef;
}

.panel {
    margin-top: 18px;
    padding: 24px;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 24px;
}

.panel h2 {
    margin-bottom: 18px;
    font-size: 1.4rem;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.segmented-control label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #e8ecff;
    text-align: center;
}

.segmented-control input {
    width: auto;
    min-height: 0;
    margin-right: 8px;
    accent-color: var(--blue);
}

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

.cron-box {
    align-self: start;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
}

.muted-text {
    color: var(--muted);
}

.copy-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 16px 0;
}

.code-block {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    padding: 12px;
    white-space: nowrap;
}

.panel-heading {
    display: grid;
    grid-template-columns: minmax(220px, auto) 1fr;
    gap: 18px;
    align-items: end;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, 0.5fr)) auto;
    min-width: 0;
    gap: 10px;
}

.table-wrap {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    margin-top: 18px;
}

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

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

th {
    color: #dce2ff;
    font-size: 0.78rem;
    text-transform: uppercase;
}

tbody tr {
    transition: background 0.16s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.045);
}

.row-note,
.group-pill {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.78rem;
}

.group-pill {
    display: inline-block;
    border: 1px solid rgba(103, 232, 249, 0.22);
    border-radius: 999px;
    padding: 2px 8px;
    color: #c7f7ff;
    background: rgba(103, 232, 249, 0.08);
}

.badge,
.port-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin: 2px 4px 2px 0;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.badge-good {
    color: #d8fff1;
    background: rgba(55, 211, 153, 0.18);
}

.badge-muted,
.badge-neutral {
    color: #d9def5;
    background: rgba(255, 255, 255, 0.1);
}

.badge-danger {
    color: #ffe1e7;
    background: rgba(251, 113, 133, 0.22);
}

.port-pill {
    color: #dbf8ff;
    background: rgba(31, 182, 255, 0.14);
}

.actions-cell {
    min-width: 190px;
}

.inline-form {
    display: inline-block;
    margin: 2px;
}

.inline-form button {
    min-height: 34px;
    padding: 0 11px;
    font-size: 0.8rem;
}

.danger-form button {
    background: rgba(251, 113, 133, 0.16);
    box-shadow: none;
}

.empty-state {
    height: 120px;
    color: var(--muted);
    text-align: center;
}

.loading-overlay {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    background: rgba(4, 7, 18, 0.78);
    backdrop-filter: blur(8px);
}

.loading-overlay[hidden] {
    display: none;
}

.loader {
    width: 58px;
    height: 58px;
    border: 4px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--blue);
    border-right-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%,
    100% {
        transform: translateX(-50%) scale(0.96);
    }
    50% {
        transform: translateX(-50%) scale(1.06);
    }
}

@keyframes orbitGlow {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(-30px, -20px, 0) scale(1.08);
    }
}

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

    .sidebar {
        position: static;
        display: flex;
        height: auto;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
    }

    .side-nav {
        display: flex;
        flex-wrap: wrap;
        margin-top: 0;
    }

    .logout-form {
        position: static;
        width: auto;
    }

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

    .two-column,
    .panel-heading {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 760px) {
    .main-content,
    .sidebar {
        padding: 16px;
    }

    .hero-panel {
        display: grid;
        padding: 24px;
    }

    .hero-panel h1 {
        font-size: 2.1rem;
    }

    .stats-grid,
    .form-grid,
    .filters,
    .segmented-control,
    .copy-line {
        grid-template-columns: 1fr;
    }

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

    .side-nav {
        display: grid;
    }
}
