/* Messblatt — Laborkarte
   Manilakarton mit Lineatur und rotem Randstrich, Schreibmaschine für Werte,
   Tintenblau als Grundton, Stempelrot als einziger Akzent. */

:root {
    color-scheme: light;

    --card: #e7ddc5;
    --card-deep: #ded2b5;
    --rule-line: rgba(27, 58, 91, 0.13);
    --margin-line: rgba(158, 43, 37, 0.5);
    --ink: #1b3a5b;
    --ink-deep: #122840;
    --graphite: #26231f;
    --graphite-soft: #4a4336;
    --muted: #5c5346;
    --divider: #a79a80;
    --stamp: #9e2b25;
    --stamp-deep: #7a1f1a;
    --good: #2c6049;

    --font-type: 'Special Elite', 'Courier New', monospace;
    --font-data: 'Courier Prime', 'Courier New', monospace;

    --shell-width: 540px;
    --rule-step: 28px;
    --margin-left: 46px;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background-color: #cfc3a4;
    color: var(--graphite);
    font-family: var(--font-data);
    font-size: 15px;
    line-height: 1.45;
    overscroll-behavior-y: none;
}

h1,
h2,
h3,
p {
    margin: 0;
}

a {
    color: var(--stamp);
}

a:hover {
    color: var(--stamp-deep);
}

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

/* Blazor setzt beim Seitenwechsel den Fokus auf die Überschrift. Dort wäre ein
   roter Rahmen ein Fehlersignal, der Fokus bleibt aber für Screenreader bestehen. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
    outline: none;
}

/* ---------- Karte ---------- */

.app-shell {
    max-width: var(--shell-width);
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--card);
    background-image:
        repeating-linear-gradient(to bottom,
            rgba(27, 58, 91, 0) 0 calc(var(--rule-step) - 1px),
            var(--rule-line) calc(var(--rule-step) - 1px) var(--rule-step)),
        linear-gradient(to right,
            rgba(158, 43, 37, 0) 0 33px,
            var(--margin-line) 33px 35px,
            rgba(158, 43, 37, 0) 35px);
    box-shadow: 0 0 0 1px rgba(27, 58, 91, 0.2);
}

.band {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
    border-bottom: 2px solid var(--ink);
    padding: calc(16px + env(safe-area-inset-top)) 22px 7px var(--margin-left);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.band__title {
    font-family: var(--font-type);
    font-size: 15px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
}

.band__chip {
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.page {
    flex: 1;
    padding: 18px 22px calc(100px + env(safe-area-inset-bottom)) var(--margin-left);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    max-width: var(--shell-width);
    margin: 0 auto;
    background: var(--ink);
    padding: 0 8px env(safe-area-inset-bottom);
    display: flex;
    gap: 4px;
}

.tab {
    flex: 1;
    min-height: 56px;
    padding-top: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    border-top: 3px solid transparent;
    background: transparent;
    color: #d8e2ec;
    font-family: var(--font-data);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

.tab.active {
    background: var(--card);
    border-top-color: var(--stamp);
    color: var(--ink);
}

.tab__mark {
    width: 16px;
    height: 1px;
    background: currentColor;
    opacity: 0.5;
}

.tab.active .tab__mark {
    opacity: 0;
}

/* ---------- Typografie ---------- */

.headline {
    font-family: var(--font-type);
    font-size: 21px;
    line-height: 1.3;
    font-weight: 400;
    color: var(--ink);
}

.eyebrow {
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.prose {
    font-size: 14px;
    color: var(--graphite-soft);
    line-height: 1.6;
    text-wrap: pretty;
}

.datum {
    font-family: var(--font-data);
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--graphite-soft);
}

.group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.group__head .eyebrow {
    white-space: nowrap;
}

/* ---------- Kopfwerte ---------- */

.weight {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.weight__value {
    font-family: var(--font-type);
    font-size: clamp(60px, 20vw, 80px);
    line-height: 0.86;
    color: var(--ink);
}

.weight__unit {
    font-family: var(--font-data);
    font-size: 17px;
    font-weight: 700;
    color: var(--muted);
    padding-bottom: 6px;
}

.delta {
    font-family: var(--font-data);
    font-size: 15px;
    font-weight: 700;
    padding-bottom: 7px;
    color: var(--muted);
}

.delta--down {
    color: var(--good);
}

.delta--up {
    color: var(--stamp);
}

/* Der Stempel ist die Signatur der Karte: schief aufgedrückt, nie rechtwinklig. */
.stamp {
    align-self: flex-start;
    border: 2px solid var(--stamp);
    color: var(--stamp);
    padding: 7px 13px 8px;
    transform: rotate(-6deg);
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 4px 0 6px 6px;
}

.stamp__label {
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.stamp__value {
    font-family: var(--font-type);
    font-size: 27px;
    line-height: 1.05;
}

.rows {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.row {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-height: 30px;
}

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

a.row:hover .row__value {
    color: var(--stamp);
}

.row__label {
    font-size: 13.5px;
    letter-spacing: 0.02em;
    color: var(--graphite-soft);
    white-space: nowrap;
}

/* Die Punktlinie führt wie auf einem ausgefüllten Formular zum Wert. */
.row__leader {
    flex: 1;
    min-width: 12px;
    border-bottom: 1px dotted var(--divider);
    transform: translateY(-4px);
}

.row__value {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--graphite);
}

.row__value--muted {
    font-weight: 400;
    color: var(--muted);
    font-size: 14px;
}

.row__note {
    font-size: 13px;
    color: var(--graphite-soft);
    white-space: normal;
    text-align: right;
}

.folds {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.fold {
    border: 1px solid var(--ink);
    padding: 8px 4px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.fold__value {
    font-family: var(--font-type);
    font-size: 25px;
    line-height: 1;
    color: var(--ink);
}

.fold__label {
    font-size: 9.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--graphite-soft);
}

.empty {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 0 6px;
}

/* ---------- Diagramm ---------- */

.chart {
    width: 100%;
    display: block;
}

.chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.chip {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--divider);
    background: transparent;
    color: var(--graphite-soft);
    font-family: var(--font-data);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.chip.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--card);
}

/* ---------- Formular ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 6px;
}

.field__label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.field__line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    border-bottom: 1.5px solid var(--divider);
}

.field__line:focus-within {
    border-bottom-color: var(--stamp);
}

.field__input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    border: none;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-type);
    font-size: 25px;
    line-height: 1;
    padding: 0 2px;
}

.field__input:focus {
    outline: none;
}

.field__input::placeholder {
    color: rgba(27, 58, 91, 0.25);
}

.field__unit {
    font-size: 11.5px;
    color: var(--muted);
    padding-bottom: 12px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field--text .field__input {
    font-family: var(--font-data);
    font-size: 15px;
    min-height: 44px;
}

.field--date .field__input {
    font-family: var(--font-data);
    font-size: 16px;
    font-weight: 700;
}

.segmented {
    display: flex;
    border: 1px solid var(--ink);
}

.segmented__option {
    flex: 1;
    min-height: 46px;
    border: none;
    background: transparent;
    color: var(--graphite-soft);
    font-family: var(--font-data);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.segmented__option.active {
    background: var(--ink);
    color: var(--card);
}

/* ---------- Aktionen ---------- */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    padding: 0 18px;
    border: none;
    background: var(--ink);
    color: #f0e9d8;
    font-family: var(--font-type);
    font-size: 15px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--ink-deep);
    color: #f0e9d8;
}

.btn:disabled {
    background: var(--divider);
    color: var(--muted);
    cursor: default;
}

.btn--ghost {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--ink);
}

.btn--ghost:hover {
    background: rgba(27, 58, 91, 0.07);
    color: var(--ink);
}

.btn--quiet {
    background: transparent;
    border: 1.5px solid var(--stamp);
    color: var(--stamp);
    font-family: var(--font-data);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    min-height: 42px;
}

.btn--quiet:hover {
    background: rgba(158, 43, 37, 0.08);
    color: var(--stamp-deep);
}

.btn-row {
    display: flex;
    gap: 10px;
}

.notice {
    border: 1px solid var(--stamp);
    color: var(--stamp-deep);
    font-size: 13.5px;
    padding: 9px 12px;
}

.notice--good {
    border-color: var(--good);
    color: var(--good);
}

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    padding: 9px 2px;
    font-size: 13px;
    color: var(--graphite-soft);
}

