@font-face {
    font-family: Geist;
    src: url("fonts/geist-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
        U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: dark;
    --background: #090e0c;
    --sidebar: #0d1411;
    --surface: #121a16;
    --surface-raised: #18231d;
    --surface-input: #0d1511;
    --ink: #f1f6f2;
    --muted: #a1b4a9;
    --line: #26382d;
    --line-strong: #3a5244;
    --control-line: #597361;
    --accent: #88e4b8;
    --accent-strong: #61c994;
    --accent-ink: #071912;
    --accent-soft: #1b3b2c;
    --warning: #f1ca88;
    --danger: #ffaba4;
    --font-ui: Geist, "Segoe UI", system-ui, sans-serif;
    --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --shadow: 0 14px 44px #0003;
    --radius: 14px;
    font: 16px/1.55 var(--font-ui);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
}

a {
    color: var(--accent);
    text-underline-offset: .2em;
}

a:hover {
    color: #bdf8d8;
}

button, input, select, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

h1, h2, h3 {
    line-height: 1.12;
    letter-spacing: -.033em;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 680;
}

h2 {
    font-size: 1.28rem;
    font-weight: 650;
}

h3 {
    font-size: 1.05rem;
    font-weight: 640;
}

p {
    margin-block: .6rem 1rem;
    color: var(--muted);
}

::selection {
    color: var(--accent-ink);
    background: var(--accent);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    padding: .55rem .9rem;
    color: var(--accent-ink);
    background: var(--accent);
    border-radius: 6px;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: none;
}

.workspace {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 1.65rem;
    overflow: auto;
    padding: 1.2rem .85rem;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .68rem;
    padding: .25rem .42rem;
    color: var(--ink);
    text-decoration: none;
    font-size: 1.13rem;
    font-weight: 720;
    letter-spacing: -.047em;
    white-space: nowrap;
}

.brand:hover {
    color: var(--ink);
}

.brand-mark {
    display: grid;
    width: 33px;
    height: 33px;
    flex: none;
    place-items: center;
    overflow: hidden;
    border: 1px solid #426b53;
    border-radius: 8px;
    background: linear-gradient(152deg, #264b37, #14291e 67%);
    color: var(--accent);
    font-size: 1rem;
    font-weight: 720;
    letter-spacing: 0;
}

.nav, .sidebar-bottom {
    display: grid;
    gap: .24rem;
}

.nav a, .sidebar-bottom a, .sidebar-bottom button {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: 42px;
    padding: .48rem .65rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    font-size: .89rem;
    font-weight: 550;
}

.nav a::before {
    width: .35rem;
    height: .35rem;
    flex: none;
    border: 1px solid currentColor;
    border-radius: 2px;
    opacity: .72;
    content: "";
}

.nav a:hover, .sidebar-bottom a:hover, .sidebar-bottom button:hover {
    color: var(--ink);
    background: var(--surface-raised);
}

.nav a[aria-current] {
    border-color: #335944;
    color: var(--accent);
    background: #172d22;
    font-weight: 630;
}

.nav a[aria-current]::before {
    background: currentColor;
    opacity: 1;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: .75rem;
    border-top: 1px solid var(--line);
}

.sidebar-bottom button {
    width: 100%;
}

.main {
    min-width: 0;
    background: radial-gradient(ellipse at 95% 0, #142319 0, transparent 40rem);
}

.topbar {
    display: flex;
    min-height: 66px;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .7rem clamp(1rem, 4vw, 3.2rem);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    background: #0d1511d8;
    font-size: .84rem;
}

.workspace-label {
    font: 500 .72rem/1.4 var(--font-mono);
    letter-spacing: .045em;
    text-transform: uppercase;
}

.account-link, .label-pair {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: .55rem;
    text-decoration: none;
}

.account-link {
    color: var(--ink);
}

.account-link-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar {
    display: inline-grid;
    width: 32px;
    height: 32px;
    flex: none;
    place-items: center;
    border: 1px solid #3c634c;
    border-radius: 8px;
    color: var(--accent);
    background: #192f23;
    font: 650 .82rem/1 var(--font-mono);
    text-transform: uppercase;
}

.content {
    max-width: 1380px;
    margin: auto;
    padding: clamp(1rem, 4vw, 3.2rem);
}

.page-heading {
    margin-bottom: clamp(1.1rem, 3vw, 1.75rem);
}

.page-heading p {
    margin: .48rem 0 0;
}

.page-heading .actions {
    margin-top: .9rem;
}

.panel {
    min-width: 0;
    padding: clamp(1rem, 2.65vw, 1.65rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel + .panel {
    margin-top: 1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 1rem;
}

.dashboard-grid > .panel {
    margin-top: 0;
}

.hero {
    border-color: #34533f;
    background: linear-gradient(140deg, #162e21, var(--surface) 72%);
}

.hero h2 {
    font-size: clamp(1.65rem, 3.1vw, 2.35rem);
}

.hero .status-pill + h2 {
    margin-top: .85rem;
}

.hero p {
    color: #b4c8bd;
}

.status-pill, .tag {
    display: inline-flex;
    align-items: center;
    padding: .23rem .55rem;
    border: 1px solid #3a654c;
    border-radius: 100px;
    color: var(--accent);
    background: var(--accent-soft);
    font: 550 .74rem/1.35 var(--font-mono);
}

.metric {
    margin-top: .65rem;
    font: 650 clamp(2rem, 4vw, 3rem)/1.06 var(--font-mono);
    letter-spacing: -.075em;
}

.button, .button-secondary {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    gap: .42rem;
    padding: .52rem .92rem;
    border: 1px solid transparent;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 660;
    line-height: 1.4;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.button {
    color: var(--accent-ink);
    background: var(--accent);
}

.button:hover {
    color: var(--accent-ink);
    background: #b1f2cf;
}

.button-secondary {
    border-color: var(--control-line);
    color: var(--ink);
    background: var(--surface-raised);
}

.button-secondary:hover {
    border-color: #6d987d;
    color: var(--accent);
    background: #22352a;
}

button:disabled {
    cursor: default;
    opacity: .6;
}

.form-stack {
    display: grid;
    max-width: 570px;
    gap: .85rem;
}

.form-stack > button {
    justify-self: start;
}

label:not(.check) {
    display: grid;
    gap: .35rem;
    font-size: .9rem;
    font-weight: 580;
}

input:not([type=checkbox], [type=radio]), select, textarea {
    width: 100%;
    min-width: 0;
    padding: .57rem .66rem;
    border: 1px solid var(--control-line);
    border-radius: 8px;
    color: var(--ink);
    background: var(--surface-input);
}

input::placeholder, textarea::placeholder {
    color: #83998b;
}

input[type=checkbox], input[type=radio] {
    accent-color: var(--accent-strong);
}

.check {
    display: inline-flex;
    align-items: center;
    gap: .48rem;
    font-size: .91rem;
}

.actions, .input-row, .list-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem;
}

.grow {
    min-width: 10rem;
    flex: 1;
}

.list-row {
    justify-content: space-between;
    padding-block: .78rem;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.notice {
    margin-bottom: 1rem;
    padding: .65rem .85rem;
    border: 1px solid #3c694f;
    border-radius: 8px;
    color: #b6f0d1;
    background: #172f23;
}

.notice-error {
    border-color: #87504b;
    color: var(--danger);
    background: #35211f;
}

.notice ul {
    margin: 0;
    padding-left: 1.1rem;
}

.placement-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
}

.empty {
    padding: .75rem;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--surface-input);
}

.muted, small, time {
    color: var(--muted);
}

code, kbd, samp, pre {
    font-family: var(--font-mono);
}

code {
    color: #b8e4ca;
    overflow-wrap: anywhere;
}

.narrow {
    max-width: 620px;
}

.tree-panel {
    min-height: 335px;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    color: var(--muted);
    font-size: .88rem;
}

.tree-diagram {
    max-width: 660px;
    margin: 1.75rem auto .5rem;
}

.tree-node {
    min-width: 0;
    padding: .9rem;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface-raised);
    text-align: center;
    overflow-wrap: anywhere;
}

.tree-node .avatar {
    margin-bottom: .45rem;
}

.tree-node .button-secondary, .tree-node form {
    margin-top: .65rem;
}

.parent-node {
    position: relative;
    max-width: 268px;
    margin: auto;
    border-color: #567b63;
}

.parent-node::after {
    position: absolute;
    top: 100%;
    left: 50%;
    height: 21px;
    border-left: 1px solid #609174;
    content: "";
}

.tree-legs {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
    padding-top: 37px;
}

.tree-legs::before {
    position: absolute;
    top: 21px;
    left: 25%;
    width: 50%;
    height: 16px;
    border: 1px solid #609174;
    border-bottom: 0;
    content: "";
}

.open-node {
    border: 1px dashed #50745e;
    background: var(--surface-input);
}

.leg-label {
    display: block;
    margin-bottom: .55rem;
    color: var(--accent);
    font: 550 .74rem/1.4 var(--font-mono);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0;
    list-style: none;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: .65rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

summary {
    cursor: pointer;
}

@media (max-width: 850px) {
    .workspace {
        display: block;
    }

    .sidebar {
        position: relative;
        height: auto;
        gap: .5rem;
        padding: .65rem .85rem;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .nav, .sidebar-bottom {
        display: flex;
        flex-wrap: wrap;
    }

    .sidebar-bottom {
        padding: .3rem 0 0;
    }

    .nav a, .sidebar-bottom a, .sidebar-bottom button {
        min-height: 41px;
        padding: .38rem .55rem;
    }

    .topbar {
        min-height: 49px;
        padding-block: .4rem;
    }
}

@media (max-width: 580px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tree-diagram {
        margin-top: 1rem;
    }

    .tree-legs {
        grid-template-columns: minmax(0, 1fr);
        gap: .65rem;
        padding-top: .9rem;
    }

    .tree-legs::before, .parent-node::after {
        display: none;
    }

    .tree-node {
        padding: .7rem;
    }

    .topbar {
        font-size: .8rem;
    }

    .workspace-label {
        font-size: .64rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .button, .button-secondary {
        transition: none;
    }
}
