:root {
    --bg: #0f1115;
    --card: #1a1d24;
    --text: #e9ebf0;
    --muted: #9aa1ac;
    --primary: #2f7dea;
    --danger: #d64545;
    --warn: #d69a2d;
    --ok: #2fa85a;
    --border: #2a2e37;
}

* {
    box-sizing: border-box
}

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

.topbar {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem
}

main {
    max-width: 640px;
    margin: 0 auto;
    padding: .75rem
}

h1 {
    font-size: 1.2rem;
    margin: .2rem 0
}

h2 {
    font-size: 1.05rem;
    margin: .4rem 0
}

.inline-h2 {
    display: inline
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: .9rem
}

.sticky-info {
    position: sticky;
    top: 52px;
    z-index: 5
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem
}

.stack {
    display: flex;
    flex-direction: column;
    gap: .6rem
}

label {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .85rem;
    color: var(--muted)
}

input, textarea {
    background: #0f1115;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: .55rem;
    font-size: 1rem;
    width: 100%
}

.team-field {
    margin-top: .6rem
}

.muted {
    color: var(--muted)
}

.small {
    font-size: .8rem
}

.sheet-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: .2rem .8rem;
    margin: .4rem 0
}

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    background: #232733;
    color: var(--text);
    border-radius: 9px;
    padding: .6rem .9rem;
    font-size: .95rem;
    text-decoration: none;
    cursor: pointer
}

.btn-small {
    padding: .4rem .65rem;
    font-size: .82rem
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff
}

.btn-warn {
    background: var(--warn);
    border-color: var(--warn);
    color: #1a1200
}

.btn-reveal {
    width: 100%;
    background: #232733
}

.btn-option {
    background: #232733
}

.btn-selected {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff
}

.patient-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.patient-header > h1 {
    margin: 0;
}

.patient-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
}

.patient-actions form {
    margin: 0;
}

.inline-form {
    display: inline
}

.item-grid {
    display: grid;
    grid-template-columns:1fr;
    gap: .6rem;
    margin-top: .6rem
}

.item-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .7rem;
    background: #141822
}

.item-card.revealed {
    border-color: #33424f
}

.item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600
}

.item-check {
    color: var(--ok)
}

.item-hint {
    margin-bottom: .5rem
}

.option-row {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem
}

.item-meta {
    margin-top: .4rem
}

.patient-list {
    list-style: none;
    padding: 0;
    margin: .6rem 0 0
}

.patient-item {
    border-top: 1px solid var(--border);
    padding: .7rem 0;
    display: grid;
    grid-template-columns:1fr auto;
    gap: .4rem .8rem;
    align-items: center
}

.patient-main {
    grid-column: 1
}

.patient-label {
    color: var(--text);
    font-weight: 600;
    text-decoration: none
}

.patient-actions {
    grid-column: 1/-1;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .3rem
}

.qr-preview {
    grid-row: 1/3;
    grid-column: 2
}

.qr-preview img {
    border-radius: 8px;
    background: #fff;
    padding: 4px
}

.badge {
    display: inline-block;
    background: #2a2e37;
    border-radius: 6px;
    padding: .1rem .5rem;
    font-size: .75rem;
    margin-left: .4rem
}

.history-list {
    list-style: none;
    padding: 0;
    margin: .6rem 0 0
}

.history-item {
    border-top: 1px solid var(--border);
    padding: .6rem 0
}

.history-value {
    margin-top: .15rem
}

details.card summary {
    cursor: pointer
}

details.card[open] summary {
    margin-bottom: .4rem
}

\n.solution {
    margin-top: .55rem;
    padding: .65rem;
    border-radius: 8px;
    background: #202a24;
    border: 1px solid #334f3d
}

\ncode {
    font-size: .9em
}

\n.form-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: .6rem
}

select {
    background: #0f1115;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: .55rem;
    font-size: 1rem;
    width: 100%
}

@media (max-width: 560px) {
    .form-grid {
        grid-template-columns:1fr
    }

    .row-between {
        align-items: stretch;
        flex-direction: column
    }

    .patient-item {
        grid-template-columns:1fr
    }

    .qr-preview {
        display: none
    }
}
