/* ==========================================================================
   BagiKelompok — design system
   Direction: printed document. Warm paper, ink, one vermilion accent.
   Rules instead of boxes. Cards only where content is truly discrete.
   ========================================================================== */

:root {
    /* Surfaces */
    --paper: #f7f4ed;
    --paper-2: #efeade;
    --paper-3: #e7e1d2;
    --card: #fffdf8;

    /* Ink */
    --ink: #16181c;
    --ink-soft: #40454d;
    --muted: #5f656d;
    --faint: #7c838c;

    /* Lines */
    --rule: #d9d2c3;
    --rule-strong: #b8b0a0;

    /* Accent — vermilion, used sparingly */
    --accent: #b23a1e;
    --accent-dark: #8f2c14;
    --accent-soft: #f6e7e0;

    /* Semantic */
    --ok: #2f6047;
    --ok-soft: #e3ece5;
    --warn: #8a5a12;
    --warn-soft: #f6ecd9;
    --danger: #9d2b22;
    --danger-soft: #f7e5e3;

    /* Type */
    --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --sans: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --max: 1180px;
    --gutter: 2rem;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.62;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

main {
    flex: 1;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote,
dl,
dd {
    margin: 0;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

table {
    border-collapse: collapse;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--accent);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Type
   -------------------------------------------------------------------------- */

.display,
.display-sm {
    font-family: var(--serif);
    font-weight: 400;
    letter-spacing: -0.021em;
    line-height: 1.04;
    text-wrap: balance;
}

.display {
    font-size: clamp(2.7rem, 5.6vw, 4.1rem);
}

.display-sm {
    font-size: clamp(1.9rem, 3.6vw, 2.7rem);
    line-height: 1.1;
}

.display em {
    font-style: italic;
    color: var(--accent);
}

h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.55rem, 2.8vw, 2.05rem);
    line-height: 1.16;
    letter-spacing: -0.018em;
    text-wrap: balance;
}

h3 {
    font-family: var(--sans);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.006em;
}

.lead {
    max-width: 34rem;
    font-size: 1.06rem;
    line-height: 1.62;
    color: var(--ink-soft);
}

/* Mono metadata: the voice of specs, counts, dates */
.mono,
.kicker,
.spec,
.meta {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.kicker {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.kicker::before {
    content: "";
    width: 1.75rem;
    height: 1px;
    background: var(--accent);
    flex: none;
}

.eyebrow {
    display: block;
    margin-bottom: 0.7rem;
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.eyebrow-dot {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    min-height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: none;
}

.brand-mark {
    width: 34px;
    height: 34px;
    flex: none;
}

.brand-name {
    font-family: var(--serif);
    font-size: 1.12rem;
    font-weight: 500;
    letter-spacing: -0.014em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    margin-left: auto;
}

.nav-links a {
    position: relative;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink-soft);
    padding-block: 0.25rem;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 1px;
    background: var(--ink);
    transition: right 0.18s ease;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-links a:hover::after {
    right: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* --------------------------------------------------------------------------
   Buttons — rectangular, ruled, no pills, no gradients
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.62rem 1.05rem;
    border: 1.5px solid var(--ink);
    border-radius: 2px;
    background: transparent;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn svg {
    width: 15px;
    height: 15px;
    flex: none;
}

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

.btn.primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.btn.secondary {
    background: var(--card);
    border-color: var(--rule-strong);
    color: var(--ink);
}

.btn.secondary:hover {
    border-color: var(--ink);
}

.btn.ghost {
    border-color: var(--rule-strong);
    color: var(--ink-soft);
}

.btn.ghost:hover {
    border-color: var(--ink);
    color: var(--ink);
}

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

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

.btn.white {
    border-color: var(--paper);
    background: var(--paper);
    color: var(--ink);
}

.btn.white:hover {
    background: transparent;
    color: var(--paper);
}

.btn.on-ink {
    border-color: rgba(247, 244, 237, 0.4);
    color: var(--paper);
}

.btn.on-ink:hover {
    border-color: var(--paper);
    background: var(--paper);
    color: var(--ink);
}

.btn.small {
    padding: 0.38rem 0.7rem;
    font-size: 0.84rem;
}

.btn.large {
    padding: 0.85rem 1.5rem;
    font-size: 0.96rem;
}

.btn.is-copied {
    border-color: var(--ok);
    color: var(--ok);
}

/* Text-only actions */
.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-size: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.link-button:hover {
    color: var(--accent-dark);
}

/* --------------------------------------------------------------------------
   Flash
   -------------------------------------------------------------------------- */

.flash-wrap {
    margin-top: 1.2rem;
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    border-left: 3px solid var(--ok);
    background: var(--ok-soft);
    font-size: 0.94rem;
    color: var(--ok);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.flash.is-hiding {
    opacity: 0;
    transform: translateY(-4px);
}

.flash p {
    flex: 1;
    color: var(--ink-soft);
}

.flash-icon {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 0.1rem;
    color: var(--ok);
}

.flash-icon svg {
    width: 16px;
    height: 16px;
}

.flash-close {
    border: 0;
    background: none;
    padding: 0 0.2rem;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--muted);
}

.flash-close:hover {
    color: var(--ink);
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--rule-strong);
    background: var(--paper-2);
    font-size: 0.94rem;
    color: var(--ink-soft);
}

.alert strong {
    color: var(--ink);
}

.alert ul {
    margin-top: 0.35rem;
    display: grid;
    gap: 0.15rem;
}

.alert li {
    padding-left: 1rem;
    position: relative;
}

.alert li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--faint);
}

.alert.error {
    border-left-color: var(--danger);
    background: var(--danger-soft);
}

.alert.success {
    border-left-color: var(--ok);
    background: var(--ok-soft);
}

.alert.info {
    border-left-color: var(--accent);
    background: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   Badges and chips
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    background: transparent;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
    white-space: nowrap;
}

.badge-normal {
    border-color: var(--ink);
    color: var(--ink);
}

.badge-gender {
    border-color: #b57a95;
    color: #7c3555;
}

.badge-skill {
    border-color: #7d9a6c;
    color: #3f6045;
}

.badge-admin {
    border-color: var(--accent);
    color: var(--accent);
}

.badge-provider {
    border-color: var(--rule);
    color: var(--muted);
    letter-spacing: 0.06em;
}

.badge-pending {
    border-color: #c98b84;
    color: var(--danger);
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    flex: none;
    padding: 0.09rem 0.35rem;
    border: 1px solid var(--rule);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--muted);
    white-space: nowrap;
}

.chip-pink {
    border-color: #d9bcc8;
    color: #7c3555;
}

.chip-blue {
    border-color: var(--rule-strong);
    color: var(--ink-soft);
}

.chip-level {
    border-color: #a8bda0;
    color: #3f6045;
}

.count-pill {
    display: inline-grid;
    place-items: center;
    min-width: 1.5rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--ink-soft);
    vertical-align: 0.12em;
}

