:root {
    --bg: #0d051c;
    --bg-soft: #140828;
    --surface: #181226;
    --surface-strong: #151024;
    --line: rgba(115, 100, 156, 0.24);
    --line-soft: rgba(115, 100, 156, 0.18);
    --text: #f6fbff;
    --muted: rgba(212, 217, 245, 0.78);
    --accent: #7b59e8;
    --accent-2: #a283ff;
    --success: #57ce91;
    --error: #ff6b91;
    --neutral: rgba(214, 205, 249, 0.82);
    --shadow: rgba(0, 0, 0, 0.3);
    --ring: rgba(123, 89, 232, 0.2);

    --radius-xl: 18px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;

    --font-sans: "Bahnschrift SemiCondensed", "Segoe UI Variable Display", "Aptos", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "Cascadia Mono", "Consolas", ui-monospace, SFMono-Regular, Menlo, Monaco, "Liberation Mono", monospace;

    /* Used by stats canvas in app.js */
    --chart-grid: rgba(239, 233, 255, 0.14);
    --chart-ticks: rgba(239, 233, 255, 0.74);
    --chart-up: rgba(53, 233, 167, 0.95);
    --chart-down: rgba(255, 108, 128, 0.95);
    --chart-flat: rgba(167, 139, 250, 0.95);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    background-color: #090316;
}

html {
    font-size: clamp(14px, 0.22vw + 13px, 17px);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-sans);
    background: #090316;
    overflow-x: hidden;
    letter-spacing: 0.1px;
    text-rendering: geometricPrecision;
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    background: none;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 999;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(167, 139, 250, 0.48);
    background: rgba(12, 8, 24, 0.95);
    color: var(--text);
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform 140ms ease;
}

.skip-link:focus {
    transform: translateY(0);
    outline: none;
}

.page {
    width: min(1460px, 97vw);
    margin: 0 auto;
    padding: 20px clamp(10px, 1.1vw, 16px) 34px;
    position: relative;
    z-index: 1;
}

/* Make room for the fixed appbar when signed in. */
body:not(.login-view) .page {
    padding-top: 98px;
}

.container {
    width: 100%;
    margin: 0;
    display: grid;
    gap: 14px;
}

.appbar {
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    border-radius: 0 0 20px 20px;
    border: 1px solid rgba(104, 86, 158, 0.26);
    background: rgba(17, 12, 31, 0.97);
    box-shadow: 0 6px 16px var(--shadow);
    backdrop-filter: blur(6px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
}

.appbar-inner {
    display: grid;
    grid-template-columns: auto max-content minmax(240px, 380px) auto auto;
    align-items: center;
    gap: 10px;
    width: min(1460px, 97vw);
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
}

.brand-text {
    display: grid;
    gap: 2px;
}

.brand-title {
    font-weight: 800;
    letter-spacing: 0.42px;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.brand-sub {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.32px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appbar-links {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    overflow-x: clip;
    overflow-y: visible;
}

.appbar-links > * {
    flex: 0 0 auto;
}

.nav-link {
    padding: 8px 13px;
    border-radius: 12px;
    border: 1px solid rgba(126, 104, 194, 0.2);
    background: rgba(22, 16, 38, 0.92);
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition:
        transform 120ms ease,
        filter 120ms ease,
        border-color 120ms ease,
        background 120ms ease;
    white-space: nowrap;
}

.nav-link:hover {
    transform: none;
    filter: brightness(1.03);
    border-color: rgba(186, 161, 255, 0.4);
    background: rgba(28, 21, 49, 0.94);
}

.nav-link.is-active {
    border-color: rgba(194, 171, 255, 0.5);
    background: rgba(35, 25, 58, 0.95);
    box-shadow: inset 0 0 0 1px rgba(243, 234, 255, 0.06);
}

.appbar-more {
    position: relative;
}

.appbar-more > summary {
    list-style: none;
    cursor: pointer;
}

.appbar-more > summary::-webkit-details-marker {
    display: none;
}

.nav-link-more {
    user-select: none;
    min-width: 70px;
    text-align: center;
}

.appbar-more-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 210px;
    max-width: min(360px, 70vw);
    border-radius: 14px;
    border: 1px solid rgba(138, 116, 255, 0.34);
    background: rgba(11, 7, 24, 0.97);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.64);
    padding: 10px;
    display: grid;
    gap: 8px;
    z-index: 7;
}

.appbar-search {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    min-width: 0;
}

.appbar-search-desktop {
    max-width: 380px;
}

.appbar-search input[type="search"] {
    width: 100%;
    background: rgba(16, 8, 34, 0.74);
    border-color: rgba(104, 86, 158, 0.4);
    padding-left: 14px;
}

.appbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.appbar-mobile {
    display: none;
    position: relative;
    margin-left: auto;
    justify-self: end;
}

.appbar-mobile > summary {
    list-style: none;
    cursor: pointer;
}

.appbar-mobile > summary::-webkit-details-marker {
    display: none;
}

.appbar-mobile-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 260px;
    max-height: min(70vh, 520px);
    overflow: auto;
    border-radius: 16px;
    border: 1px solid rgba(138, 116, 255, 0.34);
    background: rgba(11, 7, 24, 0.97);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.64);
    padding: 10px;
    display: grid;
    gap: 8px;
}

