:root {
    --bg: #090c12;
    --bg-elevated: #0d1119;
    --panel: #111720;
    --panel-soft: #171e29;
    --panel-hover: #1b2431;
    --text: #e6eaf0;
    --text-strong: #f7f8fa;
    --muted: #8f9baa;
    --muted-strong: #b3bdca;
    --accent: #6f9ed8;
    --accent-hover: #82abe0;
    --accent-soft: rgba(111, 158, 216, 0.12);
    --good: #62b98b;
    --warn: #d0a45c;
    --bad: #d36f72;
    --border: #252e3b;
    --border-strong: #354153;
    --shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
    --radius: 10px;
    --radius-small: 7px;
    --font-sans: "Segoe UI Variable", Aptos, "Segoe UI", sans-serif;
    --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* {
    scrollbar-color: #3b4657 #111720;
    scrollbar-width: thin;
}

html {
    min-height: 100%;
    color-scheme: dark;
}

@view-transition {
    navigation: auto;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    background:
        linear-gradient(180deg, rgba(7, 10, 15, 0.72), rgba(8, 12, 18, 0.88)),
        radial-gradient(circle at 50% 12%, rgba(34, 54, 76, 0.1), transparent 42rem),
        url("panel-background.webp") center center / cover fixed no-repeat,
        #090c12;
    -webkit-font-smoothing: antialiased;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, black, transparent 78%);
}

::selection {
    color: #fff;
    background: rgba(111, 158, 216, 0.42);
}

a {
    color: #8db5e5;
    text-underline-offset: 3px;
}

a:hover {
    color: #b0cdf0;
}

.shell {
    width: min(100% - 40px, 1480px);
    max-width: none;
    margin: 0 auto;
    padding: 28px 0 48px;
}

.page-database-manager .shell {
    width: min(100% - 40px, 1680px);
}

.topbar {
    min-height: 66px;
    margin: 0 0 22px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--border);
    animation: panel-enter 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.topbar > div:first-child {
    position: relative;
    min-height: 48px;
    padding-left: 62px;
}

.topbar > div:first-child::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 46px;
    height: 46px;
    border: 1px solid #465264;
    border-radius: 50%;
    background: #05060a url("favicon.png") center / cover no-repeat;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
    content: "";
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 4px !important;
    color: var(--text-strong);
    font-size: clamp(22px, 2vw, 28px);
    font-weight: 650;
    letter-spacing: -0.025em;
}

h2 {
    margin-bottom: 18px;
    color: var(--muted-strong);
    font-size: 12px !important;
    font-weight: 700;
    letter-spacing: 0.105em;
    text-transform: uppercase;
}

h3 {
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 650;
}

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

.tiny {
    font-size: 12px;
}

code,
.mono,
.path {
    font-family: var(--font-mono);
}

.card,
.login-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    background: linear-gradient(180deg, rgba(19, 26, 36, 0.94), rgba(15, 21, 30, 0.95));
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px) saturate(110%);
}

.card {
    padding: 20px;
    animation: card-enter 480ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.login-wrap {
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    position: relative;
    width: min(410px, 100%);
    padding: 34px;
    overflow: hidden;
    animation: login-enter 560ms cubic-bezier(0.16, 0.8, 0.24, 1) both;
}

.login-card::before {
    width: 48px;
    height: 48px;
    margin-bottom: 22px;
    display: block;
    border: 1px solid #465264;
    border-radius: 50%;
    background: #05060a url("favicon.png") center / cover no-repeat;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.36);
    content: "";
}

.login-card h1 {
    font-size: 24px;
}

.login-card > p {
    margin-bottom: 24px;
}

label {
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

input,
select,
textarea {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-small);
    outline: none;
    color: var(--text);
    background: #0c1118;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.24);
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input,
select {
    min-height: 38px;
    padding: 8px 11px;
}

textarea {
    padding: 12px;
    font-family: var(--font-mono);
}

input:hover,
select:hover,
textarea:hover {
    border-color: #465368;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: #0e141d;
    box-shadow: 0 0 0 3px rgba(111, 158, 216, 0.12);
}

.login-card input {
    margin: 6px 0 16px;
}

.page-dashboard .shell input,
.page-dashboard .shell textarea {
    margin: 6px 0 14px;
}

.page-dashboard #serverCommandInput {
    min-height: 44px;
}

button,
.button-link {
    position: relative;
    overflow: hidden;
    min-height: 36px;
    padding: 8px 13px;
    border: 1px solid #779dcc;
    border-radius: var(--radius-small);
    color: #09111b;
    background: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 130ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

button:hover,
.button-link:hover {
    color: #07101a;
    background: var(--accent-hover);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
    text-decoration: none;
}

button:active,
.button-link:active {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transform: translateY(1px) scale(0.975);
}

button.secondary,
.button-link.secondary {
    border-color: var(--border-strong);
    color: #d6dce5;
    background: #1b2431;
}

button.secondary:hover,
.button-link.secondary:hover {
    border-color: #4b596d;
    color: #fff;
    background: #232e3d;
}

button.warn {
    border-color: #b18a4d;
    color: #171106;
    background: var(--warn);
}

button.warn:hover {
    background: #ddb46f;
}

button.danger {
    border-color: #a95458;
    color: #fff;
    background: #9f4f53;
}

button.danger:hover {
    background: #b65d61;
}

button:disabled,
.button-link:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
}

body.modal-open {
    overflow: hidden;
}

.feedback-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.feedback-modal.is-open {
    visibility: visible;
    opacity: 1;
}

.feedback-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(3, 7, 12, 0.74);
    backdrop-filter: blur(7px);
    cursor: default;
}

