/* Dojomon's own layer on top of Pico: denser type and spacing, plus a few
   components (page header, badges, stat cards, panels, compact tables). */

/* Pico scales the root font up to ~131% on wide screens; keep it steady. */
:root {
    --pico-font-size: 93.75%;
    --pico-spacing: 0.875rem;
    --pico-form-element-spacing-vertical: 0.5rem;
    --pico-form-element-spacing-horizontal: 0.75rem;
}

main.container, nav.topnav.container { max-width: 1100px; }
main.container { padding-top: 1.25rem; }
h1 { font-size: 1.6rem; margin-bottom: 0; }
h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }

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

/* ---- Top nav, shown to everyone signed in. */
nav.topnav {
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-block: 0.6rem;
}
nav.topnav .brand { font-weight: 700; }
nav.topnav li.muted { font-size: 0.85rem; }

/* ---- Login landing page. */
.login-card { max-width: 22rem; margin: 3.5rem auto 0; text-align: center; }
.login-card h1 { margin-bottom: 0.3rem; }
.login-card p.muted { margin-bottom: 1.25rem; }
.login-card [role="alert"] { margin-bottom: 1rem; }
.login-card [role="button"] { width: 100%; }

/* ---- Page header: title + role badge on the left, actions on the right. */
.page-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.75rem; margin-bottom: 1.25rem;
}
.page-head .title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.page-head .actions a[role="button"] { padding: 0.35rem 0.8rem; font-size: 0.85rem; }

.badge {
    display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; text-transform: capitalize;
    background: var(--pico-secondary-background); color: var(--pico-secondary-inverse);
}
.badge.primary { background: var(--pico-primary-background); color: var(--pico-primary-inverse); }

/* ---- Stat cards. */
.stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem; margin-bottom: 1.25rem;
}
.stat {
    border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
    padding: 0.7rem 0.9rem; background: var(--pico-card-background-color);
}
.stat .label {
    display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--pico-muted-color);
}
.stat .value { display: block; font-size: 1.45rem; font-weight: 700; line-height: 1.25; }
.stat .sub { display: block; font-size: 0.8rem; color: var(--pico-muted-color); }

/* ---- Panels: side by side on wide screens. */
.panels { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .panels { grid-template-columns: 3fr 2fr; } }

/* ---- Panels: always stacked, each full width (e.g. wide tables that
   need the room rather than sharing it with a neighbour). */
.panels-stacked { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.panel {
    border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
    padding: 0.9rem 1rem; background: var(--pico-card-background-color); min-width: 0;
}
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.panel > header h2 { margin: 0 0 0.6rem; }
.panel p:last-child, .panel table:last-child { margin-bottom: 0; }

/* ---- Compact tables, optionally in a scroll box. */
table.compact { font-size: 0.875rem; margin-bottom: 0; }
table.compact th, table.compact td { padding: 0.35rem 0.5rem; }
table.compact th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--pico-muted-color); }
table.compact td.num, table.compact th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.compact small { display: block; color: var(--pico-muted-color); }
.scroll { max-height: 22rem; overflow-y: auto; }
.scroll thead th { position: sticky; top: 0; background: var(--pico-card-background-color); }

/* ---- One-row form: inputs and button on a line. */
form.inline-form { display: grid; grid-template-columns: 1fr 6rem auto; gap: 0.5rem; margin-bottom: 0.75rem; }
form.inline-form > * { margin: 0; }
form.inline-form button { padding-inline: 1rem; }

/* ---- Graduation timeline. */
ol.timeline { list-style: none; padding: 0; margin: 0; }
ol.timeline li {
    display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.35rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color); font-size: 0.9rem;
}
ol.timeline li:last-child { border-bottom: 0; }
ol.timeline li:first-child strong::after { content: " · current"; font-weight: 400; color: var(--pico-muted-color); font-size: 0.8rem; }

details.panel summary { font-weight: 600; }
details.panel[open] summary { margin-bottom: 0.6rem; }
p[role="alert"] { color: var(--pico-del-color); font-size: 0.9rem; margin-bottom: 0.5rem; }

/* ---- Avatars and person links. */
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    border-radius: 50%; object-fit: cover; overflow: hidden;
    background: var(--pico-primary-background); color: var(--pico-primary-inverse);
    font-weight: 600; text-transform: uppercase;
}
.avatar.sm { width: 1.9rem; height: 1.9rem; font-size: 0.75rem; }
.avatar.lg { width: 6rem; height: 6rem; font-size: 2rem; }
a.person { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; }
a.person span { line-height: 1.2; }
a.person small { display: block; font-size: 0.75rem; color: var(--pico-muted-color); }

/* ---- Profile page. */
.profile-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* ---- Session import preview. */
.hint { font-size: 0.85rem; }
h3.import-sub { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
tr.problem td { color: var(--pico-del-color); }
label.add-kohai { display: block; margin: 0.25rem 0 0; font-size: 0.85rem; }
label.add-kohai input { margin-bottom: 0; }

/* ---- Members page. */
form.compact-form { margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
form.inline-form.names { grid-template-columns: 1fr 1fr auto; }
form.compact-form select, form.compact-form button, form.compact-form input[type="date"] { margin: 0; padding: 0.15rem 0.5rem; font-size: 0.8rem; width: auto; }
form.compact-form label { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; font-size: 0.8rem; white-space: nowrap; }
form.compact-form label input[type="checkbox"] { margin: 0; }
button.small-button { padding: 0.15rem 0.6rem; font-size: 0.8rem; margin: 0; }

/* ---- Rank ladder: a row of tight icon buttons per Rank. */
.rank-actions { display: flex; gap: 0.3rem; justify-content: flex-end; }
.rank-actions form { margin: 0; }
.rank-actions button { width: 1.8rem; line-height: 1; }