.appbar-search-mobile input[type="search"] {
    width: 100%;
}

.appbar-mobile-meta {
    border-top: 1px solid rgba(138, 116, 255, 0.24);
    padding-top: 10px;
    display: grid;
    gap: 10px;
}

.user-pill {
    border-radius: 14px;
    border: 1px solid rgba(104, 86, 158, 0.36);
    background: rgba(20, 11, 42, 0.78);
    padding: 10px 12px;
}

.user-name {
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.14;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(236, 226, 255, 0.17) 1px, transparent 0);
    background-size: 28px 28px;
}

.bg-glow {
    display: none;
}

.bg-glow-a {
    width: 380px;
    height: 380px;
    top: -170px;
    left: -100px;
    background: rgba(123, 89, 232, 0.26);
}

.bg-glow-b {
    width: 300px;
    height: 300px;
    bottom: -190px;
    right: -180px;
    background: rgba(162, 131, 255, 0.1);
}

@keyframes glowFloatA {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(18px, 10px, 0) scale(1.05); }
}

@keyframes glowFloatB {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(-14px, -12px, 0) scale(1.06); }
}

.bg-glow-a { animation: none; }
.bg-glow-b { animation: none; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 2px 6px;
}

.page-head > div:first-child {
    min-width: 0;
}

.page-head h1 {
    margin: 0;
    font-size: clamp(1.16rem, 1rem + 0.45vw, 1.48rem);
    letter-spacing: 0.38px;
    text-transform: uppercase;
    text-shadow: none;
}

.page-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.fade-in {
    animation: riseIn 320ms ease-out;
}

.topbar {
    width: min(620px, 96vw);
    margin: 12px auto 8px;
    padding: 15px 17px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(18, 12, 32, 0.96);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.34);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.topbar-login {
    max-width: 1040px;
    width: min(1040px, 96vw);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-left h1 {
    margin: 0;
    font-size: 1.12rem;
    letter-spacing: 0.25px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.chips-tight {
    gap: 8px;
    justify-content: flex-end;
}

.chip-static {
    cursor: default;
}

.filters2 .dialog-actions {
    margin-top: 2px;
}

.filters2 {
    display: grid;
    gap: 12px;
}

.filters2-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px;
}

.filters2-grid label {
    display: grid;
    gap: 6px;
    font-weight: 650;
    letter-spacing: 0.12px;
}

.filters2-grid input,
.filters2-grid select {
    width: 100%;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }

.filters2-advanced {
    border-radius: 14px;
    border: 1px solid rgba(138, 116, 255, 0.24);
    background: rgba(16, 10, 32, 0.68);
    padding: 10px 12px;
}

.filters2-summary {
    cursor: pointer;
    font-weight: 750;
    letter-spacing: 0.2px;
    color: var(--text);
}

.filters2-grid-advanced {
    margin-top: 10px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tab {
    text-decoration: none;
    color: var(--muted);
    font-weight: 650;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(138, 116, 255, 0.24);
    background: rgba(16, 10, 32, 0.64);
    transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
}

.tab:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    border-color: rgba(167, 139, 250, 0.56);
    background: rgba(22, 14, 42, 0.84);
}

.tab.is-active {
    color: var(--text);
    border-color: rgba(167, 139, 250, 0.72);
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.24), rgba(14, 8, 30, 0.76));
    box-shadow: inset 0 0 0 1px rgba(243, 234, 255, 0.09);
}

.chips-bar {
    gap: 8px;
    justify-content: flex-end;
}

.chip-x {
    padding-right: 10px;
}

.chip-xmark {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(167, 139, 250, 0.14);
    border: 1px solid rgba(167, 139, 250, 0.25);
    font-weight: 700;
    line-height: 1;
}

.chip-clear {
    background: rgba(12, 8, 26, 0.74);
    border-color: rgba(138, 116, 255, 0.26);
}

.table {
    width: 100%;
}

