:root {
    --base: #1e1e2e;
    --mantle: #181825;
    --crust: #11111b;
    --surface0: #313244;
    --surface1: #45475a;
    --overlay0: #6c7086;
    --text: #cdd6f4;
    --subtext0: #a6adc8;
    --mauve: #cba6f7;
    --red: #f38ba8;
    --green: #a6e3a1;
    --yellow: #f9e2af;
    --blue: #89b4fa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--base);
    color: var(--text);
    font: 15px/1.5 ui-sans-serif, system-ui, sans-serif;
    display: grid;
    grid-template-columns: 17rem 1fr;
    min-height: 100vh;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

kbd {
    background: var(--surface0);
    border-radius: 3px;
    color: var(--subtext0);
    font-size: 11px;
    padding: 1px 5px;
}

nav {
    background: var(--mantle);
    border-right: 1px solid var(--surface0);
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

nav .brand {
    color: var(--mauve);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .04em;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

nav li a {
    border-radius: 6px;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    padding: .4rem .55rem;
}

nav li a:hover {
    background: var(--surface0);
    text-decoration: none;
}

nav li a.active {
    background: var(--surface0);
    color: var(--mauve);
}

nav li a span {
    color: var(--overlay0);
    font-size: 12px;
}

main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1rem 1.25rem 3rem;
    width: 100%;
}

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

h1 {
    font-size: 22px;
    margin: 0;
}

h2 {
    font-size: 16px;
    margin: 1.25rem 0 .5rem;
}

.muted {
    color: var(--subtext0);
    font-size: 13px;
}

.row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

input,
select,
textarea,
button {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    padding: .35rem .5rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--mauve);
    outline: none;
}

button {
    background: var(--mauve);
    border-color: var(--mauve);
    color: var(--crust);
    cursor: pointer;
    font-weight: 600;
}

button.ghost {
    background: var(--surface0);
    border-color: var(--surface1);
    color: var(--text);
    font-weight: 500;
}

button:hover {
    filter: brightness(1.1);
}

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

th,
td {
    border-bottom: 1px solid var(--surface0);
    padding: .45rem .6rem;
    text-align: left;
}

th {
    color: var(--subtext0);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

tbody tr:hover {
    background: var(--mantle);
}

.tabs {
    border-bottom: 1px solid var(--surface0);
    display: flex;
    gap: .25rem;
    margin-bottom: 1rem;
}

.tabs a {
    border-bottom: 2px solid transparent;
    color: var(--subtext0);
    padding: .4rem .7rem;
}

.tabs a.active {
    border-bottom-color: var(--mauve);
    color: var(--text);
}

.tabs a:hover {
    text-decoration: none;
    color: var(--text);
}

.split {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
}

.card {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 8px;
    padding: .75rem 1rem;
}

.card h3 {
    font-size: 15px;
    margin: 0 0 .25rem;
}

.cards {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr));
}

.prose :first-child {
    margin-top: 0;
}

.prose pre {
    background: var(--crust);
    border-radius: 6px;
    overflow-x: auto;
    padding: .6rem;
}

.prose code {
    background: var(--crust);
    border-radius: 4px;
    padding: .1rem .3rem;
}

textarea {
    font-family: ui-monospace, monospace;
    min-height: 22rem;
    resize: vertical;
    width: 100%;
}

.badge {
    background: var(--surface0);
    border-radius: 4px;
    color: var(--subtext0);
    font-size: 11px;
    padding: .1rem .35rem;
}

.badge.ai {
    background: color-mix(in srgb, var(--mauve) 25%, var(--surface0));
    color: var(--mauve);
}

.status.ok {
    color: var(--green);
}

.status.error {
    color: var(--red);
}

.status.running {
    color: var(--yellow);
}

form.inline {
    display: contents;
}

.login {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

body.plain {
    display: block;
}

.ghost-link {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 6px;
    color: var(--text);
    padding: .35rem .5rem;
}

.ghost-link:hover {
    background: var(--surface1);
    text-decoration: none;
}

.card input,
.card select,
.card textarea {
    margin-top: .4rem;
    width: 100%;
}

.card .row input,
.card .row select,
.card .row button {
    margin-top: 0;
    width: auto;
}
