:root {
    --page-bg: #eef2ff;
    --page-bg-strong: #dbeafe;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --surface-line: rgba(129, 140, 248, 0.16);
    --text-main: #2d3278;
    --text-soft: #6773b8;
    --text-faint: #8b96cc;
    --sidebar-grad: linear-gradient(180deg, #7b3ff3 0%, #4b6df7 38%, #ff4eb8 100%);
    --shadow-soft: 0 20px 45px rgba(84, 102, 190, 0.16);
    --shadow-pop: 0 24px 50px rgba(110, 73, 196, 0.2);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --stat-blue: linear-gradient(135deg, #4ca7ff, #4c79ff);
    --stat-green: linear-gradient(135deg, #14cbb2, #77db7d);
    --stat-orange: linear-gradient(135deg, #ff7b65, #ffb14b);
    --stat-violet: linear-gradient(135deg, #6d4cff, #be5df6);
}

* {
    box-sizing: border-box;
}

html {
    background: #e8edff;
}

body {
    margin: 0;
    color: var(--text-main);
    font-family: "Instrument Sans", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(123, 63, 243, 0.26), transparent 24%),
        radial-gradient(circle at bottom right, rgba(76, 167, 255, 0.32), transparent 28%),
        linear-gradient(180deg, #f6f5ff 0%, #e8edff 52%, #dceafe 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    pointer-events: none;
    z-index: 0;
}

body::before {
    left: -12rem;
    bottom: -10rem;
    width: 36rem;
    height: 36rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 92, 174, 0.28), transparent 62%);
}

body::after {
    right: -10rem;
    bottom: -12rem;
    width: 34rem;
    height: 34rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(70, 153, 255, 0.22), transparent 62%);
}

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

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

th,
td {
    border-color: rgba(144, 156, 216, 0.24);
}

input,
select,
textarea {
    color: var(--text-main);
    background: rgba(246, 248, 255, 0.9);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
}

.app-frame,
.page-shell,
.plain-shell > * {
    position: relative;
    z-index: 1;
}

.app-frame {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    display: flex;
    width: 320px;
    flex-direction: column;
    padding: 2rem 1.5rem;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 36%),
        radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.18), transparent 36%),
        var(--sidebar-grad);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.16);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.95rem;
}

.app-brand-mark {
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    place-items: center;
    border-radius: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.app-brand-title {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
}

.app-brand-subtitle,
.sidebar-user-email {
    color: rgba(255, 255, 255, 0.75);
}

.sidebar-user-card {
    margin-top: 2rem;
    padding: 1.15rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px);
}

.sidebar-user-role {
    font-size: 1.05rem;
    font-weight: 700;
}

