/*
 * Deliberately hand-written and small — no CSS framework. The whole app is one board and a sign-in
 * page; a framework would be more bytes than the app.
 *
 * Dark-first, because this sits next to a terminal and a Telegram chat.
 */

:root {
    color-scheme: dark;
    --bg: #14161a;
    --surface: #1c1f26;
    --surface-2: #232733;
    --line: #2f3542;
    --text: #e7eaf0;
    --muted: #949cad;
    --accent: #5b8def;
    --danger: #e5534b;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1 { font-size: 1.35rem; margin: 0 0 .25rem; }

.muted { color: var(--muted); }
.error { color: var(--danger); }

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

/* --- chrome --- */

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

.brand { font-weight: 600; letter-spacing: .01em; }

.signout { margin: 0; }

button {
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .35rem .7rem;
    cursor: pointer;
}

button:hover { border-color: var(--accent); }

main { padding: 1rem; }

/* --- sign-in --- */

.login {
    max-width: 26rem;
    margin: 12vh auto;
    text-align: center;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.qr-wrap { min-height: 260px; display: grid; place-content: center; }

/* White quiet zone: scanners want light-on-dark contrast, and the PNG itself is transparent. */
.qr-wrap img {
    background: #fff;
    padding: 10px;
    border-radius: var(--radius);
    display: block;
}

.tg-button {
    display: inline-block;
    margin-top: .75rem;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 500;
}

/* --- board --- */

.board-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filters { display: flex; gap: .35rem; flex-wrap: wrap; }

.chip {
    padding: .15rem .55rem;
    font-size: .8rem;
    border-radius: 999px;
    color: var(--muted);
}
.chip.on { color: var(--text); border-color: var(--accent); background: var(--surface-2); }

/* Six lanes side by side; scrolls horizontally rather than squeezing them illegibly. */
.lanes {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 1fr);
    gap: .6rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    align-items: start;
}

.lane {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .5rem;
    min-height: 8rem;
}
/* The drop target must be visible while dragging, or you are aiming blind. */
.lane.over { border-color: var(--accent); background: var(--surface-2); }

.lane > header {
    display: flex;
    justify-content: space-between;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    padding: .1rem .2rem .5rem;
}
.count { color: var(--muted); }

.card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .5rem .6rem;
    margin-bottom: .4rem;
    cursor: grab;
}
.card:hover { border-color: var(--accent); }
.card.dragging { opacity: .4; cursor: grabbing; }

.card-title { margin-bottom: .3rem; }

.card-meta { display: flex; gap: .35rem; flex-wrap: wrap; font-size: .72rem; color: var(--muted); }
.card-meta > * { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; }
.short { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* --- card detail --- */

.scrim { position: fixed; inset: 0; background: #0009; }

.detail {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(34rem, 100vw);
    overflow-y: auto;
    padding: 1rem 1.2rem 3rem;
    background: var(--surface);
    border-left: 1px solid var(--line);
}

.detail > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.detail h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.4rem 0 .4rem; }

.lane-tag { margin-left: .4rem; font-size: .72rem; color: var(--muted); }
.icon { border: none; background: none; font-size: 1rem; }

.field { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .6rem; flex: 1; }
.field > span { font-size: .75rem; color: var(--muted); }

input, select, textarea {
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .35rem .5rem;
    width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.row { display: flex; gap: .6rem; align-items: end; }
.small { font-size: .78rem; }

.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; padding: .5rem; }

.plan, .log {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .6rem;
    font-size: .8rem;
    max-height: 22rem;
    overflow: auto;
}

.runs, .comments { list-style: none; margin: 0; padding: 0; }
.runs > li, .comments > li {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .45rem .55rem;
    margin-bottom: .4rem;
    background: var(--surface-2);
}

.outcome { font-size: .72rem; padding: 0 .3rem; border-radius: 4px; margin-right: .4rem; }
.outcome.succeeded { background: #1f5e3a; }
.outcome.failed { background: #6b2320; }
.outcome.usagelimit { background: #5c4a17; }

.reason { margin-top: .3rem; font-size: .82rem; }
