:root {
    color-scheme: light dark;
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    box-sizing: border-box;
}

.card {
    width: min(100%, 24rem);
    display: grid;
    gap: 0.75rem;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
}

form {
    display: grid;
    gap: 0.5rem;
}

input,
button {
    font: inherit;
    padding: 0.6rem 0.8rem;
    border-radius: 0.5rem;
}

button {
    cursor: pointer;
}

.notice {
    color: #2e7d32;
}

.error {
    color: #c62828;
}

.card.wide {
    width: min(100%, 32rem);
}

section {
    display: grid;
    gap: 0.5rem;
}

.devices {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.devices li {
    display: grid;
    gap: 0.25rem;
    padding: 0.75rem;
    border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
    border-radius: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    margin-left: 0.25rem;
    border-radius: 0.25rem;
    background: color-mix(in srgb, currentColor 12%, transparent);
}

.muted {
    opacity: 0.7;
}

.warning {
    color: #b26a00;
}

button.danger {
    color: #c62828;
    justify-self: start;
}

/* Ledger pages */
body:has(.page) {
    place-items: start center;
}

.page {
    width: min(100%, 60rem);
    display: grid;
    gap: 1rem;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

form.inline,
.inline {
    display: inline;
}

button.link {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    text-decoration: underline;
}

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

a.button {
    padding: 0.6rem 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    text-decoration: none;
}

.filters,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

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

th,
td {
    text-align: left;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    vertical-align: top;
}

td small,
h1 small {
    display: block;
}

.row-actions {
    display: grid;
    gap: 0.35rem;
}

fieldset {
    border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
    border-radius: 0.5rem;
    display: grid;
    gap: 0.6rem;
}

.stacked label,
.grid label {
    display: grid;
    gap: 0.25rem;
}

.stacked label.check,
label.check {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.6rem;
}

.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

select,
textarea {
    font: inherit;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
}

.panel {
    display: grid;
    gap: 0.75rem;
}

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
}

.facts dt {
    opacity: 0.7;
}

.facts dd {
    margin: 0;
}

.pre {
    white-space: pre-wrap;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.changes details {
    border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    padding: 0.5rem 0;
}

.changes summary {
    cursor: pointer;
}

h2 {
    margin: 0.5rem 0 0;
    font-size: 1.2rem;
}

h3 {
    margin: 0.25rem 0;
    font-size: 1rem;
}

.table-scroll {
    overflow-x: auto;
}

td.number,
th.number {
    text-align: right;
    white-space: nowrap;
}

tfoot th {
    border-top: 2px solid color-mix(in srgb, currentColor 25%, transparent);
}

.inline-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.warning-panel {
    border: 1px solid #b26a00;
    border-radius: 0.5rem;
    padding: 0.75rem;
}
