:root {
    --frame: #0a0b0d;
    --bg: #101114;
    --surface: #17191c;
    --elevated: #23252a;
    --line: #37393f;
    --line-strong: #4f5259;
    --fg: #edeff3;
    --body: #b2b6bd;
    --muted: #8f9299;
    --faint: #44464b;
    --icon: #788991;
    --interactive: #e93f59;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background: var(--frame);
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--body);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--fg);
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--interactive);
    outline-offset: 2px;
}

h2,
h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--fg);
}

code {
    color: var(--fg);
    font-family: inherit;
    overflow-wrap: anywhere;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.brand {
    color: var(--fg);
    font-weight: 700;
    white-space: nowrap;
}

.who {
    min-width: 0;
    margin-left: auto;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mark {
    color: var(--icon);
}

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

.label {
    display: block;
    font-size: 12px;
}

.tabs {
    position: sticky;
    top: 46px;
    z-index: 1;
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.tabs button {
    flex: none;
    padding: 10px 16px;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 2px solid transparent;
    color: var(--muted);
}

.tabs button[aria-selected="true"] {
    border-bottom-color: var(--interactive);
    background: var(--surface);
    color: var(--fg);
}

.tab-panel[hidden] {
    display: none;
}

main {
    max-width: 1100px;
    margin: 0 auto;
}

section {
    border-bottom: 1px solid var(--line);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.stats > div {
    padding: 16px;
    border-right: 1px solid var(--line);
}

.stats > div:last-child {
    border-right: 0;
}

.stats strong {
    display: block;
    font-size: 22px;
    color: var(--fg);
}

.section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.section-head h2 {
    flex: 1;
}

button {
    padding: 4px 10px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--fg);
    font: inherit;
    cursor: pointer;
}

button:hover {
    background: var(--elevated);
}

button:disabled {
    color: var(--faint);
    cursor: wait;
}

.rows {
    margin: 0;
    padding: 0;
    list-style: none;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
}

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

.grow {
    flex: 1;
    min-width: 160px;
    color: var(--fg);
}

.dot {
    flex: none;
    width: 8px;
    height: 8px;
    border: 1px solid var(--fg);
    border-radius: 50%;
}

.dot.up {
    background: var(--fg);
}

.dot.down {
    border-color: var(--interactive);
    background: var(--interactive);
}

.code {
    min-width: 3ch;
    color: var(--fg);
}

.card {
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.card:last-child {
    border-bottom: 0;
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin-bottom: 8px;
}

.meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 16px;
    margin: 0 0 12px;
}

.meta dd {
    margin: 0;
    color: var(--body);
}

.cmds {
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    list-style: none;
}

.cmd {
    display: grid;
    grid-template-columns: minmax(0, 160px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
}

.cmd:last-child {
    border-bottom: 0;
}

.pend {
    align-items: flex-start;
}

.pend input {
    margin-top: 4px;
    accent-color: var(--interactive);
}

.pend .text {
    flex: 1;
    min-width: 240px;
}

.pend.done .text {
    color: var(--faint);
    text-decoration: line-through;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

input {
    flex: 1;
    min-width: 160px;
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--fg);
    font: inherit;
}

.action-bar select {
    flex: 1;
    min-width: 160px;
}

select {
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--fg);
    font: inherit;
}

.pad {
    margin: 0;
    padding: 0 16px 12px;
    min-height: 1.5em;
}

.tag {
    padding: 0 6px;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.tag.alta {
    border-color: var(--interactive);
    color: var(--interactive);
}

@media (max-width: 640px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats > div:nth-child(2) {
        border-right: 0;
    }

    .stats > div:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .cmd {
        grid-template-columns: 1fr auto;
    }

    .cmd code {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .who {
        display: none;
    }
}

.subtabs {
    position: static;
    background: var(--surface);
}

.subtabs button {
    padding: 8px 14px;
    font-size: 13px;
}

button.danger {
    border-color: var(--interactive);
    color: var(--interactive);
}

button.primary {
    background: var(--fg);
    color: var(--bg);
}

button.primary:disabled {
    background: transparent;
    color: var(--faint);
    cursor: not-allowed;
}

.row select {
    flex: none;
    min-width: 0;
}

input.compact {
    flex: 0 1 240px;
    min-width: 120px;
}

.client {
    border-bottom: 1px solid var(--line);
}

.client > .row {
    border-bottom: 0;
}

.nested {
    margin: 0 16px 12px;
    border: 1px solid var(--line);
}

.nested .row {
    padding: 8px 12px;
}

.license code {
    color: var(--fg);
}

dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 20px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--body);
}

dialog::backdrop {
    background: rgb(0 0 0 / 0.6);
}

dialog p {
    margin: 0 0 12px;
    color: var(--fg);
}

dialog input {
    width: 100%;
    margin-top: 4px;
}

dialog [hidden] {
    display: none;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.notice {
    margin: 12px 0 0;
    border-left: 2px solid var(--interactive);
    padding-left: 14px;
}

.topbar {
    padding-inline: max(16px, calc((100% - 1100px) / 2));
}

.tabs[data-group="main"] {
    padding-inline: max(0px, calc((100% - 1100px) / 2));
}

.tabs[data-group="main"] button:first-child {
    border-left: 1px solid var(--line);
}

main {
    border-inline: 1px solid var(--line);
}

@media (max-width: 1100px) {
    main {
        border-inline: 0;
    }

    .tabs[data-group="main"] button:first-child {
        border-left: 0;
    }
}

.delivery {
    margin: 0 16px 12px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
}

.delivery-text {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--fg);
    font: inherit;
    resize: vertical;
}
