/* ============================================================
   Mother Flocker - mobile-first design system
   Built for one-handed use in a coop: big targets, no hover,
   bottom navigation, 16px inputs so iOS never zooms on focus.
   ============================================================ */

:root {
    --brand: #C2703D;
    --brand-dark: #9A552B;
    --brand-soft: #FBEADC;
    --accent: #5B8C3E;
    --accent-soft: #E8F1E0;
    --blue: #3D7FA6;
    --blue-soft: #E1EFF6;

    --bg: #FAF7F2;
    --surface: #FFFFFF;
    --surface-2: #F4EFE7;
    --text: #2B241E;
    --muted: #796B5D;
    --border: #E7DFD4;

    --danger: #C0392B;
    --danger-soft: #FBE7E4;
    --warn: #B7791F;
    --warn-soft: #FCF1DC;
    --ok: #4F7A3A;
    --ok-soft: #E8F1E0;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(43, 36, 30, .06), 0 4px 16px rgba(43, 36, 30, .06);
    --shadow-lg: 0 8px 40px rgba(43, 36, 30, .18);

    --nav-h: 64px;
    --header-h: 56px;
    --tap: 48px;

    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
    :root {
        --brand: #E0914F;
        --brand-dark: #C2703D;
        --brand-soft: #3A2A1C;
        --accent: #8FBE6B;
        --accent-soft: #263020;
        --blue: #6FB2D6;
        --blue-soft: #1C2B34;

        --bg: #14110E;
        --surface: #201B16;
        --surface-2: #2A241D;
        --text: #F3ECE3;
        --muted: #A6988A;
        --border: #383027;

        --danger: #E97567;
        --danger-soft: #3A211D;
        --warn: #E0B057;
        --warn-soft: #362A15;
        --ok: #8FBE6B;
        --ok-soft: #232E1C;

        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
        --shadow-lg: 0 8px 40px rgba(0, 0, 0, .6);
    }
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 650; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
/* FocusOnNavigate focuses a page's h1 so screen readers announce it. The ring that leaves
   behind tells a sighted person nothing, and looks like something went wrong. */
h1:focus { outline: none; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand-dark); text-decoration: none; }

@media (prefers-color-scheme: dark) { a { color: var(--brand); } }

/* Default size for every inline icon. More specific rules below override per context. */
.icon { width: 20px; height: 20px; flex: none; }

small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- Shell ---------- */

.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: calc(var(--header-h) + var(--safe-t));
    padding: var(--safe-t) .9rem 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.app-header .title {
    font-size: 1.08rem;
    font-weight: 680;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header .farm {
    font-size: .72rem;
    color: var(--muted);
    font-weight: 500;
    display: block;
    line-height: 1.1;
}

.app-main {
    flex: 1;
    padding: .9rem .9rem calc(var(--nav-h) + var(--safe-b) + 1.5rem);
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- Bottom navigation (phone) ---------- */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-b);
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--nav-h);
    color: var(--muted);
    font-size: .68rem;
    font-weight: 600;
    text-decoration: none;
    touch-action: manipulation;
}

.bottom-nav a.active { color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .bottom-nav a.active { color: var(--brand); } }
.bottom-nav a:active { background: var(--surface-2); }
.bottom-nav svg { width: 23px; height: 23px; }

.sidebar { display: none; }

/* ---------- Desktop ---------- */

@media (min-width: 992px) {
    .bottom-nav { display: none; }

    .sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 244px;
        background: var(--surface);
        border-right: 1px solid var(--border);
        padding: 1rem .7rem;
        overflow-y: auto;
        z-index: 50;
    }

    /* The text logo, at a width that fits the sidebar with room either side. */
    .sidebar .brand {
        display: flex;
        padding: .2rem .5rem .9rem;
    }

    .sidebar .brand img { width: 172px; height: auto; }

    .sidebar a.nav-item {
        display: flex;
        align-items: center;
        gap: .7rem;
        padding: .62rem .65rem;
        border-radius: var(--radius-sm);
        color: var(--muted);
        font-weight: 600;
        font-size: .92rem;
        margin-bottom: 1px;
    }

    .sidebar a.nav-item:hover { background: var(--surface-2); color: var(--text); }
    .sidebar a.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); }
    .sidebar svg { width: 19px; height: 19px; flex: none; }
    .sidebar .group-label {
        font-size: .68rem;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: var(--muted);
        padding: .9rem .65rem .3rem;
        font-weight: 700;
    }

    .app-shell { padding-left: 244px; }
    .app-header { padding-left: 1.4rem; padding-right: 1.4rem; }
    .app-main { padding: 1.4rem 1.4rem 3rem; }
}

