:root {
    color-scheme: light;
    font-family: system-ui, sans-serif;
    color: #242333;
    background: #f4f3f8;
    --muted: #555466;
    --accent: #5040aa;
    --accent-light: #ece9fb;
    --line: #dddce7;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
p { margin: .4rem 0 1rem; line-height: 1.5; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); letter-spacing: -.045em; }
h2 { font-size: 1.22rem; letter-spacing: -.02em; margin-bottom: .75rem; }
h3 { font-size: 1rem; }

.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
aside {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    padding: 1.75rem 1.15rem;
    background: #fff;
    border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: .55rem;
    background: var(--accent);
    color: #fff;
    font-weight: 750;
}
.sidebar-label { color: var(--muted); font-size: .85rem; margin: .65rem 0 1.5rem; }
nav { display: grid; gap: .3rem; }
nav a { border-radius: .55rem; padding: .72rem .8rem; color: #38364a; text-decoration: none; }
nav a:hover, nav a[aria-current] { background: var(--accent-light); color: #3e318c; }
nav a[aria-current] { font-weight: 650; }
.sign-out { margin-top: auto; padding-top: 1rem; }

.content { width: 100%; max-width: 92rem; min-width: 0; padding: 2.5rem clamp(1rem, 4vw, 3rem); }
header { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; align-items: end; margin-bottom: 1.5rem; }
header p { margin-bottom: 0; color: var(--muted); }
.grid, .metrics { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
.card {
    min-width: 0;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: .9rem;
    margin-bottom: 1rem;
}
.grid .card { margin-bottom: 0; }
.card > :last-child { margin-bottom: 0; }
.metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.metric { padding: 1rem 1.15rem; border: 1px solid #ded9f3; border-radius: .8rem; background: #f9f7ff; }
.metric span { display: block; color: #554f68; font-size: .88rem; margin-bottom: .4rem; }
.metric strong { font-size: 1.4rem; color: #332577; font-variant-numeric: tabular-nums; }
.muted, .meta { color: var(--muted); }
.meta { font-size: .88rem; }
.record { overflow-wrap: anywhere; white-space: pre-wrap; }

form { margin: 0; }
.group, .period, .editor { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; }
.period { margin-bottom: 1rem; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .88rem; max-width: 100%; color: #3d3a50; }
input, select, textarea, button {
    font: inherit;
    border: 1px solid #bbb9cc;
    border-radius: .47rem;
    min-height: 2.5rem;
    min-width: 0;
    padding: .5rem .7rem;
    background: #fff;
    color: #242333;
}
textarea { resize: vertical; }
input[type="time"], input[type="date"] { min-width: 7rem; }
button { border-color: var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-size: .88rem; font-weight: 650; }
button:hover { filter: brightness(.9); }
button.secondary { border-color: #c7c1e3; background: #fff; color: #3e318c; }
button.danger { border-color: #e2b4ba; background: #fff; color: #922d3c; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 1rem 0; border-top: 1px solid var(--line); }
.entry:last-child { padding-bottom: 0; }
.entry .editor { display: inline-flex; margin: .25rem .65rem .1rem 0; }
.entries + .editor { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.roles { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 0 0 1rem; }
.roles dt { color: var(--muted); font-size: .88rem; margin-bottom: .25rem; }
.roles dd { font-weight: 650; margin: 0; }
.alert { border-radius: .55rem; padding: .75rem 1rem; background: #e4f4ec; color: #155237; }
.alert.error { background: #f9e7ea; color: #8c2638; }
.scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { padding: .65rem .65rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: #48435e; background: #f6f5fb; }
tr:last-child td { border-bottom: 0; }
.standalone { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login { width: min(100%, 29rem); }
.login .brand { margin-bottom: 1.4rem; }
.login h1 { margin-bottom: .75rem; }
.login form { display: grid; gap: .85rem; }
.login button { justify-self: start; min-width: 6rem; }

@media (max-width: 50rem) {
    .shell { display: block; }
    aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 1rem; }
    nav { display: flex; flex-wrap: wrap; }
    .sidebar-label { margin: .45rem 0 .65rem; }
    .content { padding-top: 1.4rem; }
}
@media (max-width: 36rem) {
    .grid { grid-template-columns: minmax(0, 1fr); }
}