.table-compact th,
.table-compact td {
    font-size: 0.88rem;
    padding: 10px 12px;
}

.dialog {
    width: min(900px, 92vw);
    border: 1px solid rgba(138, 116, 255, 0.32);
    border-radius: 18px;
    padding: 0;
    background: rgba(10, 6, 24, 0.98);
    color: var(--text);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.64),
        inset 0 1px 0 rgba(239, 233, 255, 0.09);
}

.dialog::backdrop {
    background: rgba(5, 2, 13, 0.74);
    backdrop-filter: blur(6px);
}

.dialog-inner {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

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

.dialog-grid label {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 650;
    letter-spacing: 0.12px;
}

.dialog-grid .span-2 {
    grid-column: span 2;
}

.dialog-grid details {
    border-radius: 14px;
    border: 1px solid rgba(138, 116, 255, 0.24);
    background: rgba(16, 10, 32, 0.7);
    padding: 10px 12px;
}

.dialog-grid-advanced {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

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

    .dialog-grid .span-2 {
        grid-column: span 1;
    }

    .dialog-grid-advanced {
        grid-template-columns: 1fr;
    }

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

    .chips-bar {
        justify-content: flex-start;
    }
}

@media (max-width: 1220px) {
    .appbar-inner {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
    }

    .appbar-search {
        display: none;
    }
}

@media (max-width: 980px) {
    .appbar-inner {
        grid-template-columns: auto 1fr auto;
    }

    .appbar-links,
    .appbar-search,
    .appbar-right {
        display: none;
    }

    .appbar-mobile {
        display: block;
    }

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

    .span-6 { grid-column: span 6; }

    .pill-user {
        max-width: min(36vw, 300px);
    }
}

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

    .span-2, .span-3, .span-4, .span-6 { grid-column: span 2; }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar {
        width: min(620px, 98vw);
        padding: 13px 14px;
    }

    .topbar-left h1 {
        font-size: 1rem;
    }

    .pill-user {
        max-width: 52vw;
    }

    .login-layout {
        grid-template-columns: 1fr;
    }
}

