/* SM Kundendisplay - Finder, zweite Fassung (18.09.2026 abends)
   ---------------------------------------------------------------------------
   Aussehen des Messblatts. Gleiche Regeln wie display.css: keine Hexwerte, nur
   var(--sm-*) aus x_sm_website/static/src/css/sm_tokens.css.

   Aufbau: Kopfzeile (Zurueck, Titel, Massstab-Pille) - darunter das Blatt in
   zwei Spalten ab 1000 px (links Fragen, rechts Ergebnis, beide scrollen
   getrennt), auf dem Hochkant-Tablet untereinander.

   touch-action: none auf dem Finder - Pinch-Zoom aendert devicePixelRatio
   nicht, die Ringe und die 1:1-Zeichnung waeren danach stumm falsch. Gescrollt
   wird nur in den Spalten (pan-y).
*/

.smf {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: var(--sm-page);
    background-image: radial-gradient(120% 80% at 50% -20%, rgba(var(--sm-aura-rgb), .28), transparent 60%);
    color: var(--sm-ink);
    touch-action: none;
}

/* ===== Einstiege ===== */
.smd-ruhe-leiste .smf-start { width: auto; min-height: 48px; }
.smf-start-klein { min-height: 48px; }
@media (orientation: portrait) {
    .smd-seite .smf-start-klein { width: auto; padding: 10px 14px; }
}

/* ===== Kopf ===== */
.smf-kopf {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 10px clamp(14px, 3vw, 28px);
    background: var(--sm-dark);
    border-bottom: 1px solid var(--sm-line-gold);
}
.smf-kopf-mitte { min-width: 0; }
.smf-kopf-titel {
    font-family: var(--sm-display);
    font-weight: 500;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--sm-on-dark-strong);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.smf-schliessen {
    min-height: 46px;
    padding: 8px 16px;
    border-radius: var(--sm-r-lg);
    border: 1px solid var(--sm-line-gold);
    background: transparent;
    color: var(--sm-gold);
    font-family: var(--sm-display);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    white-space: nowrap;
}
.smf-pille {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-height: 46px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--sm-line-gold);
    background: rgba(var(--sm-veil-rgb), .08);
    color: var(--sm-on-dark-strong);
    font-family: var(--sm-display);
    font-size: .85rem;
    cursor: pointer;
    white-space: nowrap;
}
.smf-pille-link { color: var(--sm-gold); text-decoration: underline; font-size: .8rem; }
.smf-pille-warn { border-color: var(--sm-red); }
.smf-pille-warn span:first-child { color: var(--sm-red); }

.smf-warn {
    flex: 0 0 auto;
    padding: 10px 20px;
    background: var(--sm-red);
    color: var(--sm-on-dark-strong);
    font-weight: 600;
    text-align: center;
}
.smf-lade { margin: 40px auto; max-width: 60ch; text-align: center; }