/* --------------------------------------------------------------------------
   Home — hero
   -------------------------------------------------------------------------- */

.hero {
    padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4rem);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
}

.hero-copy {
    display: grid;
    align-content: start;
}

.hero-copy .kicker {
    margin-bottom: 1.6rem;
}

.hero-copy .display {
    margin-bottom: 1.4rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 2.1rem;
}

.hero-facts {
    display: grid;
    gap: 0;
    margin-top: 2.6rem;
    border-top: 1px solid var(--rule);
}

.hero-facts div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--rule);
}

.hero-facts dt {
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.hero-facts dd {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--ink);
    text-align: right;
}

/* Specimen: a real output sample, not a fake browser window */
.specimen {
    border: 1px solid var(--rule-strong);
    background: var(--card);
}

.specimen-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--rule);
}

.specimen-bar .mono {
    font-size: 0.72rem;
}

.specimen-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.specimen-group {
    padding: 0.9rem;
    border-right: 1px solid var(--rule);
}

.specimen-group:last-child {
    border-right: 0;
}

.specimen-group > header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.45rem;
    border-bottom: 2px solid var(--g);
}

.specimen-group h3 {
    font-family: var(--serif);
    font-size: 1rem;
    font-weight: 500;
}

.specimen-group header .mono {
    font-size: 0.72rem;
    color: var(--g);
}

.specimen-group li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.26rem 0;
    font-size: 0.86rem;
    color: var(--ink-soft);
}

.specimen-group li .mono {
    font-size: 0.72rem;
    color: var(--faint);
}

.specimen-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.9rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.specimen-foot strong {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink);
}

/* --------------------------------------------------------------------------
   Home — modes as a spec sheet
   -------------------------------------------------------------------------- */

.section {
    padding: clamp(2.8rem, 6vw, 4.5rem) 0;
}

