:root {
    --ink: #061a35;
    --ink-soft: #476179;
    --paper: #edf3fa;
    --surface: #ffffff;
    --surface-alt: #f7faff;
    --line: #d6e1ee;
    --brand: #155eef;
    --brand-dark: #0b3e9d;
    --accent: #f4b942;
    --success: #0f8c68;
    --warning: #9a6700;
    --danger: #b42318;
    --shadow: 0 20px 56px rgba(6, 26, 53, .12);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: linear-gradient(160deg, #e9f1ff 0%, var(--paper) 42%, #f8fbff 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a { color: inherit; }

.shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    color: var(--ink);
    text-decoration: none;
    font-weight: 900;
    font-size: 1.25rem;
    letter-spacing: -.04em;
}

.brand-mark {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border-radius: 13px 13px 13px 4px;
    box-shadow: 0 10px 24px rgba(21, 94, 239, .25);
}

.brand small { display: block; margin-top: .08rem; color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .01em; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .38rem .68rem;
    border: 1px solid #bdd1f9;
    border-radius: 999px;
    color: var(--brand-dark);
    background: #eef4ff;
    font-size: .77rem;
    font-weight: 800;
}

.badge::before { width: .55rem; height: .55rem; border-radius: 50%; background: var(--success); content: ""; }

.hero {
    padding: 2rem;
    color: #fff;
    background: radial-gradient(circle at 82% 15%, rgba(124, 181, 255, .5), transparent 26%), linear-gradient(130deg, #061a35 0%, #0a3175 58%, #155eef 130%);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.eyebrow { margin: 0 0 .55rem; color: #b9d4ff; font-size: .76rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }

.hero h1 { max-width: 800px; margin: 0; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -.055em; }

.hero p { max-width: 800px; margin: 1rem 0 0; color: #d9e8ff; font-size: 1.01rem; }

.notice {
    margin-top: 1.3rem;
    padding: .9rem 1rem;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 13px;
    background: rgba(2, 12, 31, .30);
    color: #e7f0ff;
    font-size: .9rem;
}

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(6, 26, 53, .06);
}

.card h2, .card h3 { margin: 0 0 .5rem; letter-spacing: -.025em; }
.card h2 { font-size: 1.12rem; }
.card h3 { font-size: 1rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

.route {
    display: inline-block;
    margin: .85rem 0;
    padding: .28rem .48rem;
    border-radius: 7px;
    color: #134baf;
    background: #edf3ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .79rem;
    font-weight: 700;
}

.button-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .62rem .86rem;
    border: 1px solid transparent;
    border-radius: 11px;
    text-decoration: none;
    font-size: .89rem;
    font-weight: 850;
    cursor: pointer;
}

.button-primary { color: #fff; background: var(--brand); }
.button-primary:hover { background: var(--brand-dark); }
.button-outline { color: var(--brand-dark); border-color: #b3caf2; background: #fff; }
.button-outline:hover { background: #f0f5ff; }
.button-danger { color: #8b1f1a; border-color: #f1b9b5; background: #fff8f7; }

.panel { margin-top: 1.25rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 28px rgba(6, 26, 53, .06); }
.panel h2 { margin: 0 0 .55rem; font-size: 1.16rem; letter-spacing: -.025em; }
.panel > p { color: var(--ink-soft); }

.auth-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .65rem; align-items: center; margin-top: .9rem; }

input, textarea {
    width: 100%;
    padding: .7rem .8rem;
    border: 1px solid #b7c9dc;
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

input:focus, textarea:focus { border-color: var(--brand); outline: 3px solid rgba(21, 94, 239, .16); }

.status { margin-top: .8rem; padding: .7rem .82rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-alt); color: var(--ink-soft); font-size: .88rem; }
.status.ok { color: #075f49; border-color: #94d5c1; background: #f0fcf8; }
.status.warn { color: #885b00; border-color: #ead195; background: #fffaf0; }
.status.error { color: #9e1b16; border-color: #efb0ae; background: #fff7f6; }

.endpoint-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .8rem; margin-top: 1rem; }
.endpoint { min-height: 142px; padding: .95rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.endpoint h3 { margin: 0 0 .32rem; font-size: .97rem; }
.endpoint p { margin: 0; color: var(--ink-soft); font-size: .86rem; }
.endpoint .result { margin-top: .7rem; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }

pre {
    overflow: auto;
    min-height: 220px;
    max-height: 590px;
    margin: 1rem 0 0;
    padding: 1rem;
    border: 1px solid #152d53;
    border-radius: 13px;
    color: #dce9ff;
    background: #07172f;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .76rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.table-wrap { overflow: auto; margin-top: 1rem; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .85rem .9rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #173d77; background: #edf3ff; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; }
td { color: var(--ink-soft); font-size: .89rem; }
tr:last-child td { border-bottom: 0; }

.field-stack { display: grid; gap: .65rem; }

.label {
    display: block;
    color: #173d77;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: .75rem;
    font-weight: 800;
}

.result-badge.Verified { color: #065f46; border-color: #9edec9; background: #ecfdf5; }
.result-badge.Mismatch { color: #92400e; border-color: #f4d59c; background: #fffbeb; }
.result-badge.Invalid { color: #9f1239; border-color: #f7b7ce; background: #fff1f6; }
.result-badge.SourceUnavailable { color: #7f1d1d; border-color: #f2b7b7; background: #fff5f5; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-top: .85rem; }

.kpi {
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-alt);
}

.kpi strong { display: block; font-size: 1.25rem; }
.kpi span { color: var(--ink-soft); font-size: .8rem; }

.footer { margin-top: 1.25rem; color: var(--ink-soft); font-size: .8rem; text-align: center; }
.footer a { color: var(--brand-dark); }

.hidden { display: none !important; }

@media (max-width: 840px) {
    .grid, .grid.two, .endpoint-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-grid { grid-template-columns: 1fr; }
    .hero { padding: 1.45rem; }
}