.banner strong {
    font-family: var(--font-type);
    font-size: 19px;
    font-weight: 400;
    color: var(--ink);
}

/* Die Installationsfrage sitzt wie ein angeheftetes Blatt über der Karte. */
.install {
    margin: 14px 22px 0 var(--margin-left);
    border: 1px solid var(--ink);
    border-top: 3px solid var(--stamp);
    background: rgba(247, 242, 229, 0.6);
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.install__text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 200px;
    flex: 1;
}

.install__actions {
    display: flex;
    gap: 8px;
}

.install__actions .btn {
    width: auto;
    white-space: nowrap;
}

/* ---------- Anmelden ---------- */

.login {
    min-height: 100dvh;
    max-width: var(--shell-width);
    margin: 0 auto;
    background-color: var(--card);
    background-image:
        repeating-linear-gradient(to bottom,
            rgba(27, 58, 91, 0) 0 calc(var(--rule-step) - 1px),
            var(--rule-line) calc(var(--rule-step) - 1px) var(--rule-step)),
        linear-gradient(to right,
            rgba(158, 43, 37, 0) 0 33px,
            var(--margin-line) 33px 35px,
            rgba(158, 43, 37, 0) 35px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
    padding: 32px 24px calc(32px + env(safe-area-inset-bottom)) var(--margin-left);
}

.login__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 8px;
}

.login__mark {
    font-family: var(--font-type);
    font-size: 27px;
    line-height: 1.1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink);
}

.login__stamp {
    border: 2px solid var(--stamp);
    color: var(--stamp);
    font-family: var(--font-type);
    font-size: 12px;
    letter-spacing: 0.14em;
    padding: 5px 9px;
    transform: rotate(-7deg);
}

.login__pin {
    font-family: var(--font-type);
    font-size: 32px;
    letter-spacing: 0.3em;
}

/* ---------- Start und Fehler ---------- */

.boot {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--card);
}

.boot__mark {
    font-family: var(--font-type);
    font-size: 22px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
}

.boot__hint {
    font-family: var(--font-data);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--stamp);
    color: #f6ece0;
    font-family: var(--font-data);
    font-size: 14px;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
}

#blazor-error-ui .reload {
    color: #f6ece0;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
    font-size: 18px;
    line-height: 1;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