.section-alt {
    background: var(--paper-2);
    border-block: 1px solid var(--rule);
}

.section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: end;
    padding-bottom: 1.6rem;
    margin-bottom: 0;
    border-bottom: 2px solid var(--ink);
}

.section-head .eyebrow {
    grid-column: 1 / -1;
    margin-bottom: 0.4rem;
}

.section-head p {
    font-size: 0.96rem;
    color: var(--ink-soft);
}

/* Steps */
.step-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--rule);
}

.step-item {
    padding: 1.5rem 1.6rem 0 0;
    border-right: 1px solid var(--rule);
}

.step-item:last-child {
    border-right: 0;
    padding-right: 0;
}

.step-item:not(:first-child) {
    padding-left: 1.6rem;
}

.step-num {
    display: block;
    margin-bottom: 0.9rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.step-item h3 {
    margin-bottom: 0.35rem;
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 500;
}

.step-item p {
    font-size: 0.94rem;
    color: var(--ink-soft);
}

/* Closing block */
.closing {
    padding: clamp(2.6rem, 5vw, 4rem) 0;
    background: var(--ink);
    color: var(--paper);
}

.closing-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.closing h2 {
    max-width: 24ch;
    color: var(--paper);
}

.closing p {
    max-width: 42ch;
    margin-top: 0.6rem;
    font-size: 0.96rem;
    color: rgba(247, 244, 237, 0.72);
}

.closing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */

.page {
    padding: clamp(2rem, 4vw, 3.2rem) 0 4rem;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding-bottom: 1.3rem;
    margin-bottom: 1.8rem;
    border-bottom: 2px solid var(--ink);
}

.page-heading h1 {
    font-family: var(--serif);
    font-size: clamp(1.75rem, 3.4vw, 2.5rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.page-heading p {
    max-width: 52ch;
    margin-top: 0.45rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field {
    display: grid;
    gap: 0.35rem;
}

.field-label,
.field-label-static {
    display: block;
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--muted);
}

.required-mark {
    color: var(--accent);
}

.text-input,
.textarea,
select.text-input {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    background: var(--card);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--ink);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.text-input::placeholder {
    color: var(--faint);
}

.text-input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink);
}

textarea.text-input {
    resize: vertical;
    min-height: 7rem;
    font-size: 0.96rem;
}

.field-error {
    font-size: 0.84rem;
    color: var(--danger);
}

.field-hint {
    font-size: 0.84rem;
    color: var(--muted);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--ink-soft);
    cursor: pointer;
}

.checkbox-row input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Form builder — setup block
   -------------------------------------------------------------------------- */

.setup-card {
    padding: 1.4rem 0 1.6rem;
    border-bottom: 1px solid var(--rule);
}

.setup-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 2rem;
    align-items: start;
}

.type-field {
    margin: 0;
    padding: 0;
    border: 0;
}

.type-field legend {
    padding: 0;
    margin-bottom: 0.5rem;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--rule-strong);
}

.segment {
    position: relative;
    cursor: pointer;
    border-left: 1px solid var(--rule);
}

.segment:first-child {
    border-left: 0;
}

.segment input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.segment > span {
    display: grid;
    gap: 0.1rem;
    padding: 0.6rem 0.75rem;
    min-height: 3.1rem;
    align-content: center;
    background: var(--card);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.segment strong {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink);
}

.segment small {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.segment:hover > span {
    background: var(--paper-2);
}

.segment input:checked + span {
    background: var(--ink);
}

.segment input:checked + span strong {
    color: var(--paper);
}

.segment input:checked + span small {
    color: rgba(247, 244, 237, 0.62);
}

.segment input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   Form builder — participant and group panels
   -------------------------------------------------------------------------- */

.form-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 2.5rem;
    padding-top: 1.8rem;
}

.panel,
.card.panel {
    border: 0;
    background: none;
    padding: 0;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--ink);
}

.panel-head h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--serif);
    font-size: 1.28rem;
    font-weight: 500;
}

.panel-head p {
    max-width: 40ch;
    margin-top: 0.15rem;
    font-size: 0.87rem;
    color: var(--muted);
}

.rows {
    display: grid;
    gap: 0;
    border-top: 1px solid var(--rule);
}

.rows.is-invalid {
    outline: 2px solid var(--danger);
    outline-offset: 4px;
}

.person-row,
.team-row {
    display: grid;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--rule);
    transition: background-color 0.12s ease;
}