.sidebar-nav {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-section-label {
    margin-top: 1rem;
    padding: 1rem 0.85rem 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-link,
.sidebar-signout {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    border: 1px solid transparent;
    border-radius: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.94);
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.sidebar-link:hover,
.sidebar-signout:hover,
.sidebar-link.is-active {
    transform: translateX(3px);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.sidebar-link-dot {
    width: 0.62rem;
    height: 0.62rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.sidebar-signout {
    width: 100%;
    justify-content: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.app-main {
    flex: 1;
    padding: 2rem;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
    padding: 0 0.3rem;
}

.eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #7a84c4;
}

.topbar-title {
    margin-top: 0.4rem;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-main);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.topbar-pill {
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #5f5be8;
    background: rgba(122, 131, 255, 0.13);
}

.topbar-avatar {
    display: grid;
    width: 3rem;
    height: 3rem;
    place-items: center;
    border-radius: 999px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #8696ff, #7d52f4);
    box-shadow: var(--shadow-soft);
}

.page-shell {
    padding: 1.65rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 2rem;
    background: rgba(245, 247, 255, 0.58);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.flash-banner {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid;
    font-weight: 600;
}

.flash-banner-success {
    color: #0c7b5f;
    border-color: rgba(16, 185, 129, 0.22);
    background: rgba(236, 253, 245, 0.92);
}

.flash-banner-error {
    color: #c24173;
    border-color: rgba(244, 114, 182, 0.22);
    background: rgba(255, 241, 247, 0.95);
}

.ui-panel {
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
}

.ui-panel-muted {
    background: rgba(255, 255, 255, 0.76);
}

.ui-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.ui-panel-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
}

.ui-panel-subtitle {
    margin-top: 0.4rem;
    color: var(--text-soft);
}

.ui-card {
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.ui-soft-card {
    border: 1px solid rgba(150, 166, 230, 0.16);
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.7);
}

.ui-stat {
    position: relative;
    overflow: hidden;
    border-radius: 1.15rem;
    padding: 1.25rem 1.35rem;
    color: #fff;
    box-shadow: var(--shadow-pop);
}

.ui-stat::after {
    content: "";
    position: absolute;
    inset: auto -2rem -2rem auto;
    width: 8rem;
    height: 8rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 60%);
    transform: rotate(28deg);
}

.ui-stat-blue { background: var(--stat-blue); }
.ui-stat-green { background: var(--stat-green); }
.ui-stat-orange { background: var(--stat-orange); }
.ui-stat-violet { background: var(--stat-violet); }

.ui-stat-label {
    font-size: 0.98rem;
    font-weight: 600;
    opacity: 0.92;
}

.ui-stat-value {
    margin-top: 0.55rem;
    font-size: 2.3rem;
    font-weight: 800;
    line-height: 1;
}

.ui-stat-foot {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    opacity: 0.88;
}

.ui-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 6.2rem;
    padding: 0.45rem 0.75rem;
    border-radius: 0.8rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
}

.ui-badge-active,
.ui-badge-running {
    background: linear-gradient(135deg, #21c889, #5ed36d);
}

.ui-badge-pending,
.ui-badge-stopped {
    background: linear-gradient(135deg, #ffb347, #ff8a5c);
}

.ui-badge-suspended,
.ui-badge-inactive,
.ui-badge-terminated {
    background: linear-gradient(135deg, #ff5a8b, #ff8c57);
}

.ui-btn-primary,
.ui-btn-secondary,
button,
[type="submit"],
[type="button"] {
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.ui-btn-primary,
a.rounded-xl.bg-cyan-400,
button.rounded-xl.bg-cyan-400,
button.w-full.rounded-xl.bg-cyan-400 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.2rem;
    border: 0;
    border-radius: 1rem;
    font-weight: 700;
    color: #fff !important;
    background: linear-gradient(135deg, #5b6cff, #7c46f4);
    box-shadow: 0 16px 28px rgba(99, 102, 241, 0.26);
}

.ui-btn-secondary,
button.rounded-xl.border,
a.rounded-xl.border,
button.rounded-lg.border {
    border: 1px solid rgba(133, 147, 214, 0.28) !important;
    border-radius: 1rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.68) !important;
    box-shadow: 0 8px 20px rgba(132, 145, 208, 0.12);
}

.ui-btn-primary:hover,
.ui-btn-secondary:hover,
button:hover,
a.rounded-xl.border:hover,
button.rounded-xl.border:hover,
button.rounded-lg.border:hover {
    transform: translateY(-1px);
    filter: saturate(1.02);
}

input.rounded-xl,
select.rounded-xl,
textarea.rounded-xl {
    border: 1px solid rgba(134, 148, 215, 0.24) !important;
    border-radius: 1rem;
    background: rgba(248, 250, 255, 0.96) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input.rounded-xl:focus,
select.rounded-xl:focus,
textarea.rounded-xl:focus {
    outline: 0;
    border-color: rgba(101, 114, 234, 0.5) !important;
    box-shadow: 0 0 0 4px rgba(109, 92, 245, 0.12);
}

input.rounded-xl:disabled,
select.rounded-xl:disabled,
textarea.rounded-xl:disabled {
    color: var(--text-soft);
    background: rgba(239, 242, 255, 0.95) !important;
    border-color: rgba(155, 167, 226, 0.26) !important;
    -webkit-text-fill-color: var(--text-soft);
    opacity: 1;
    cursor: not-allowed;
}

label {
    color: var(--text-soft);
}

thead {
    color: #6877b8 !important;
}

thead tr {
    background: rgba(95, 111, 212, 0.08);
}

tbody tr {
    transition: background 140ms ease;
}

tbody tr:hover {
    background: rgba(123, 143, 235, 0.06);
}

tbody.divide-y > tr:not(:last-child),
tbody tr {
    border-bottom: 1px solid rgba(143, 156, 220, 0.18);
}

.manage-link,
a.text-cyan-300 {
    font-weight: 700;
    color: #6f56f1 !important;
}

.chart-donut {
    width: 12rem;
    height: 12rem;
    border-radius: 999px;
    background: conic-gradient(#16c5dd 0 25%, #46d17d 25% 46%, #a63ee8 46% 71%, #ff9e4f 71% 100%);
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), var(--shadow-soft);
}

.chart-donut::after {
    content: attr(data-value);
    position: absolute;
    inset: 2.3rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    font-size: 2.35rem;
    font-weight: 800;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 0 0 1px rgba(144, 156, 220, 0.14);
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    height: 9rem;
    padding-top: 1rem;
}

.chart-bar {
    flex: 1;
    border-radius: 1rem 1rem 0 0;
    background: linear-gradient(180deg, #b759ff, #6c4dff);
    box-shadow: 0 10px 18px rgba(137, 90, 255, 0.18);
}

.chart-bar:nth-child(2) {
    background: linear-gradient(180deg, #9d7fff, #7e68ff);
}

.chart-bar:nth-child(3) {
    background: linear-gradient(180deg, #59bfff, #4285ff);
}

.chart-line {
    position: relative;
    height: 16rem;
    border-radius: 1.35rem;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0.18)),
        linear-gradient(0deg, rgba(107, 114, 255, 0.08), rgba(107, 114, 255, 0.08)),
        repeating-linear-gradient(to top, transparent 0 3.7rem, rgba(129, 142, 216, 0.18) 3.7rem 3.78rem);
}

.chart-line svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.plain-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(123, 63, 243, 0.28), transparent 28%),
        radial-gradient(circle at bottom right, rgba(76, 167, 255, 0.24), transparent 24%),
        linear-gradient(180deg, #f6f5ff 0%, #ebefff 100%);
}

.auth-card {
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(18px);
}

.auth-hero {
    color: #fff;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.12), transparent 28%),
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.28), transparent 34%),
        linear-gradient(150deg, #7a3ef2 0%, #4d72ff 54%, #ff5aac 100%);
}

.auth-form {
    background: rgba(255, 255, 255, 0.34);
}

@media (max-width: 1024px) {
    .app-frame {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .app-main {
        padding: 1rem;
    }

    .page-shell {
        padding: 1rem;
        border-radius: 1.5rem;
    }

    .app-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