.feedback-backdrop:hover,
.feedback-backdrop:active {
    background: rgba(3, 7, 12, 0.74);
    box-shadow: none;
    transform: none;
}

.feedback-dialog {
    position: relative;
    z-index: 1;
    width: min(410px, 100%);
    padding: 34px 32px 28px;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    text-align: center;
    background: linear-gradient(155deg, rgba(24, 31, 42, 0.98), rgba(12, 17, 24, 0.98));
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    transform: translateY(15px) scale(0.96);
    transition: transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.feedback-modal.is-open .feedback-dialog {
    transform: translateY(0) scale(1);
}

.feedback-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border-color: transparent;
    color: var(--muted);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
    background: transparent;
    box-shadow: none;
}

.feedback-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

.feedback-icon {
    position: relative;
    display: grid;
    width: 78px;
    height: 78px;
    margin: 0 auto 20px;
    place-items: center;
    border: 2px solid #697586;
    border-radius: 50%;
    color: #aeb8c5;
    background: rgba(255, 255, 255, 0.025);
    transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.feedback-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(174, 184, 197, 0.22);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: feedback-spin 800ms linear infinite;
}

.feedback-check {
    display: none;
    width: 48px;
    height: 48px;
    fill: none;
    stroke: currentColor;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feedback-check path {
    stroke-dasharray: 52;
    stroke-dashoffset: 52;
}

.feedback-x {
    display: none;
    width: 38px;
    height: 38px;
}

.feedback-x::before,
.feedback-x::after {
    position: absolute;
    top: 36px;
    left: 20px;
    width: 38px;
    height: 5px;
    border-radius: 4px;
    background: currentColor;
    content: "";
}

.feedback-x::before {
    transform: rotate(45deg) scaleX(0);
}

.feedback-x::after {
    transform: rotate(-45deg) scaleX(0);
}

.feedback-icon.is-success {
    border-color: #67c795;
    color: #78d7a5;
    background: rgba(80, 174, 122, 0.11);
    animation: feedback-pulse-success 420ms ease both;
}

.feedback-icon.is-success .feedback-spinner,
.feedback-icon.is-error .feedback-spinner {
    display: none;
}

.feedback-icon.is-success .feedback-check {
    display: block;
}

.feedback-icon.is-success .feedback-check path {
    animation: feedback-draw-check 420ms 90ms ease forwards;
}

.feedback-icon.is-error {
    border-color: #db7478;
    color: #e48185;
    background: rgba(190, 73, 78, 0.11);
    animation: feedback-shake 380ms ease both;
}

.feedback-icon.is-error .feedback-x {
    display: block;
}

.feedback-icon.is-error .feedback-x::before {
    animation: feedback-draw-x 260ms 90ms ease forwards;
}

.feedback-icon.is-error .feedback-x::after {
    animation: feedback-draw-x-reverse 260ms 90ms ease forwards;
}

.feedback-eyebrow {
    margin: 0 0 8px;
    color: #93a0b1;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.feedback-dialog h2 {
    margin-bottom: 9px;
    font-size: 23px;
}

.feedback-dialog .muted {
    min-height: 38px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.feedback-done {
    min-width: 108px;
}

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

@keyframes feedback-draw-check {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes feedback-draw-x {
    to {
        transform: rotate(45deg) scaleX(1);
    }
}

@keyframes feedback-draw-x-reverse {
    to {
        transform: rotate(-45deg) scaleX(1);
    }
}

@keyframes feedback-pulse-success {
    50% {
        transform: scale(1.09);
    }
}

@keyframes feedback-shake {
    25% {
        transform: translateX(-5px);
    }
    50% {
        transform: translateX(5px);
    }
    75% {
        transform: translateX(-3px);
    }
}

.actions,
.row {
    gap: 8px;
}

.banner,
.notice,
#notice {
    padding: 11px 14px;
    border-radius: var(--radius-small);
    font-size: 13px;
}

.banner {
    border-color: rgba(208, 164, 92, 0.34);
    color: #d9c49f;
    background: rgba(137, 101, 45, 0.13);
}

.error,
.notice.error,
#notice.error {
    border-color: rgba(211, 111, 114, 0.34);
    color: #efb7b9;
    background: rgba(159, 79, 83, 0.14);
}

.notice.ok,
#notice.ok {
    border-color: rgba(98, 185, 139, 0.32);
    color: #b7ddca;
    background: rgba(65, 126, 93, 0.14);
}