.person-row {
    grid-template-columns: 1.6rem minmax(0, 1fr) auto auto 1.6rem;
}

[data-draw-type="gender"] .person-row,
[data-draw-type="skill"] .person-row {
    grid-template-columns: 1.6rem minmax(0, 1fr) auto 1.6rem;
}

[data-draw-type="normal"] .person-row {
    grid-template-columns: 1.6rem minmax(0, 1fr) 1.6rem;
}

.team-row {
    grid-template-columns: 1.6rem minmax(0, 1fr) 1.6rem;
}

.person-row:focus-within,
.team-row:focus-within {
    background: var(--paper-2);
}

.row-num {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--faint);
    text-align: right;
}

.person-name input,
.team-name input {
    width: 100%;
    padding: 0.38rem 0.4rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0.96rem;
    color: var(--ink);
}

.person-name input::placeholder,
.team-name input::placeholder {
    color: var(--faint);
}

.person-name input:focus,
.team-name input:focus {
    outline: none;
    box-shadow: inset 0 -2px 0 var(--accent);
}

.field-group {
    display: grid;
    gap: 0.15rem;
    justify-items: center;
}

/* Mode decides which per-row control is relevant */
[data-draw-type="normal"] [data-type-field] {
    display: none !important;
}

[data-draw-type="gender"] [data-type-field="skill"],
[data-draw-type="skill"] [data-type-field="gender"] {
    display: none !important;
}

.mini-label {
    display: none;
}

.mini-segmented,
.level-picker {
    display: flex;
    border: 1px solid var(--rule);
    border-radius: 2px;
    overflow: hidden;
}

.mini-option,
.level-option {
    cursor: pointer;
    position: relative;
}

.mini-option input,
.level-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.mini-option span,
.level-option span {
    display: grid;
    place-items: center;
    width: 22px;
    height: 24px;
    border-left: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.76rem;
    color: var(--muted);
    transition: background-color 0.12s ease, color 0.12s ease;
}

.mini-option:first-child span,
.level-option:first-child span {
    border-left: 0;
}

.mini-option span:hover,
.level-option span:hover {
    background: var(--paper-2);
}

.mini-option input:checked + span,
.level-option input:checked + span {
    background: var(--ink);
    color: var(--paper);
}

.mini-option input:focus-visible + span,
.level-option input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--faint);
}

.icon-btn svg {
    width: 13px;
    height: 13px;
}

.icon-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.add-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.9rem;
    padding: 0.45rem 0.75rem;
    border: 1px dashed var(--rule-strong);
    border-radius: 2px;
    background: transparent;
    font-size: 0.89rem;
    font-weight: 500;
    color: var(--ink-soft);
}

.add-row:hover {
    border-style: solid;
    border-color: var(--ink);
    color: var(--ink);
}

.add-row svg {
    width: 13px;
    height: 13px;
}

/* Import panel */
.import-panel {
    padding: 0.9rem;
    margin-bottom: 0.9rem;
    border: 1px solid var(--rule-strong);
    background: var(--paper-2);
}

.import-hint {
    margin: 0.2rem 0 0.5rem;
    font-size: 0.84rem;
    color: var(--muted);
}

.import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

/* Submit bar — ink strip */
.submit-bar,
.card.submit-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    margin-top: 2rem;
    padding: 0.85rem 1.1rem;
    border: 0;
    border-radius: 0;
    background: var(--ink);
    color: var(--paper);
    box-shadow: 0 -8px 24px -18px rgba(22, 24, 28, 0.7);
}

.submit-meta {
    display: grid;
    gap: 0.1rem;
}

.submit-meta strong {
    font-family: var(--mono);
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--paper);
}

.submit-meta span {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(247, 244, 237, 0.6);
}

.submit-meta b {
    color: var(--paper);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Guest banner
   -------------------------------------------------------------------------- */

.guest-banner {
    display: block;
    margin-bottom: 1.6rem;
    padding: 0.75rem 0 0.75rem 0.9rem;
    border-left: 3px solid var(--accent);
    background: transparent;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--ink-soft);
}

.guest-banner strong {
    color: var(--ink);
}

.guest-banner a {
    font-weight: 600;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */

.result-page {
    padding: clamp(2rem, 4vw, 3.2rem) 0 4rem;
}

.result-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding-bottom: 1.2rem;
    margin-bottom: 1.6rem;
    border-bottom: 2px solid var(--ink);
}

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

