:root {
    --bg: #0f172a;
    --card: #1e293b;
    --card2: #162238;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --accent2: #2563eb;
    --border: rgba(148, 163, 184, 0.15);
    --border2: rgba(148, 163, 184, 0.08);
    --ok: #4ade80;
    --err: #f87171;
    --warn: #fbbf24;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --radius: 12px;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

/* subtle background depth */
body {
    margin: 0;
    background:
        radial-gradient(900px 500px at 20% 0%, rgba(59, 130, 246, 0.12), transparent 55%),
        radial-gradient(700px 420px at 85% 10%, rgba(74, 222, 128, 0.08), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline
}

/* Container (index default) */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 40px);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* Bars */
.bar {
    padding: 14px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.14));
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.brand {
    font-weight: 900;
    letter-spacing: .2px
}

.brand span {
    color: var(--accent)
}

.spacer {
    flex: 1
}

.pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
}

/* Inputs */
input[type="text"],
input[type="password"] {
    flex: 1;
    min-width: 240px;
    background: #020617;
    border: 1px solid var(--border);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
    outline: none;
}

input:focus {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Buttons */
.btn {
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
    transition: transform .06s ease, background .2s ease, border-color .2s ease, opacity .2s ease, box-shadow .2s ease;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.08)
}

.btn:active {
    transform: translateY(1px)
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed
}

.btn.primary {
    background: linear-gradient(to bottom, var(--accent), var(--accent2));
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 10px 20px -12px rgba(59, 130, 246, 0.6);
}

.btn.primary:hover {
    filter: brightness(1.03)
}

.btn.tog {
    background: rgba(255, 255, 255, 0.05)
}

.btn.tog.on {
    border-color: rgba(74, 222, 128, 0.35);
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.10) inset;
}

/* Tabs */
.tabs {
    display: flex;
    background: #0f172a;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    user-select: none;
    white-space: nowrap;
}

.tab.active {
    color: #fff;
    border-bottom-color: var(--accent);
    background: rgba(59, 130, 246, 0.06);
}

/* Main content panels */
.content {
    flex: 1;
    position: relative;
    background:
        radial-gradient(900px 400px at 50% 0%, rgba(255, 255, 255, 0.03), transparent 55%),
        #0b1120;
    overflow: hidden;
}

.view-panel {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: none;
}

.view-panel.active {
    display: block
}

/* Footer status */
.status-bar {
    padding: 8px 15px;
    background: #020617;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.ok {
    color: var(--ok)
}

.err {
    color: var(--err)
}

/* Loader */
.loader {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(2, 6, 23, .55);
    backdrop-filter: blur(2px);
    z-index: 50;
}

.loader.on {
    display: grid
}

.spin {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid rgba(148, 163, 184, .2);
    border-top-color: var(--accent);
    animation: sp 1s linear infinite;
}

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

/* -----------------------------
   CODE VIEW (custom line nums)
------------------------------ */
.code-view {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    min-height: 100%;
    padding: 0;
    background: #0b1120;
}

.code-row {
    display: flex;
    align-items: flex-start;
}

.gutter {
    width: 64px;
    flex: 0 0 64px;
    text-align: right;
    padding: 6px 10px;
    color: rgba(148, 163, 184, 0.70);
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--border2);
    user-select: none;
    position: sticky;
    left: 0;
}

.code-cell {
    flex: 1;
    padding: 6px 12px;
    white-space: pre;
}

.code-row:hover .gutter {
    color: rgba(226, 232, 240, 0.85)
}

.code-row:hover {
    background: rgba(255, 255, 255, 0.015)
}

.wrap-on .code-cell {
    white-space: pre-wrap;
    word-break: break-word
}

.lines-off .gutter {
    display: none
}

.lines-off .code-cell {
    padding-left: 12px
}

/* Error block displayed inside code area */
.code-error {
    padding: 18px 18px;
}

.code-error .err-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
}

.code-error .err-x {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: rgba(248, 113, 113, 0.18);
    border: 1px solid rgba(248, 113, 113, 0.35);
    position: relative;
}

.code-error .err-x:before,
.code-error .err-x:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 2px;
    background: #f87171;
    transform-origin: center;
}

.code-error .err-x:before {
    transform: translate(-50%, -50%) rotate(45deg)
}

.code-error .err-x:after {
    transform: translate(-50%, -50%) rotate(-45deg)
}

.code-error .err-msg {
    margin-top: 10px;
    color: #fecaca;
    font-weight: 800;
}

.code-error .err-sub {
    margin-top: 6px;
    color: rgba(226, 232, 240, 0.75);
    font-size: 12px;
}

/* Prism-ish tokens */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #94a3b8
}

.token.punctuation {
    color: #cbd5e1
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #93c5fd
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #86efac
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #fbbf24
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #f472b6
}

.token.function,
.token.class-name {
    color: #a5b4fc
}

.token.regex,
.token.important,
.token.variable {
    color: #fdba74
}

.no-syntax .token {
    color: inherit !important
}

.no-syntax .token.comment {
    color: inherit !important;
    opacity: .75
}

/* -----------------------------
   INFO TAB + HEADERS TABLE (Index)
------------------------------ */
.info-grid {
    padding: 22px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
}

.card-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.card-title {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
    font-weight: 900;
    letter-spacing: .6px;
}

.kv-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    gap: 12px;
}

.kv-row:last-child {
    border-bottom: none
}

.kv-k {
    color: var(--muted)
}

.kv-v {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    word-break: break-all;
    text-align: right;
}

/* Tables (Headers tab) */
.table-wrap {
    overflow: auto;
    border: 1px solid var(--border2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    min-width: 720px;
}

.table thead th {
    text-align: left;
    font-size: 12px;
    color: rgba(226, 232, 240, 0.9);
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 12px 12px;
    border-bottom: 1px solid var(--border2);
    position: sticky;
    top: 0;
    background: linear-gradient(to bottom, rgba(2, 6, 23, 0.92), rgba(2, 6, 23, 0.78));
    backdrop-filter: blur(6px);
    z-index: 2;
}

.table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: top;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03)
}

.table tbody tr:last-child td {
    border-bottom: none
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.small {
    font-size: 12px;
    color: var(--muted)
}

.badge {
    font-weight: 900;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    display: inline-block;
    line-height: 1.4;
}

.badge.ok {
    color: var(--ok);
    border-color: rgba(74, 222, 128, 0.25);
    background: rgba(74, 222, 128, 0.07);
}

.badge.err {
    color: var(--err);
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.07);
}

/* ====== MOBILE ====== */
@media (max-width:720px) {
    body {
        padding: 12px
    }

    .container {
        min-height: calc(100vh - 24px);
        border-radius: 14px
    }

    .bar {
        padding: 12px;
        gap: 8px
    }

    .brand {
        width: 100%
    }

    .spacer {
        display: none
    }

    input[type="text"],
    input[type="password"] {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
    }

    .btn {
        width: 100%;
        justify-content: center
    }

    .tab {
        padding: 10px 14px;
        font-size: 12px
    }

    .info-grid {
        padding: 14px;
        grid-template-columns: 1fr
    }

    .card-box {
        padding: 14px
    }

    .status-bar {
        padding: 10px 12px
    }
}

/* ultra small phones */
@media (max-width:420px) {
    .pill {
        font-size: 11px
    }

    .card-title {
        letter-spacing: .4px
    }
}