:root {
    color-scheme: light;
    --ink: #182a3e;
    --muted: #53657a;
    --bg: #f4f6fa;
    --surface: #fff;
    --line: #dce5ed;
    --sidebar: #101f30;
    --accent: #08737d;
    --ok: #165d48;
    --warn: #7d3d07;
    --danger: #8b2729;
    --sidebar-width: 15rem;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid #2a8891; outline-offset: 3px; }

.skip-link {
    position: fixed;
    top: .5rem;
    left: .5rem;
    z-index: 20;
    transform: translateY(-150%);
    background: var(--surface);
    padding: .75rem 1rem;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 1.7rem 1rem 1.2rem;
    background: var(--sidebar);
    color: #e2edf5;
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: inherit;
    font-size: 1.12rem;
    font-weight: 750;
    letter-spacing: -.025em;
    text-decoration: none;
}

.brand small {
    display: block;
    margin-top: .13rem;
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.mark {
    display: grid;
    flex: 0 0 2.5rem;
    place-items: center;
    height: 2.5rem;
    border-radius: .65rem;
    background: #0c777d;
    color: white;
    font-size: .9rem;
    letter-spacing: 0;
}

.nav-label, .eyebrow {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.nav-label { margin: 2.6rem .8rem .6rem; color: #a3b6c8; }

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .68rem .78rem;
    margin: .25rem 0;
    border-radius: .55rem;
    color: #b8cada;
    font-size: .9rem;
    font-weight: 620;
    text-decoration: none;
}

.nav-item span { width: 1.35rem; text-align: center; font-size: 1.15rem; }
.nav-item:hover { background: #1b3045; color: white; }
.nav-item[aria-current="page"] { background: #20424b; color: #9ce9dc; box-shadow: inset 3px 0 #70cbbd; }

.sidebar-bottom {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-top: auto;
    padding-top: 1.15rem;
    border-top: 1px solid #314456;
    font-size: .75rem;
    font-weight: 650;
}

.sidebar-bottom small { display: block; color: #a3b6c8; font-weight: 500; }
.sidebar-bottom form { margin-left: auto; }

.avatar {
    display: grid;
    flex: 0 0 1.8rem;
    place-items: center;
    height: 1.8rem;
    border-radius: 50%;
    background: #284358;
    color: #b9ebe4;
}

.workspace { margin-left: var(--sidebar-width); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4.5rem;
    gap: .8rem;
    padding: .65rem 2.2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.breadcrumb { font-size: .85rem; font-weight: 650; }
.breadcrumb span { margin-inline: .35rem; color: #8798ab; }
.topbar-actions { display: flex; align-items: center; gap: .55rem; }
.secure-badge { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .78rem; }
.secure-badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: #2a987c; }
.mobile-logout { display: none; }

main { max-width: 90rem; margin-inline: auto; padding: 2rem 2.2rem 1.4rem; }
footer { display: flex; justify-content: space-between; padding: 0 2.2rem 1.3rem; color: var(--muted); font-size: .75rem; }

.auth-page { min-height: 100vh; background: radial-gradient(ellipse at 15% 0%, #dcefe9, transparent 55%), var(--bg); }
.auth-page main { max-width: 36rem; padding-top: 3rem; }
.auth-page .brand { justify-content: center; }

.intro, .actions, .pagination { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.intro { justify-content: space-between; margin-bottom: 1.15rem; }
.intro p:last-child { margin-bottom: 0; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.1rem); line-height: 1.18; margin-bottom: .5rem; letter-spacing: -.035em; }
h2 { font-size: 1.06rem; margin-bottom: .75rem; }
.eyebrow { margin-bottom: .42rem; }
.subtle { color: var(--muted); }

.card {
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: .8rem;
    background: var(--surface);
    box-shadow: 0 2px 6px #172b4a08;
}

.card p:last-child { margin-bottom: 0; }
.grid, .pair { display: grid; gap: 1rem; margin-top: 1rem; }
.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid .card { border-top: 3px solid #70b9b0; }
.grid .card:nth-child(2) { border-top-color: #939ad0; }
.grid .card:nth-child(3) { border-top-color: #cca66b; }
.grid .card:nth-child(4) { border-top-color: #86b0cd; }
.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.credentials { width: min(100%, 29rem); margin: 1.5rem auto; padding: clamp(1rem, 5vw, 2rem); }
.stack, .stack label { display: grid; gap: .45rem; }
.stack { gap: 1rem; }
.stack label { font-size: .9rem; font-weight: 650; }

input {
    width: 100%;
    padding: .65rem .7rem;
    border: 1px solid #a6b5c5;
    border-radius: .48rem;
    background: #fbfcfe;
    color: var(--ink);
    font: inherit;
}

button {
    min-height: 2.65rem;
    padding: .55rem .8rem;
    border: 1px solid transparent;
    border-radius: .5rem;
    background: var(--accent);
    color: white;
    font: inherit;
    font-size: .88rem;
    font-weight: 670;
    cursor: pointer;
}

button.secondary { border-color: #cad9e1; background: #eff5f7; color: #23475a; }
button.quiet { padding-inline: .45rem; border-color: #556a7e; background: transparent; }
button.danger { background: #fff0f0; border-color: #ecc7cb; color: var(--danger); }
button:disabled { cursor: default; opacity: .55; }
button:hover:not(:disabled) { filter: brightness(.92); }

.pill { display: inline-block; padding: .23rem .68rem; border-radius: 2rem; font-size: .8rem; font-weight: 730; }
.pill.ok, .notice { background: #e1f5eb; color: var(--ok); }
.pill.warning { background: #fff0dc; color: var(--warn); }
.notice, .error { max-width: 46rem; padding: .75rem 1rem; border-radius: .55rem; }
.error { background: #fde9e9; color: var(--danger); }

.metrics { margin: 0 0 .6rem; }
.metrics div { display: flex; justify-content: space-between; gap: .5rem; padding: .46rem 0; border-bottom: 1px solid var(--line); }
.metrics dd { margin: 0; font-weight: 700; text-align: right; }

.table-wrap { overflow: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .75rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f6f9fb; color: #415c73; font-size: .74rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
code { font-size: .84em; }
.setup-key { display: block; margin-bottom: 1rem; padding: .65rem; border-radius: .4rem; background: var(--bg); user-select: all; }

.actions { min-width: 9rem; align-items: flex-start; }
summary { color: var(--danger); cursor: pointer; }
details form { margin-top: .35rem; }
.pagination { margin-top: 1rem; }

@media (max-width: 72rem) {
    :root { --sidebar-width: 12.75rem; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    main, footer, .topbar { padding-inline: 1.5rem; }
}

@media (max-width: 47.5rem) {
    .sidebar { position: static; width: auto; padding: .95rem 1rem .7rem; }
    .sidebar nav { display: flex; gap: .35rem; overflow-x: auto; margin-top: .65rem; }
    .nav-item { flex: 0 0 auto; gap: .35rem; margin: 0 0 .15rem; padding: .53rem .55rem; font-size: .8rem; }
    .nav-item span { width: auto; font-size: 1rem; }
    .nav-label, .sidebar-bottom { display: none; }
    .workspace { margin-left: 0; }
    .topbar { min-height: 3.25rem; padding-block: .35rem; }
    main, footer, .topbar { padding-inline: 1rem; }
    main { padding-top: 1.35rem; }
    .breadcrumb, .secure-badge { font-size: .73rem; }
    .mobile-logout { display: block; }
    .mobile-logout button { min-height: 2.25rem; padding: .35rem .55rem; }
    .pair { grid-template-columns: 1fr; }
    .card { padding: 1rem; }
    .table-wrap { padding: 0; }
    .auth-page main { padding-top: 2rem; }
}

@media (max-width: 24rem) {
    .secure-badge { display: none; }
    .grid { grid-template-columns: 1fr; }
}