.grid {
    gap: 14px;
}

.page-dashboard .grid > .card:nth-child(1),
.page-file-manager .grid > .card:nth-child(1),
.page-database-manager .grid > :nth-child(1) {
    animation-delay: 70ms;
}

.page-dashboard .grid > .card:nth-child(2),
.page-file-manager .grid > .card:nth-child(2),
.page-database-manager .grid > :nth-child(2) {
    animation-delay: 110ms;
}

.page-dashboard .grid > .card:nth-child(3) {
    animation-delay: 150ms;
}

.page-dashboard .grid > .card:nth-child(4) {
    animation-delay: 190ms;
}

.page-dashboard .grid > .card:nth-child(5) {
    animation-delay: 230ms;
}

.page-dashboard .grid > .card:nth-child(n + 6) {
    animation-delay: 270ms;
}

.pill,
.status-chip,
.type-pill {
    border-radius: 5px;
}

.pill {
    padding: 6px 9px;
    border: 1px solid var(--border);
    color: var(--muted-strong);
    background: #171e29;
    font-size: 12px;
    font-weight: 600;
}

.dot {
    width: 7px;
    height: 7px;
    box-shadow: 0 0 0 3px rgba(143, 155, 170, 0.08);
}

.dot.good {
    background: var(--good);
}

.dot.warn {
    background: var(--warn);
}

.dot.bad {
    background: var(--bad);
}

.status-chip {
    min-width: 54px;
    padding: 4px 8px;
    font-size: 11px;
}

.status-chip.good {
    border-color: rgba(98, 185, 139, 0.3);
    color: #b9dfcb;
    background: rgba(98, 185, 139, 0.11);
}

.status-chip.warn {
    border-color: rgba(208, 164, 92, 0.3);
    color: #e2cda8;
    background: rgba(208, 164, 92, 0.11);
}

.status-chip.bad {
    border-color: rgba(211, 111, 114, 0.3);
    color: #efb7b9;
    background: rgba(211, 111, 114, 0.11);
}

.kv {
    grid-template-columns: minmax(120px, 42%) minmax(0, 1fr);
    gap: 7px 14px;
    font-size: 13px;
}

.kv div:nth-child(odd) {
    color: var(--muted);
}

.kv div:nth-child(even) {
    color: #d6dce5;
    font-variant-numeric: tabular-nums;
}

.big-metric {
    margin: 3px 0 8px;
    color: var(--text-strong);
    font-size: 28px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.035em;
}

.bandwidth-card .big-metric {
    margin-bottom: 16px;
    font-size: 23px;
    line-height: 1.25;
}

.meter {
    height: 6px;
    margin: 13px 0 15px;
    border-radius: 3px;
    background: #202936;
}

.meter > span {
    border-radius: 3px;
    background: linear-gradient(90deg, #527eae, #71a7c6);
}

.search-hit {
    border-radius: var(--radius-small);
    background: #0d131b;
}

.search-hit code {
    color: #b7c8dc;
}

pre {
    min-height: 400px;
    max-height: 640px;
    padding: 16px;
    border-color: #2a3039;
    border-radius: 7px;
    color: #d2d6dc;
    background: #0b0e13;
    font: 12px/1.55 var(--font-mono);
    box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.25);
}