@media (prefers-color-scheme: dark) {
    .sidebar a.nav-item.active { color: var(--brand); }
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .9rem;
    margin-bottom: .8rem;
}

.card.tight { padding: .65rem .8rem; }
.card.flush { padding: 0; overflow: hidden; }

.card-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .7rem;
}

.card-head h2, .card-head h3 { margin: 0; flex: 1; min-width: 0; }
.card-head > .icon { color: var(--brand); }

.section-title {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
    color: var(--muted);
    margin: 1.3rem .25rem .5rem;
}

.section-title:first-child { margin-top: .2rem; }

/* ---------- Stat tiles ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
    margin-bottom: .8rem;
}

@media (min-width: 620px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-grid.three { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 620px) { .stat-grid.three { grid-template-columns: repeat(3, 1fr); } }

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem .8rem;
    box-shadow: var(--shadow);
    min-width: 0;
}

.stat .label .icon { width: 14px; height: 14px; }

.stat .label {
    font-size: .72rem;
    color: var(--muted);
    font-weight: 620;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: flex;
    align-items: center;
    gap: .3rem;
}

.stat .value {
    font-size: 1.62rem;
    font-weight: 700;
    line-height: 1.15;
    margin-top: .18rem;
    letter-spacing: -.02em;
}

.stat .value.sm { font-size: 1.25rem; }
.stat .sub { font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.stat.accent { background: var(--brand-soft); border-color: transparent; }
.stat.accent .value { color: var(--brand-dark); }

@media (prefers-color-scheme: dark) { .stat.accent .value { color: var(--brand); } }

/* ---------- Lists ---------- */

.list { display: flex; flex-direction: column; }

.row-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 58px;
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    font: inherit;
    touch-action: manipulation;
}

.row-item:last-child { border-bottom: 0; }
.row-item:active { background: var(--surface-2); }

a.row-item, button.row-item { cursor: pointer; }

.row-item .grow { flex: 1; min-width: 0; }
.row-item .r-title { font-weight: 620; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .r-sub { font-size: .8rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; }
.row-item .chev { color: var(--muted); flex: none; }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 700;
    font-size: .9rem;
    flex: none;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: var(--tap);
    padding: 0 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .95rem;
    font-weight: 620;
    cursor: pointer;
    touch-action: manipulation;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet { background: var(--surface-2); border-color: transparent; }
.btn.sm { min-height: 38px; padding: 0 .7rem; font-size: .85rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: var(--tap); flex: none; }
.btn.icon.sm { width: 38px; }
.btn svg { width: 18px; height: 18px; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-row.fill > .btn { flex: 1; }

.fab {
    position: fixed;
    right: 1rem;
    bottom: calc(var(--nav-h) + var(--safe-b) + .9rem);
    z-index: 35;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow-lg);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.fab svg { width: 26px; height: 26px; }

@media (min-width: 992px) { .fab { bottom: 1.5rem; right: 1.5rem; } }

/* ---------- Forms ---------- */

.field { margin-bottom: .8rem; }

.field > label {
    display: block;
    font-size: .8rem;
    font-weight: 650;
    color: var(--muted);
    margin-bottom: .28rem;
}

input[type=text], input[type=number], input[type=date], input[type=search],
input[type=email], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: .55rem .7rem;
    font-size: 16px; /* anything smaller makes iOS zoom the page on focus */
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    appearance: none;
}

textarea { min-height: 86px; resize: vertical; line-height: 1.4; }

/* Sliders carry the genetics controls, so they get a full-width, thumb-friendly track. */
input[type=range] {
    width: 100%;
    height: 40px;
    accent-color: var(--brand);
    background: transparent;
    appearance: auto;
    touch-action: manipulation;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23796B5D' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .7rem center;
    padding-right: 2.2rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 400px) { .field-row.three { grid-template-columns: repeat(2, 1fr); } }

.check {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: var(--tap);
    font-weight: 560;
}

.check input[type=checkbox] {
    width: 22px;
    height: 22px;
    accent-color: var(--brand);
    flex: none;
}

/* ---------- Stepper (the main egg-entry control) ---------- */

.stepper {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.stepper button {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: none;
    touch-action: manipulation;
}

.stepper button:active { background: var(--brand-soft); }
.stepper button:disabled { opacity: .35; }
.stepper button svg { width: 22px; height: 22px; }

.stepper input {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 1.5rem !important;
    font-weight: 700;
    height: 52px;
    padding: 0 .3rem;
    -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Badges, pills, chips ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .18rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--muted);
    white-space: nowrap;
}

.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

@media (prefers-color-scheme: dark) { .badge.brand { color: var(--brand); } }

.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; margin: 0 -.9rem .7rem; padding-left: .9rem; padding-right: .9rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    min-height: 38px;
    padding: 0 .85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: .85rem;
    font-weight: 620;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
}

