@font-face {
    font-family: 'DMSans';
    src: local('DM Sans'), local('DMSans'), url('/fonts/dmsans/DMSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'DMSans';
    src: local('DM Sans-Medium'), local('DMSans-medium'), url('/fonts/dmsans/DMSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'DMSans';
    src: local('DM Sans-Bold'), local('DMSans-bold'), url('/fonts/dmsans/DMSans-Bold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}
:root {
    color-scheme: light;
    --bg: #f5f5f7;
    --panel: #ffffff;
    --border: #e2e2e8;
    --text: #16161a;
    --muted: #6b6b76;
    /* Walley brand palette */
        --brand-elephant: #0d3843;
        --brand-minsk: #3d388b;
        --brand-magenta: #e4007e;
        --brand-orange: #ff4d06;
        --brand-yellow: #ffdd00;
        /* Functional accent — minsk purple */
        --accent: #3d388b;
        --accent-soft: #ebebf8;
    --ok: #0b7a4b;
    --ok-soft: #e4f6ec;
    --err: #b3261e;
    --err-soft: #fdeceb;
    --code-bg: #f0f0f4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'DMSans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.app {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */

.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 0;
    overflow-y: auto;
    max-height: 100vh;
    box-shadow: 2px 0 12px rgba(0, 0, 0, .05);
    }
    
/* Walley brand gradient header */
.sidebar-header {
    padding: 1.5rem 1.25rem 1.25rem;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 1023 1023' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise-overlay'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise-overlay)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 0% 90%, #0d3843 0%, transparent 67%),
        radial-gradient(ellipse at 0% 67%, #0d3843 0%, transparent 50%),
        radial-gradient(ellipse at 40% -40%, #e4007e 0%, transparent 200%),
        radial-gradient(ellipse at 85% 85%, #ffdd00 0%, transparent 67%),
        radial-gradient(ellipse at 100% 60%, #ff4d06 0%, transparent 67%),
        radial-gradient(ellipse at 100% 0%, #e4007e 0%, transparent 33%);
    background-blend-mode: overlay, normal, normal, normal, normal, normal, normal;
    background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
    background-size: 1024px 1024px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    background-color: #0d3843;
    color: #fff;
}

.sidebar-header h1 {
    font-size: 1.2rem;
        font-weight: 700;
        margin: 0 0 .65rem;
        color: #fff;
        letter-spacing: -.01em;
}

.sidebar-form-area {
    padding: 1rem 1rem 1rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: 0;
}

.chip {
    border: 1px solid rgba(255, 255, 255, .35);
        border-radius: 999px;
        padding: .2rem .6rem;
        font-size: .7rem;
        color: rgba(255, 255, 255, .85);
        background: rgba(255, 255, 255, .12);
        font-weight: 500;
        letter-spacing: .01em;
    }

.chip[data-state="healthy"] {
    border-color: #6ee7a0;
    color: #d4f7e3;
    background: rgba(110, 231, 160, .18);
}
.chip[data-state="degraded"] {
    border-color: #fcd34d;
    color: #fef3c7;
    background: rgba(252, 211, 77, .18);
}

.chip[data-state="down"] {
    border-color: #fca5a5;
    color: #fee2e2;
    background: rgba(252, 165, 165, .18);
}

.group {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: .5rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    overflow: hidden;
}

.group-toggle {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: .65rem .8rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: background .15s;
}

.group-toggle:hover {
    background: var(--accent-soft);
}
.group-toggle::before { content: "+ "; color: var(--accent); font-weight: 700; }
.group.open > .group-toggle::before { content: "− "; }
.group.open>.group-toggle {
    background: var(--accent-soft);
    color: var(--accent);
}

.group-body {
    display: none;
    padding: .8rem .8rem .8rem;
}
.group.open > .group-body { display: block; }

.field {
    display: block;
    margin-bottom: .7rem;
}
.field>span {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    margin-bottom: .25rem;
    font-weight: 500;
}
.field > span em { font-style: normal; opacity: .75; }
.field small { display: block; margin-top: .25rem; font-size: .68rem; color: var(--muted); line-height: 1.35; }

.password-field {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .4rem;
    align-items: center;
}

.password-field .secondary {
    padding: .48rem .65rem;
    white-space: nowrap;
}
input[type="text"], input[type="password"], select {
    width: 100%;
    padding: .48rem .6rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font: inherit;
    font-size: .82rem;
    background: #fafafa;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: #fff;
}

.check { display: flex; align-items: center; gap: .45rem; margin-bottom: .4rem; font-size: .82rem; }
.check input {
    margin: 0;
    accent-color: var(--accent);
}

.hint { font-size: .7rem; color: var(--muted); line-height: 1.4; margin: .5rem 0 0; }

.identity-country h3 {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin: .6rem 0 .3rem;
    font-weight: 600;
}

.identity {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafafa;
    padding: .5rem .65rem;
    margin-bottom: .3rem;
    cursor: pointer;
    font: inherit;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.identity:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 2px 6px rgba(61, 56, 139, .12);
}
.identity-name { display: block; font-size: .8rem; font-weight: 600; }
.identity-nin { display: block; font-size: .75rem; color: var(--muted); font-family: ui-monospace, monospace; }
.identity-note { display: block; font-size: .68rem; color: var(--muted); margin-top: .15rem; }

.extra-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: .3rem; margin-bottom: .3rem; }

.actions {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
}

.actions .secondary {
    text-align: center;
}

.actions .share-config {
    grid-column: 1 / -1;
}

button.primary {
    width: 100%;
    background: linear-gradient(135deg, var(--brand-magenta) 0%, var(--brand-orange) 60%, var(--brand-yellow) 100%);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: .75rem;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .01em;
    transition: opacity .15s, box-shadow .15s;
    box-shadow: 0 2px 10px rgba(228, 0, 126, .3);
}

button.primary:hover {
    opacity: .9;
    box-shadow: 0 4px 16px rgba(228, 0, 126, .4);
}

.secondary, a.secondary {
    display: inline-block;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 7px;
    padding: .4rem .75rem;
    font-size: .8rem;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: border-color .15s, color .15s;
}

.secondary:hover { border-color: var(--accent); color: var(--accent); }

button.icon {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    padding: 0 .5rem;
    transition: border-color .15s, color .15s;
}

button.icon:hover {
    border-color: var(--err);
    color: var(--err);
}

.reset-form {
    margin-top: .75rem;
    text-align: center;
    padding-bottom: .75rem;
}

button.link {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: .78rem;
    text-decoration: underline;
}

button.link:hover {
    color: var(--text);
}

/* ── Content ───────────────────────────────────────────────────────────── */

.content {
    padding: 1.75rem;
    overflow-y: auto;
    max-height: 100vh;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
        padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}

.card h2 {
    font-size: .75rem;
    margin: 0 0 .85rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 600;
}
.card h3 { font-size: .85rem; margin: 1rem 0 .4rem; }
.card.empty {
    color: var(--muted);
    font-size: .9rem;
}
.card.success { border-left: 4px solid var(--ok); }
.card.error { border-left: 4px solid var(--err); }

.error-code { font-family: ui-monospace, monospace; color: var(--err); font-weight: 600; margin: 0 0 .4rem; }
.meta { color: var(--muted); font-size: .8rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.meta .ok { color: var(--ok); font-weight: 600; }

.health {
    display: grid;
    gap: .4rem;
}

.health-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .45rem .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .82rem;
}
.health-row .value { font-family: ui-monospace, monospace; }
.health-row.ok { background: var(--ok-soft); border-color: #bfe6cf; }
.health-row.bad { background: var(--err-soft); border-color: #f3c9c6; }

.shortcuts { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; }

.endpoint-info {
    width: 100%;
    margin-top: .5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.endpoint-row {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding: .45rem .7rem;
    border-bottom: 1px solid var(--border);
    font-size: .78rem;
}

.endpoint-row:last-child { border-bottom: none; }

.endpoint-label {
    color: var(--muted);
    white-space: nowrap;
    min-width: 9rem;
    flex-shrink: 0;
    font-weight: 500;
}

.endpoint-url {
    font-family: ui-monospace, monospace;
    font-size: .75rem;
    word-break: break-all;
    color: var(--text);
    user-select: all;
}

.shortcut {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .3rem .85rem;
    font-size: .78rem;
    text-decoration: none;
    color: var(--text);
    background: #fff;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}

.shortcut:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

@keyframes flash-highlight {
    0%, 100% { box-shadow: none; }
        30% {
            box-shadow: 0 0 0 3px rgba(61, 56, 139, .35);
        }
}

.card.flash { animation: flash-highlight 1.6s ease-in-out; }
.health-row.flash { animation: flash-highlight 1.6s ease-in-out; }

.raw { margin-top: .75rem; }
.raw summary { cursor: pointer; font-size: .8rem; color: var(--muted); }
.raw summary:hover {
    color: var(--text);
}

pre {
    background: var(--code-bg);
    border-radius: 8px;
        padding: .85rem;
    overflow-x: auto;
    font-size: .75rem;
    line-height: 1.45;
    max-height: 22rem;
    border: 1px solid var(--border);
}

table.kv { width: 100%; border-collapse: collapse; font-size: .8rem; }
table.kv th {
    text-align: left;
    width: 34%;
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--muted);
    vertical-align: top;
}

table.kv td {
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border);
    font-family: ui-monospace, monospace;
    word-break: break-all;
}

.result-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
.result-actions form { margin: 0; }

code {
    background: var(--code-bg);
    border-radius: 4px;
    padding: 0 .25rem;
    font-size: .9em;
    border: 1px solid var(--border);
}

/* ── Field help (ⓘ toggles) ─────────────────────────────────────────── */

.field-help {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .7rem;
    color: var(--muted);
    padding: 0 .15rem;
    vertical-align: middle;
    line-height: 1;
    border-radius: 4px;
    transition: color .15s;
    font-family: inherit;
}

.field-help:hover,
.field-help[aria-expanded="true"] {
    color: var(--accent);
}

.field-desc {
    display: none;
    margin-top: .35rem;
    padding: .5rem .65rem;
    background: var(--accent-soft);
    border: 1px solid rgba(61, 56, 139, .18);
    border-radius: 6px;
    font-size: .68rem;
    line-height: 1.45;
    color: var(--text);
}

.field-desc[data-open] { display: block; }

.field > .field-desc { display: none; font-size: .68rem; color: var(--text); font-weight: normal; margin-bottom: 0; }
.field > .field-desc[data-open] { display: block; }

[data-help-group] .field-desc {
    margin-top: .2rem;
    margin-bottom: .2rem;
}

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { max-height: none; }
    .content { max-height: none; }
}