.topbar-left p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #f4fcff;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-fallback {
    display: none;
    width: 100%;
    height: 100%;
    place-items: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card {
    background: rgba(16, 11, 29, 0.96);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 17px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.card::before {
    content: none;
}

.card-title {
    font-weight: 850;
    letter-spacing: 0.25px;
    font-size: 1.02rem;
}

.card-subtitle {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.35;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.tile {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--line-soft);
    border-radius: 15px;
    padding: 14px;
    position: relative;
    overflow: hidden;
    background: rgba(17, 12, 31, 0.94);
    box-shadow: none;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.tile::after {
    content: none;
}

.tile:hover {
    transform: none;
    border-color: rgba(167, 139, 250, 0.36);
    background: rgba(21, 14, 37, 0.96);
}

.tile:focus-visible {
    outline: 3px solid rgba(167, 139, 250, 0.35);
    outline-offset: 2px;
}

.tile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.tile-title {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.tile-desc {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.35;
}

.login-view .container {
    max-width: 1040px;
}

.login-card {
    margin: 0;
    padding: clamp(14px, 2vw, 22px);
}

.login-card-head {
    margin-bottom: 6px;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}

.login-main {
    width: min(680px, 100%);
    margin: 0 auto;
}

.login-oauth-actions {
    display: grid;
    gap: 10px;
    margin: 8px 0 4px;
}

.login-password-form {
    margin-top: 8px;
}

.login-or {
    margin: 6px 0 2px;
    text-align: center;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: var(--muted);
}

.legal-footer {
    width: min(680px, 100%);
    margin: 4px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.86rem;
}

.legal-footer a {
    color: rgba(218, 202, 255, 0.95);
    text-decoration: none;
    border-bottom: 1px solid rgba(138, 116, 255, 0.35);
}

.legal-footer a:hover {
    border-bottom-color: rgba(167, 139, 250, 0.8);
}

.legal-card {
    width: min(760px, 100%);
    margin: 0 auto;
}

.legal-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.install-intro {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
    align-items: center;
}

.install-icon-wrap {
    display: grid;
    place-items: center;
}

.install-icon-preview {
    width: 88px;
    height: 88px;
    border-radius: 20px;
    border: 1px solid rgba(167, 139, 250, 0.48);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
}

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

.install-card h2 {
    margin-bottom: 6px;
}

.install-card ol {
    margin: 8px 0 0;
    padding-left: 20px;
}

h2 {
    margin: 0;
    font-size: clamp(1.02rem, 0.92rem + 0.5vw, 1.18rem);
    letter-spacing: 0.25px;
}

h3 {
    margin: 12px 0 8px;
    font-size: 0.98rem;
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.grid-form,
.filters {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.grid-form label,
.filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
}

.filters {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.filters-panel {
    border-color: rgba(167, 139, 250, 0.4);
}

.filter-wide {
    grid-column: span 2;
}

input,
select,
textarea {
    width: 100%;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid rgba(115, 100, 156, 0.2);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input::placeholder,
textarea::placeholder {
    color: rgba(231, 220, 246, 0.46);
}

select:hover,
input:hover,
textarea:hover {
    border-color: rgba(138, 116, 255, 0.34);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: rgba(14, 10, 28, 0.95);
    box-shadow: 0 0 0 2px var(--ring);
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    grid-column: span 2;
}

.btn:focus-visible,
.nav-link:focus-visible,
.tab:focus-visible,
.chip:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(167, 139, 250, 0.35);
    outline-offset: 2px;
}

.btn {
    border: 1px solid rgba(187, 154, 255, 0.22);
    border-radius: 12px;
    background: #6f54c8;
    color: #f6fbff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.18px;
    padding: 9px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
    transform: none;
    filter: brightness(1.04);
    box-shadow: none;
}

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

.btn-ghost {
    background: rgba(12, 8, 26, 0.7);
    border-color: rgba(138, 116, 255, 0.32);
    color: rgba(239, 233, 255, 0.92);
    box-shadow: none;
}

.btn-ghost:hover {
    background: rgba(20, 12, 38, 0.86);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 7px 10px;
    font-size: 0.84rem;
}

.pill {
    border-radius: 999px;
    border: 1px solid rgba(138, 116, 255, 0.32);
    background: rgba(14, 8, 28, 0.74);
    color: rgba(239, 233, 255, 0.9);
    padding: 6px 10px;
    font-size: 0.84rem;
}

.pill-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(42vw, 460px);
    border-color: rgba(144, 122, 214, 0.4);
    background: linear-gradient(180deg, rgba(23, 13, 46, 0.74), rgba(13, 8, 28, 0.8));
}

.pill-user-name,
.pill-user-role {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pill-user-name {
    max-width: 170px;
}

.pill-user-role {
    max-width: 210px;
}

.pill-user-sep {
    color: var(--muted);
    flex: 0 0 auto;
}

.pill-soft {
    background: rgba(12, 8, 26, 0.54);
}

.pill-up {
    border-color: rgba(44, 229, 159, 0.55);
    color: rgba(44, 229, 159, 0.95);
}

.pill-down {
    border-color: rgba(255, 85, 113, 0.62);
    color: rgba(255, 85, 113, 0.95);
}

.pill-flat {
    border-color: rgba(138, 116, 255, 0.28);
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 7px;
    border: 1px solid rgba(138, 116, 255, 0.24);
    background: rgba(12, 8, 26, 0.68);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1;
}

.table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.stat-card {
    border: 1px solid rgba(138, 116, 255, 0.24);
    border-radius: 14px;
    padding: 12px;
    background: rgba(16, 11, 30, 0.96);
    box-shadow: none;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.83rem;
}

.stat-value {
    display: block;
    margin-top: 6px;
    font-size: 1.15rem;
    color: rgba(244, 239, 255, 0.95);
}

.table-wrap {
    overflow: auto;
    max-width: 100%;
    border-radius: 14px;
    border: 1px solid var(--line-soft);
    background: rgba(12, 8, 25, 0.55);
}

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

th,
td {
    text-align: left;
    vertical-align: top;
    padding: 11px 12px;
    font-size: 0.89rem;
    border-bottom: 1px solid rgba(138, 116, 255, 0.2);
}

thead th {
    position: sticky;
    top: 0;
    background: rgba(12, 8, 25, 0.94);
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.34px;
    font-size: 0.78rem;
}

tbody tr:hover {
    background: rgba(167, 139, 250, 0.06);
}

tbody tr:nth-child(even) {
    background: rgba(13, 8, 26, 0.45);
}

tbody tr:nth-child(even):hover {
    background: rgba(167, 139, 250, 0.1);
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    color: rgba(44, 229, 159, 0.95);
    border: 1px solid rgba(44, 229, 159, 0.42);
    background: rgba(44, 229, 159, 0.14);
}

.badge-error {
    color: rgba(255, 85, 113, 0.95);
    border: 1px solid rgba(255, 85, 113, 0.42);
    background: rgba(255, 85, 113, 0.14);
}

.badge-neutral {
    color: rgba(239, 233, 255, 0.92);
    border: 1px solid rgba(138, 116, 255, 0.36);
    background: rgba(138, 116, 255, 0.14);
}

.badge-warn {
    color: rgba(255, 204, 102, 0.98);
    border: 1px solid rgba(255, 204, 102, 0.42);
    background: rgba(255, 204, 102, 0.12);
}

.flash-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.flash {
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line-soft);
    backdrop-filter: none;
}

.flash-success {
    background: rgba(47, 203, 137, 0.15);
    border-color: rgba(47, 203, 137, 0.4);
}

.flash-error {
    background: rgba(239, 91, 109, 0.14);
    border-color: rgba(239, 91, 109, 0.4);
}

.pagination {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid var(--line-soft);
    background: rgba(12, 8, 26, 0.72);
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
}

.chip:hover {
    transform: none;
    filter: brightness(1.06);
    border-color: rgba(167, 139, 250, 0.45);
}

.mono {
    font-family: var(--font-mono);
    letter-spacing: 0;
}

.mono textarea,
textarea.mono,
pre.mono {
    font-family: var(--font-mono);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 16px;
    margin-top: 10px;
}

.detail-grid p {
    margin: 0.35rem 0;
}

.truncate-1 {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wrap-any {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.error-box {
    margin: 10px 0;
    border-radius: 10px;
    padding: 10px;
    border: 1px solid rgba(239, 91, 109, 0.45);
    background: rgba(239, 91, 109, 0.13);
}

pre {
    margin: 8px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--line-soft);
    background: rgba(12, 8, 26, 0.78);
    padding: 10px;
}

/* Center login page content without removing the login header. */
body.login-view .page {
    min-height: auto;
    display: flex;
    align-items: flex-start;
    padding-top: clamp(6px, 1.6vh, 18px);
}

body.login-view .container {
    margin: 0 auto;
}

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

/* Progressive enhancement: JS adds .js to <html> and toggles .is-inview on .reveal. */
.js .reveal {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(2px);
    transition:
        opacity 420ms ease,
        transform 420ms cubic-bezier(0.2, 0.9, 0.25, 1),
        filter 420ms ease;
    transition-delay: var(--reveal-delay, 0ms);
}

.js .reveal.is-inview {
    opacity: 1;
    transform: translateY(0);
    filter: none;
}

@keyframes rowFlash {
    0% {
        background: rgba(167, 139, 250, 0.16);
    }
    100% {
        background: transparent;
    }
}

tbody tr.row-new {
    animation: rowFlash 1200ms ease-out;
}

.chart {
    width: 100%;
    height: 280px;
    border-radius: 14px;
    border: 1px solid rgba(138, 116, 255, 0.24);
    background: rgba(14, 9, 27, 0.8);
}

@media (max-width: 620px) {
    .chart {
        height: 220px;
    }
}

@media (max-width: 620px) {
    .install-intro {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 900px) {
    .filter-wide,
    .filter-actions {
        grid-column: span 1;
    }
}

@media (max-width: 780px) {
    .table-wrap {
        border-radius: 14px;
        border-color: rgba(138, 116, 255, 0.22);
    }

    /* Turn tables into stacked cards on small screens (no sideways scroll). */
    table.rtable {
        min-width: 0;
    }

    table.rtable thead {
        display: none;
    }

    table.rtable tbody {
        display: block;
    }

    table.rtable tr {
        display: block;
        margin: 0 0 12px;
        border-radius: 14px;
        border: 1px solid rgba(138, 116, 255, 0.24);
        background: rgba(12, 8, 26, 0.62);
        overflow: hidden;
    }

    table.rtable td {
        display: grid;
        grid-template-columns: 1fr 1.35fr;
        align-items: start;
        gap: 10px;
        padding: 10px 12px;
        border-bottom: 1px solid rgba(138, 116, 255, 0.15);
        font-size: 0.92rem;
    }

    table.rtable td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 750;
        letter-spacing: 0.2px;
    }

    table.rtable td[data-label=""] {
        grid-template-columns: 1fr;
    }

    table.rtable td[data-label=""]::before {
        content: "";
    }

    table.rtable td[data-label=""] > * {
        justify-self: end;
    }

    table.rtable td[colspan] {
        display: block;
    }

    table.rtable td[colspan]::before {
        content: "";
    }

    table.rtable td:last-child {
        border-bottom: none;
    }

    table.rtable tr:last-child {
        margin-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
        scroll-behavior: auto !important;
    }
}

.live-insert {
    animation: liveInsert 500ms ease-out;
}

@keyframes liveInsert {
    from {
        background: rgba(53, 233, 167, 0.2);
        transform: translateY(-4px);
    }

    to {
        background: transparent;
        transform: translateY(0);
    }
}