.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ---------- Alerts ---------- */

.alert {
    display: flex;
    gap: .6rem;
    padding: .7rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    margin-bottom: .7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.alert svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert.info { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.alert strong { font-weight: 700; }

/* ---------- Sheet / modal ---------- */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 16, 12, .5);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fade .15s ease;
}

@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }

.sheet {
    background: var(--surface);
    width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp .22s cubic-bezier(.32, .72, 0, 1);
    box-shadow: var(--shadow-lg);
}

.sheet-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .9rem 1rem .6rem;
    border-bottom: 1px solid var(--border);
}

.sheet-head h2 { margin: 0; flex: 1; font-size: 1.08rem; }

.sheet-body {
    padding: .9rem 1rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.sheet-foot {
    padding: .75rem 1rem calc(.75rem + var(--safe-b));
    border-top: 1px solid var(--border);
    display: flex;
    gap: .5rem;
    background: var(--surface);
}

.sheet-foot .btn { flex: 1; }

.grabber {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: .5rem auto -.2rem;
}

@media (min-width: 720px) {
    .sheet-backdrop { align-items: center; padding: 1.5rem; }
    .sheet { max-width: 560px; border-radius: var(--radius); animation: fade .15s ease; max-height: 88dvh; }
    .grabber { display: none; }
}

/* ---------- Tables (desktop only; phones get card rows) ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.9rem; padding: 0 .9rem; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
    white-space: nowrap;
}

table.data th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
}

table.data td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Charts ---------- */

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap { max-width: 640px; }
.chart text { font-size: 10px; fill: var(--muted); font-family: inherit; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .bar { fill: var(--brand); }
.chart .bar.dim { fill: var(--border); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--brand); opacity: .12; }
.chart .dot { fill: var(--accent); }

.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .76rem; color: var(--muted); margin-top: .45rem; }
.legend span { display: inline-flex; align-items: center; gap: .32rem; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- Egg swatches ---------- */

.egg-swatch {
    width: 30px;
    height: 38px;
    border-radius: 50% 50% 48% 48% / 62% 62% 38% 38%;
    border: 1px solid rgba(0, 0, 0, .14);
    flex: none;
    position: relative;
    overflow: hidden;
    box-shadow: inset -3px -4px 8px rgba(0, 0, 0, .1), inset 2px 2px 6px rgba(255, 255, 255, .45);
}

.egg-swatch.lg { width: 46px; height: 58px; }
.egg-swatch.sm { width: 22px; height: 28px; }

.egg-swatch .speck {
    position: absolute;
    border-radius: 50%;
}

.outcome-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border);
}

.outcome-row:last-child { border-bottom: 0; }

.prob-bar {
    height: 7px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
    margin-top: .3rem;
}

.prob-bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ---------- Punnett square ---------- */

.punnett {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    max-width: 280px;
    font-size: .82rem;
    font-weight: 650;
}

.punnett > div {
    padding: .5rem .2rem;
    text-align: center;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    min-height: 42px;
    display: grid;
    place-items: center;
}

.punnett > div.hdr { background: transparent; font-size: .75rem; }
.punnett > div.cell { background: var(--surface-2); color: var(--text); }
.punnett > div.cell.expressed { background: var(--brand-soft); color: var(--brand-dark); }

@media (prefers-color-scheme: dark) { .punnett > div.cell.expressed { color: var(--brand); } }

/* ---------- Empty state ---------- */

.empty {
    text-align: center;
    padding: 2.2rem 1rem;
    color: var(--muted);
}

.empty svg { width: 36px; height: 36px; opacity: .45; margin-bottom: .5rem; }
.empty h3 { color: var(--text); font-size: 1rem; }
.empty p { font-size: .88rem; max-width: 32ch; margin: 0 auto .9rem; }