/* ===== Das Blatt ===== */
.smf-blatt {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 46fr 54fr;
    gap: 0;
}
.smf-fragen, .smf-ergebnis {
    min-height: 0;
    overflow-y: auto;
    touch-action: pan-y;
    scrollbar-width: none;
    padding: 16px clamp(12px, 2vw, 24px) calc(24px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.smf-fragen::-webkit-scrollbar, .smf-ergebnis::-webkit-scrollbar { display: none; }
.smf-fragen { border-right: 1px solid var(--sm-hairline); }
@media (max-width: 999px) {
    /* Hochkant: eine Spalte, Zeilen so hoch wie ihr Inhalt. Ohne grid-auto-rows: max-content und
       min-height: auto teilt das Grid die feste Hoehe des Blatts auf zwei Zeilen und die Spalten
       ueberlappen (Befund der Probe 18.09.2026, 17:20 Uhr). */
    .smf-blatt { grid-template-columns: 1fr; grid-auto-rows: max-content; overflow-y: auto; touch-action: pan-y; }
    .smf-fragen, .smf-ergebnis { overflow: visible; min-height: auto; }
    .smf-fragen { border-right: none; border-bottom: 1px solid var(--sm-line-gold); }
}

/* ===== Ein Schritt ===== */
.smf-schritt {
    background: var(--sm-surface);
    border: 1px solid var(--sm-hairline);
    border-radius: var(--sm-r-lg);
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.smf-schritt > header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.smf-schritt > header h3 {
    margin: 0;
    font-family: var(--sm-display);
    font-weight: 500;
    font-size: clamp(1.05rem, 1.8vw, 1.35rem);
    color: var(--sm-ink-strong);
    line-height: 1.15;
}
.smf-nr {
    font-family: var(--sm-display);
    font-weight: 700;
    font-size: .8rem;
    color: var(--sm-gold);
    border: 1px solid var(--sm-line-gold);
    border-radius: 999px;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
}
.smf-wert-klein {
    margin-left: auto;
    font-family: var(--sm-display);
    font-weight: 600;
    color: var(--sm-ink-strong);
    font-size: 1rem;
    white-space: nowrap;
}
.smf-wert-gold { color: var(--sm-gold); }
.smf-klein { font-size: .9rem; line-height: 1.4; color: var(--sm-muted); }
.smf-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }

.smf-details { font-size: .92rem; line-height: 1.45; color: var(--sm-muted); }
.smf-details summary {
    cursor: pointer;
    color: var(--sm-gold);
    font-weight: 600;
    list-style: none;
    padding: 4px 0;
}
.smf-details summary::-webkit-details-marker { display: none; }
.smf-details summary::before { content: "› "; }
.smf-details[open] summary::before { content: "⌄ "; }
.smf-details > div { padding: 6px 0 2px; }

/* ===== Kacheln (Teil, Diffusor) ===== */
.smf-kacheln {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}
.smf-kacheln-teile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1300px) { .smf-kacheln-teile { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.smf-kacheln-diff { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.smf-kachel {
    min-height: 92px;
    padding: 10px 12px;
    border-radius: var(--sm-r-lg);
    border: 1px solid var(--sm-line);
    background: var(--sm-surface-2);
    color: var(--sm-ink-strong);
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.smf-kachel:active { filter: brightness(1.08); }
.smf-kachel.smf-an {
    border-color: var(--sm-gold);
    box-shadow: 0 0 0 1px var(--sm-gold) inset;
}
.smf-kachel-titel {
    font-family: var(--sm-display);
    font-weight: 600;
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    line-height: 1.2;
}
.smf-kachel-text { font-size: .85rem; line-height: 1.35; color: var(--sm-muted); }
.smf-kachel-zahl { font-size: .85rem; color: var(--sm-green); font-weight: 600; }
.smf-pikt { display: block; width: 100%; max-width: 150px; height: 40px; }
.smf-pikt svg { width: 100%; height: 100%; display: block; }
.smf-pikt .p-glas { fill: rgba(var(--sm-veil-rgb), .16); stroke: var(--sm-gold); stroke-width: 1.5; stroke-linejoin: round; }
.smf-pikt .p-linie { fill: none; stroke: var(--sm-gold); stroke-width: 1.5; }
.smf-pikt .p-punkt { fill: var(--sm-gold); }
.smf-pikt .p-text { fill: var(--sm-gold); font-family: var(--sm-display); font-size: 16px; font-weight: 700; }

/* ===== Segment (female/male, oben-Modus, Kalibrierobjekt, Massstab) ===== */
.smf-segment { display: flex; flex-wrap: wrap; gap: 8px; }
.smf-seg {
    flex: 1 1 200px;
    min-height: 50px;
    padding: 8px 14px;
    border-radius: var(--sm-r-lg);
    border: 1px solid var(--sm-line);
    background: var(--sm-surface-2);
    color: var(--sm-ink);
    font-size: clamp(.9rem, 1.3vw, 1rem);
    line-height: 1.3;
    cursor: pointer;
    text-align: left;
}
.smf-seg b { color: var(--sm-ink-strong); }
.smf-seg.smf-seg-an { border-color: var(--sm-gold); box-shadow: 0 0 0 1px var(--sm-gold) inset; color: var(--sm-ink-strong); }
.smf-seg-kurz { flex: 0 1 auto; min-height: 42px; text-align: center; }
.smf-segment-klein .smf-seg { padding: 4px 12px; min-height: 36px; font-size: .85rem; }

/* ===== Lehre ===== */
.smf-lehre {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: flex-end;
    gap: 6px 10px;
    padding: 6px 0 2px;
}
.smf-ring-knopf {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--sm-r-lg);
    padding: 6px 8px;
    cursor: pointer;
    color: var(--sm-ink);
}
.smf-ring-knopf.smf-an { border-color: var(--sm-line-gold); background: rgba(var(--sm-veil-rgb), .07); color: var(--sm-ink-strong); }
/* Halter: Mindestgroesse (nie fest) - sonst drueckt Flex den 29,2er Ring zur Ellipse. */
.smf-ring-halter {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(64px, 9vw, 190px);
    min-height: clamp(64px, 9vw, 190px);
}
.smf-lehre-klein .smf-ring-halter { min-width: clamp(56px, 8vw, 150px); min-height: clamp(56px, 8vw, 150px); }
.smf-ring {
    display: block;
    flex: 0 0 auto;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--sm-gold);
    background: var(--sm-dark-0);
    box-shadow: 0 0 0 1px rgba(var(--sm-veil-rgb), .12) inset;
}
.smf-ring-knopf.smf-an .smf-ring { border-width: 3px; }
.smf-ring-label { font-family: var(--sm-display); font-weight: 600; font-size: clamp(.9rem, 1.4vw, 1.1rem); }

/* ===== Kalibrierung ===== */
.smf-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 22px clamp(14px, 3vw, 40px) calc(24px + env(safe-area-inset-bottom, 0px));
    touch-action: pan-y;
}
.smf-frage {
    font-family: var(--sm-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 3.4vw, 2.4rem);
    color: var(--sm-ink-strong);
    margin: 0;
    text-align: center;
}
.smf-breit { max-width: 62ch; text-align: center; }
.smf-kalib-buehne { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 200px; padding: 10px; }
.smf-kalib-form { box-sizing: border-box; border: 3px solid var(--sm-gold); border-radius: var(--sm-r); background: var(--sm-dark-0); }
.smf-kalib-form.smf-rund { border-radius: 50%; }
.smf-plusminus { display: flex; gap: 8px; flex-wrap: wrap; }
.smf-plusminus .smd-taste { min-width: 64px; padding: 0 12px; }
.smf-taste-text { min-width: auto; font-size: .9rem; }
.smf-plusminus .smd-taste.smf-an { border-color: var(--sm-gold); color: var(--sm-gold); }

/* ===== Lineal ===== */
.smf-lineal-rahmen { width: 100%; overflow: hidden; display: flex; padding: 2px 0; }
.smf-lineal {
    display: block;
    background: var(--sm-surface-2);
    border: 1px solid var(--sm-line-gold);
    border-radius: var(--sm-r);
    touch-action: none;
    cursor: crosshair;
    max-width: 100%;
}
.smf-lineal-kante { stroke: var(--sm-gold); stroke-width: 2; }
.smf-tick { stroke: var(--sm-ink); stroke-width: 1; }
.smf-tick-text { fill: var(--sm-muted); font-family: var(--sm-display); font-size: 12px; text-anchor: middle; }
.smf-null-text { fill: var(--sm-gold); font-family: var(--sm-display); font-size: 11px; }
.smf-marke { stroke: var(--sm-gold); stroke-width: 3; }
.smf-toleranz { margin-top: 2px; }
.smf-chipknopf {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--sm-line);
    background: var(--sm-surface-2);
    color: var(--sm-ink);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
}
.smf-chipknopf.smf-an { border-color: var(--sm-gold); color: var(--sm-gold); box-shadow: 0 0 0 1px var(--sm-gold) inset; }

/* ===== Ergebnis ===== */
.smf-zusammenfassung { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.smf-zusammenfassung-text { color: var(--sm-ink-strong); font-size: clamp(.95rem, 1.5vw, 1.1rem); }
.smf-kette-box {
    background: var(--sm-surface);
    border: 1px solid var(--sm-line-gold);
    border-left: 3px solid var(--sm-gold);
    border-radius: var(--sm-r-lg);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.smf-kette-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.smf-kette-bild { width: 100%; overflow-x: auto; scrollbar-width: none; padding: 4px 0; }
.smf-kette-bild::-webkit-scrollbar { display: none; }
.smf-kette-bild svg { display: block; max-width: none; }
.smf-sv-glas { fill: rgba(var(--sm-veil-rgb), .16); stroke: var(--sm-gold); stroke-width: 1.2; stroke-linejoin: round; }
.smf-sv-schliff { fill: rgba(var(--sm-veil-rgb),.10); stroke: none; }
/* 19.09.2026: Kanten der Schliffzone und Bohrung der Huelse - fein und halb durchsichtig,
   sonst schreien sie lauter als das Glas. Die Zone selbst ist heller als frueher (.10 statt
   .18): auf dem Glas-Fill wirkte sie wie ein Ziegel. */
.smf-sv-kante   { stroke: var(--sm-gold); stroke-width: .9; opacity: .55; }
.smf-sv-ref { stroke: var(--sm-gold); stroke-width: 1; stroke-dasharray: 4 3; }
.smf-sv-lab { fill: var(--sm-muted); font-family: var(--sm-display); font-size: 11px; }
.smf-sv-ziel { stroke: var(--sm-ink); stroke-width: 1; }
.smf-sv-ziellab { fill: var(--sm-ink); font-family: var(--sm-display); font-size: 11px; }
.smf-sv-det-l { stroke: var(--sm-ink-strong); stroke-width: 1; }
.smf-sv-det-f { fill: var(--sm-ink-strong); }
.smf-kette-teile { display: flex; flex-direction: column; gap: 6px; }
.smf-teil {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "rolle name preis" "rolle text preis";
    column-gap: 12px;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid var(--sm-hairline);
}
.smf-teil-rolle { grid-area: rolle; font-family: var(--sm-display); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--sm-gold); }
.smf-teil-name { grid-area: name; color: var(--sm-ink-strong); }
.smf-teil-text { grid-area: text; font-size: .85rem; color: var(--sm-muted); }
.smf-teil-preis { grid-area: preis; font-family: var(--sm-display); font-weight: 600; color: var(--sm-ink-strong); white-space: nowrap; }
.smf-summe { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.smf-gs { font-family: var(--sm-display); font-weight: 600; font-size: clamp(1.4rem, 2.6vw, 2rem); color: var(--sm-gold); }
.smf-bon { width: auto; min-height: 50px; padding: 10px 18px; font-size: 1rem; }
.smf-bon-klein { min-height: 42px; padding: 6px 12px; font-size: .9rem; }
.smf-hinweis-box {
    padding: 10px 14px;
    border-radius: var(--sm-r-lg);
    background: rgba(var(--sm-veil-rgb), .07);
    border-left: 3px solid var(--sm-gold);
    color: var(--sm-ink);
    line-height: 1.45;
    font-size: .95rem;
}
.smf-wechsel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.smf-link {
    background: none;
    border: none;
    padding: 2px 6px;
    color: var(--sm-gold);
    text-decoration: underline;
    font: inherit;
    cursor: pointer;
}
.smf-bon-meldung {
    padding: 12px 16px;
    border-radius: var(--sm-r-lg);
    background: var(--sm-surface);
    border: 1px solid var(--sm-line-gold);
    font-weight: 600;
    font-size: clamp(1rem, 1.7vw, 1.2rem);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 6px 14px;
    text-align: center;
}
.smf-gruppe {
    margin: 6px 0 0;
    font-family: var(--sm-display);
    font-weight: 500;
    font-size: clamp(1.05rem, 1.8vw, 1.3rem);
    color: var(--sm-ink-strong);
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.smf-zahl { font-size: .75em; color: var(--sm-gold); padding: 1px 10px; border-radius: 999px; border: 1px solid var(--sm-line-gold); white-space: nowrap; }
.smf-leer { color: var(--sm-ink); font-size: clamp(.95rem, 1.5vw, 1.1rem); line-height: 1.45; }
.smf-liste { display: flex; flex-direction: column; gap: 8px; }

/* ===== Bild gross (Lupe) =====
   Jans Vorgabe 18.09.2026: "die Bilder in der Auswahl am Ende muss man auf jeden Fall vergroessern
   koennen". Das Bild in der Karte ist ein Knopf; die Lupe legt sich ueber das ganze Blatt. */
.smf-bild-knopf {
    position: relative;
    display: block;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    line-height: 0;
    border-radius: var(--sm-r-sm);
}
.smf-lupe-zeichen {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(var(--sm-veil-rgb), .55);
    border: 1px solid var(--sm-line-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.smf-lupe-zeichen svg { width: 14px; height: 14px; fill: none; stroke: var(--sm-gold); stroke-width: 2; stroke-linecap: round; }

.smf-lupe {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 40px);
    background: var(--sm-dark-0);
    background: color-mix(in srgb, var(--sm-dark-0) 88%, transparent);
    cursor: zoom-out;
    touch-action: none;
}
.smf-lupe-inhalt {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: min(900px, 100%);
    max-height: 100%;
    cursor: default;
}
.smf-lupe-bild {
    flex: 1 1 auto;
    min-height: 0;
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--sm-r-lg);
    background: var(--sm-media-bg);
}
.smf-lupe-fuss {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 14px;
    border-radius: var(--sm-r-lg);
    background: var(--sm-surface);
    border: 1px solid var(--sm-line-gold);
}
.smf-lupe-text { flex: 1 1 260px; min-width: 0; }
.smf-lupe-name {
    font-family: var(--sm-display);
    font-weight: 600;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    color: var(--sm-ink-strong);
    line-height: 1.2;
}
.smf-lupe-zu { min-height: 46px; padding: 8px 18px; white-space: nowrap; }

/* ===== Karten ===== */
.smf-karte {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--sm-r-lg);
    background: var(--sm-surface);
    border: 1px solid var(--sm-hairline);
    cursor: pointer;
}
.smf-karte.smf-an { border-color: var(--sm-gold); box-shadow: 0 0 0 1px var(--sm-gold) inset; }
.smf-bild { width: 72px; height: 72px; border-radius: var(--sm-r-sm); background: var(--sm-media-bg); object-fit: contain; }
.smf-karte-text { min-width: 0; }
.smf-karte-name { font-weight: 600; color: var(--sm-ink-strong); font-size: clamp(.95rem, 1.4vw, 1.05rem); line-height: 1.25; }
.smf-variante { color: var(--sm-muted); font-weight: 400; }
.smf-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.smf-chip { padding: 2px 9px; border-radius: 999px; background: rgba(var(--sm-veil-rgb), .1); color: var(--sm-ink-strong); font-size: .82rem; white-space: nowrap; }
.smf-chip-mass { background: transparent; border: 1px solid var(--sm-line-gold); color: var(--sm-gold); }
.smf-chip-grund { background: transparent; border: 1px dashed var(--sm-line-gold); color: var(--sm-gold); }
.smf-karte-fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 5px; }
.smf-bestand { font-size: .85rem; color: var(--sm-green); }
.smf-sil svg { display: block; height: 16px; width: auto; max-width: 180px; }
.smf-karte-rechts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.smf-preis { font-family: var(--sm-display); font-weight: 600; font-size: clamp(1.15rem, 2vw, 1.5rem); color: var(--sm-gold); white-space: nowrap; }

@media (max-width: 640px) {
    .smf-kopf { grid-template-columns: auto 1fr; }
    .smf-pille { grid-column: 1 / -1; align-items: flex-start; }
    .smf-karte { grid-template-columns: 56px 1fr; }
    .smf-bild { width: 56px; height: 56px; }
    .smf-karte-rechts { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
}