.log-timestamp {
    color: #697483;
}

.log-frame {
    color: #8a95a3;
}

.log-category {
    color: #77a7dc;
}

.log-display {
    color: #a9bed6;
}

.log-warning {
    color: #d6a65f;
}

.log-error {
    color: #df7c7f;
}

.log-success {
    color: #79b590;
}

.log-blueprint {
    color: #d1b86e;
}

.log-type {
    color: #c5ad86;
}

.log-string {
    color: #c99074;
}

.log-number {
    color: #aabd9e;
}

.log-path {
    color: #b093bd;
}

.table-wrap {
    border-color: var(--border);
    border-radius: 7px;
    background: #0d1219;
}

table {
    color: #d4dae2;
    font-size: 12px;
}

th,
td {
    padding: 9px 11px;
    border-color: #222b37;
}

th {
    color: #9da9b8;
    background: #171e28;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.012);
}

tr:hover,
tr.clickable:hover {
    background: rgba(111, 158, 216, 0.07);
}

tr.is-selected {
    background: rgba(111, 158, 216, 0.1);
}

.type-pill {
    min-width: 66px;
    padding: 3px 7px;
    border: 1px solid var(--border);
    background: #181f2a;
    font-size: 11px;
}

.type-pill.dir {
    border-color: rgba(111, 158, 216, 0.25);
    color: #afc9e7;
    background: rgba(111, 158, 216, 0.08);
}

.type-pill.editable {
    border-color: rgba(98, 185, 139, 0.25);
    color: #b3d7c3;
    background: rgba(98, 185, 139, 0.08);
}

.path {
    color: #aebed0;
}

.page-file-manager .grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(420px, 0.75fr);
}

.page-file-manager .manager-card {
    min-height: 0;
    grid-column: 1 / -1;
}

.page-file-manager .grid:has(.editor-card.is-open) .manager-card {
    grid-column: auto;
}

.page-file-manager .editor-card {
    position: sticky;
    top: 20px;
}

.page-file-manager textarea {
    min-height: 590px;
    color: #d6d9df;
    background: #0a0d12;
}

.page-database-manager .grid {
    grid-template-columns: 280px minmax(0, 1fr);
}

.page-database-manager aside.card {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow: auto;
}

.table-list {
    gap: 5px;
}

.table-button {
    min-height: 34px;
    border-color: transparent;
    color: #cbd2dc;
    background: transparent;
    box-shadow: none;
}

.table-button:hover {
    border-color: var(--border);
    color: #fff;
    background: #19212c;
}

.table-button.is-active {
    border-color: rgba(111, 158, 216, 0.28);
    color: #dbe9f8;
    background: var(--accent-soft);
}

.bulk-toolbar,
.cleanup-result {
    border-radius: 7px;
    background: #0e141c;
}

.editor.card {
    border-style: dashed;
    background: #0e141c;
}

.pk {
    color: #d1b86e;
}

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

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes login-enter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

::view-transition-old(root) {
    animation: 150ms ease both fade-out;
}

::view-transition-new(root) {
    animation: 260ms ease both fade-in;
}

@keyframes fade-out {
    to {
        opacity: 0;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@media (max-width: 1100px) {
    .page-file-manager .grid,
    .page-database-manager .grid {
        grid-template-columns: 1fr;
    }

    .page-file-manager .manager-card,
    .page-file-manager .grid:has(.editor-card.is-open) .manager-card {
        grid-column: auto;
    }

    .page-file-manager .editor-card,
    .page-database-manager aside.card {
        position: static;
        max-height: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        transition-duration: 1ms !important;
    }

    .feedback-spinner {
        animation-duration: 1.5s !important;
    }
}

@media (max-width: 720px) {
    .shell,
    .page-database-manager .shell {
        width: min(100% - 24px, 1680px);
        padding-top: 18px;
    }

    .topbar {
        align-items: stretch;
    }

    .topbar > div:first-child {
        padding-left: 54px;
    }

    .topbar > div:first-child::before {
        width: 40px;
        height: 40px;
    }

    .card {
        padding: 16px;
    }

    .kv,
    .bandwidth-card .kv {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .kv div:nth-child(even) {
        margin-bottom: 7px;
    }

    button,
    .button-link {
        min-height: 38px;
    }
}