/* ---------- Misc ---------- */

.divider { height: 1px; background: var(--border); margin: .9rem 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
.inline { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.tnum { font-variant-numeric: tabular-nums; }

.loading { padding: 2rem; text-align: center; color: var(--muted); }

.progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-track > i { display: block; height: 100%; background: var(--accent); }
.progress-track > i.over { background: var(--brand); }
.progress-track > i.low { background: var(--danger); }

/* Blazor's disconnect UI */

#blazor-error-ui {
    background: var(--warn-soft);
    color: var(--warn);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none;
    left: 0;
    padding: .8rem 1.2rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: .9rem;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .6rem; }

/* ---------- Sign-in screens ---------- */

.auth-shell {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(1rem + var(--safe-t)) 1rem calc(1rem + var(--safe-b));
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.2rem;
}

/* The splash badge. Sized to leave the whole sign-in form on screen on a small phone. */
.auth-brand {
    display: flex;
    justify-content: center;
    margin: -.3rem 0 .9rem;
}

.auth-brand img { width: min(230px, 62vw); height: auto; }
.auth-card h1 { font-size: 1.35rem; }

/* The sign-in card takes the badge's colours - black with gold - in light and dark mode alike.
   It redefines the theme tokens, so every control inside follows without rules of its own. */
.auth-card {
    --surface: #0D0D0D;
    --surface-2: #1F1E1B;
    --text: #F7F2E8;
    --muted: #B9B0A2;
    --border: #3A3833;
    --brand: #F8C010;
    --brand-dark: #F8C010;
    --brand-soft: rgba(248, 192, 16, .25);
    --blue: #7FC0E3;
    --blue-soft: #16252E;
    --danger: #FF8A7A;
    --danger-soft: #3A1E1A;
    --warn: #F0C060;
    --warn-soft: #33281A;
    --ok: #9CCB78;
    --ok-soft: #1F2A19;
    color-scheme: dark;
    color: var(--text);
    border-color: rgba(248, 192, 16, .35);
}

/* Gold takes black text - white on it is unreadable. Secondary buttons are gold outlines, so
   every button on the card reads as one, with the filled one still the obvious next step. */
.auth-card .btn.primary { color: #0D0D0D; }
.auth-card .btn.quiet { background: transparent; border-color: var(--brand); color: var(--brand); }

/* Blazor's InputText needs the same treatment as a bare input. */
.input {
    width: 100%;
    min-height: var(--tap);
    padding: .55rem .7rem;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    appearance: none;
}

.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.input.invalid, .invalid.input { border-color: var(--danger); }

.field-error {
    display: block;
    color: var(--danger);
    font-size: .8rem;
    margin-top: .25rem;
}

.validation-message { color: var(--danger); font-size: .8rem; }

/* ---------- Journal ---------- */

.journal-input { min-height: 140px; }

.row-item.journal-entry { align-items: flex-start; }

.journal-meta {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    color: var(--muted);
    margin-bottom: .3rem;
}

/* The whole entry keeps its line breaks; a long one is cut at eight lines and opens in full. */
.journal-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

/* ---------- Voice typing ---------- */

.dictation { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; min-width: 0; }
.dictation-note { margin-top: .35rem; }

.dictation-live {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    font-size: .85rem;
    font-style: italic;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dictation-live .dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger);
    animation: dictation-pulse 1.2s ease-in-out infinite;
}

@keyframes dictation-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .dictation-live .dot { animation: none; } }

/* ---------- Invite codes ---------- */

.code-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .08em;
    background: var(--brand-soft);
    color: var(--brand-dark);
    padding: .4rem .7rem;
    border-radius: var(--radius-sm);
    display: inline-block;
    user-select: all;
}

@media (prefers-color-scheme: dark) { .code-chip { color: var(--brand); } }

/* ---------- Bird photos ---------- */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .45rem;
}

@media (min-width: 620px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }

.photo-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-2);
    border: 0;
    padding: 0;
    cursor: pointer;
}

.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-tile .star {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: .62rem;
    font-weight: 700;
}

.photo-hero {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
    background: var(--surface-2);
}

.bird-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    flex: none;
    background: var(--surface-2);
}

.upload-drop {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    position: relative;
}

.upload-drop input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* ---------- Account strip in the header ---------- */

.who {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--muted);
}