.result-actions form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
}

.result-heading h1 {
    margin: 0.6rem 0 0.35rem;
    font-family: var(--serif);
    font-size: clamp(1.7rem, 3.6vw, 2.6rem);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -0.022em;
}

.result-meta {
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr));
    gap: 1.15rem;
}

.team-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.95rem 1rem 0.6rem;
    border: 1px solid var(--rule);
    border-top: 3px solid var(--team-accent);
    border-radius: 2px;
    background: var(--card);
}

.team-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.7rem;
}

.team-title {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    min-width: 0;
}

.team-dot {
    display: none;
}

.team-title h2 {
    overflow: hidden;
    font-family: var(--serif);
    font-size: 1.06rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-count {
    flex: none;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.team-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.team-stats .sep {
    opacity: 0.45;
}

.member-list {
    display: grid;
}

.member {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.34rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: 0.92rem;
}

.member:last-child {
    border-bottom: 0;
}

.member-avatar {
    display: none;
}

.member-name {
    min-width: 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
    color: var(--ink-soft);
}

.member-empty {
    padding: 0.6rem 0;
    font-size: 0.89rem;
    font-style: italic;
    color: var(--muted);
}

/* Share tools */
.share-card,
.card.share-card {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.8rem;
    padding: 1.2rem 0 0;
    border: 0;
    border-top: 1px solid var(--ink);
    border-radius: 0;
    background: none;
}

.share-copy h2 {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 500;
}

.share-copy p {
    max-width: 52ch;
    margin-top: 0.2rem;
    font-size: 0.92rem;
    color: var(--muted);
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.copy-row {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}

.copy-row .text-input {
    flex: 1;
    background: var(--paper-2);
    font-family: var(--mono);
    font-size: 0.84rem;
}

.copy-row.compact .text-input {
    padding: 0.42rem 0.55rem;
    font-size: 0.8rem;
}

.copy-row .btn {
    white-space: nowrap;
}


.admin-hint {
    margin-top: 1.6rem;
    font-size: 0.87rem;
    color: var(--muted);
}

.admin-hint a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Dashboard — ledger, not stat cards
   -------------------------------------------------------------------------- */

.ledger {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 2rem;
    border-block: 1px solid var(--rule);
}

.ledger-item {
    padding: 1.05rem 1.2rem;
    border-left: 1px solid var(--rule);
}

.ledger-item:first-child {
    border-left: 0;
    padding-left: 0;
}

.ledger-label {
    display: block;
    margin-bottom: 0.3rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.ledger-value {
    display: block;
    font-family: var(--serif);
    font-size: 1.9rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.ledger-value.is-text {
    font-size: 1.2rem;
    line-height: 1.5;
}

/* Tables */
.data-table-wrap {
    border-top: 2px solid var(--ink);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    font-size: 0.92rem;
}

.data-table thead th {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--paper-2);
}

.data-table .col-actions {
    text-align: right;
}

.table-link {
    font-weight: 600;
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.table-link:hover {
    text-decoration-color: var(--accent);
    color: var(--accent);
}

.table-muted {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.table-actions form {
    margin: 0;
}

.code-inline {
    padding: 0.1rem 0.32rem;
    border: 1px solid var(--rule);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-soft);
}

/* Admin record list */
.record-list {
    display: grid;
    border-top: 1px solid var(--rule);
}

.record-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--rule);
}

.record-list div {
    display: grid;
    gap: 0.05rem;
    min-width: 0;
}

.record-list strong {
    font-size: 0.95rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-list span.mono {
    font-size: 0.76rem;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--muted);
}

/* Search */
.search-bar {
    display: flex;
    gap: 0.45rem;
    margin-bottom: 1.4rem;
}

.search-bar .text-input {
    flex: 1;
}

/* Pagination */
.pagination-wrap {
    margin-top: 1.4rem;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.8rem;
}

.pagination-item {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    color: var(--ink-soft);
}

.pagination-item:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.pagination-item.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pagination-info {
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Manage panel (draw detail)
   -------------------------------------------------------------------------- */

.admin-panel,
.card.admin-panel {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.8rem;
    padding: 0 0 1.1rem;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: none;
}

.admin-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.admin-panel-head h2 {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 500;
}

.admin-panel-head p {
    max-width: 46ch;
    margin-top: 0.15rem;
    font-size: 0.89rem;
    color: var(--muted);
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.admin-actions form {
    margin: 0;
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */

.empty-state,
.card.empty-state {
    display: grid;
    justify-items: start;
    gap: 0.5rem;
    max-width: none;
    margin: 2rem 0;
    padding: 2.4rem 1.8rem;
    border: 1px dashed var(--rule-strong);
    border-radius: 2px;
    background: transparent;
}

.empty-state h1 {
    font-family: var(--serif);
    font-size: 1.55rem;
    font-weight: 400;
    letter-spacing: -0.02em;
}

.empty-state p {
    max-width: 40ch;
    font-size: 0.95rem;
    color: var(--muted);
}

.empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

/* --------------------------------------------------------------------------
   Auth
   -------------------------------------------------------------------------- */

.auth-shell {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
    gap: clamp(2rem, 8vw, 7rem);
    align-items: start;
    padding-top: 1rem;
}

.auth-aside {
    max-width: 28rem;
    padding-top: 0.4rem;
}

.auth-aside .display-sm {
    margin-bottom: 1rem;
}

.auth-aside p {
    font-size: 0.96rem;
    color: var(--ink-soft);
}

.auth-aside-rules {
    display: grid;
    margin-top: 2rem;
    border-top: 1px solid var(--rule);
}

.auth-aside-rules li {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.auth-aside-rules span {
    flex: none;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--faint);
}

.auth-card,
.card.auth-card {
    padding: 0;
    border: 0;
    border-top: 3px solid var(--ink);
    border-radius: 0;
    background: none;
}

.auth-head {
    padding: 1.1rem 0 1.3rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 1.3rem;
}

.auth-head h1 {
    font-family: var(--serif);
    font-size: 1.85rem;
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.022em;
}

.auth-head p {
    margin-top: 0.45rem;
    font-size: 0.94rem;
    color: var(--ink-soft);
}

.auth-card form {
    display: grid;
    gap: 0.95rem;
}

.auth-submit {
    width: 100%;
    margin-top: 0.2rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 1.15rem 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faint);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rule);
}

.google-btn {
    width: 100%;
    justify-content: center;
    border-color: var(--rule-strong);
    background: var(--card);
    color: var(--ink);
}

.google-btn:hover {
    border-color: var(--ink);
    background: var(--card);
}

.google-btn svg {
    width: 16px;
    height: 16px;
}

.auth-alt {
    display: grid;
    gap: 0.3rem;
    margin-top: 1.3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-alt a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-foot {
    margin-top: 1.4rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-foot a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   User menu
   -------------------------------------------------------------------------- */

.user-menu {
    position: relative;
    flex: none;
    margin-left: auto;
}

.user-menu > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.65rem 0.3rem 0.3rem;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    background: var(--card);
    cursor: pointer;
    list-style: none;
    font-size: 0.89rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.user-menu > summary::-webkit-details-marker {
    display: none;
}

.user-menu > summary:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: none;
    border-radius: 0;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
}

.user-name {
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 60;
    display: grid;
    min-width: 11rem;
    padding: 0.3rem;
    border: 1px solid var(--ink);
    border-radius: 2px;
    background: var(--card);
    box-shadow: 0 20px 30px -26px rgba(22, 24, 28, 0.6);
}

.user-menu-panel a,
.user-menu-panel button {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
    background: var(--paper-2);
    color: var(--ink);
}

.user-menu-panel form {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Guest result CTA
   -------------------------------------------------------------------------- */

.guest-cta,
.card.guest-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    margin-top: 1.8rem;
    padding: 1.3rem 0 0;
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    background: none;
}

.guest-cta h2 {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 500;
}

.guest-cta p {
    max-width: 46ch;
    margin-top: 0.2rem;
    font-size: 0.92rem;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--rule);
    background: var(--paper);
}

.footer-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 2rem;
    padding: 2.2rem 0 1.8rem;
}

.footer-brand p {
    max-width: 32ch;
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.4rem;
    align-content: start;
    justify-content: flex-end;
}

.footer-links a {
    font-size: 0.9rem;
    color: var(--ink-soft);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.footer-links a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.8rem 0 1.4rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .section-head {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .step-list {
        grid-template-columns: 1fr;
    }

    .step-item {
        padding: 1.2rem 0;
        border-right: 0;
        border-bottom: 1px solid var(--rule);
    }

    .step-item:not(:first-child) {
        padding-left: 0;
    }

    .step-item:last-child {
        border-bottom: 0;
    }

    .form-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .setup-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .ledger {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ledger-item:nth-child(3) {
        border-left: 0;
        padding-left: 0;
    }

    .ledger-item:nth-child(n + 3) {
        border-top: 1px solid var(--rule);
    }
}

@media (max-width: 760px) {
    :root {
        --gutter: 1.15rem;
    }

    .nav {
        min-height: 60px;
        gap: 0.85rem;
    }

    .nav-links {
        gap: 0.9rem;
    }

    .nav-links a {
        font-size: 0.86rem;
    }

    .brand-name {
        font-size: 1rem;
    }

    .page-heading,
    .result-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .person-row {
        grid-template-columns: 1.4rem minmax(0, 1fr) auto 1.5rem;
        grid-template-areas:
            "num name name remove"
            ". gender level level";
        row-gap: 0.4rem;
    }

    .person-row .row-num {
        grid-area: num;
    }

    .person-row .person-name {
        grid-area: name;
    }

    .person-row .gender-field {
        grid-area: gender;
    }

    .person-row .level-field {
        grid-area: level;
        justify-self: start;
    }

    .person-row .icon-btn {
        grid-area: remove;
        justify-self: end;
    }

    .team-row {
        grid-template-columns: 1.4rem minmax(0, 1fr) 1.5rem;
    }

    .submit-bar,
    .card.submit-bar {
        position: static;
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
        padding: 0.9rem 1rem;
    }

    .submit-bar .btn {
        width: 100%;
    }

    .link-grid {
        grid-template-columns: 1fr;
    }

    .admin-panel-head {
        flex-direction: column;
    }

    .copy-row {
        flex-direction: column;
    }

    .copy-row .btn {
        width: 100%;
    }

    .copy-row.compact {
        flex-direction: row;
    }

    .copy-row.compact .btn {
        width: auto;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 1.4rem;
        padding: 1.6rem 0 1.2rem;
    }

    .footer-links {
        justify-content: flex-start;
    }

    .closing-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .guest-cta,
    .card.guest-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Tables become records */
    .data-table-wrap {
        border-top-width: 1px;
        overflow: visible;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tbody tr {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--rule);
    }

    .data-table tbody tr:hover {
        background: transparent;
    }

    .data-table tbody td {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.18rem 0;
        border-bottom: 0;
    }

    .data-table tbody td::before {
        content: attr(data-label);
        flex: none;
        font-family: var(--mono);
        font-size: 0.72rem;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--faint);
    }

    .data-table tbody td.col-actions {
        justify-content: flex-end;
        padding-top: 0.45rem;
    }

    .data-table tbody td.col-actions::before {
        display: none;
    }

    .table-actions {
        justify-content: flex-start;
    }

    .search-bar {
        flex-direction: column;
    }

    .user-name {
        display: none;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding-top: 0.5rem;
    }

    .auth-aside {
        order: 2;
        padding-top: 0;
    }

    .auth-aside-rules {
        display: none;
    }

    .specimen-groups {
        grid-template-columns: 1fr;
    }

    .specimen-group {
        border-right: 0;
        border-bottom: 1px solid var(--rule);
    }

    .specimen-group:last-child {
        border-bottom: 0;
    }

    .segmented {
        grid-template-columns: 1fr;
        border-color: var(--rule);
    }

    .segment {
        border-left: 0;
        border-top: 1px solid var(--rule);
    }

    .segment:first-child {
        border-top: 0;
    }

    .segment > span {
        min-height: auto;
        padding: 0.55rem 0.7rem;
    }
}

@media (max-width: 520px) {
    .brand-name {
        display: none;
    }

    .nav {
        gap: 0.7rem;
    }

    .nav-links {
        gap: 0.8rem;
        margin-left: auto;
    }

    .nav-links a {
        font-size: 0.82rem;
    }

    .btn.small {
        padding: 0.34rem 0.6rem;
        font-size: 0.82rem;
    }

    .ledger {
        grid-template-columns: 1fr 1fr;
    }

    .hero-actions .btn,
    .closing-actions .btn {
        width: 100%;
    }

    .share-actions .btn {
        flex: 1;
    }

    .btn.large {
        padding: 0.75rem 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .site-header,
    .site-footer,
    .share-actions,
    .admin-panel,
    .admin-hint,
    .btn,
    .submit-bar {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .team-card {
        break-inside: avoid;
    }
}
