:root {
    --bg-base: #0f1115;
    --bg-surface: #1a1d24;
    --bg-surface-hover: #262a34;
    --border-color: #2b303b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --brand-primary: #6366f1;
    --brand-primary-hover: #4f46e5;
    --brand-glow: rgba(99, 102, 241, 0.4);
    --success: #10b981;
    --danger: #ef4444;
    --radius: 16px;
    --tap: 48px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html.light-mode {
    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #e2e8f0;
    --border-color: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --brand-glow: rgba(79, 70, 229, 0.28);
}

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

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: Outfit, system-ui, sans-serif;
    -webkit-text-size-adjust: 100%;
}

body {
    padding-bottom: var(--safe-bottom);
}

.hidden { display: none !important; }

.app {
    width: min(430px, 100%);
    margin: 0 auto;
    min-height: 100dvh;
    padding: calc(12px + var(--safe-top)) 16px 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.topbar-card {
    align-items: center;
    padding: 8px 10px 12px;
    margin-bottom: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--brand-primary);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.topbar-card .topbar-brand {
    flex: 1;
    min-width: 0;
    align-items: center;
}

.topbar-card h1 {
    font-size: 0.92rem;
    line-height: 1.15;
    white-space: nowrap;
}

body[data-page="login"] .topbar-card h1 {
    font-size: 1rem;
}

.topbar-meta {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.35;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
}

.topbar-meta + .topbar-meta {
    margin-top: 3px;
}

.topbar-card .topbar-actions {
    flex-direction: row;
    gap: 3px;
    align-self: flex-start;
    margin-top: 0;
    padding-top: 1px;
}

.topbar-card .icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    font-size: 0.72rem;
    background: var(--bg-base);
    color: var(--text-primary);
}

.topbar-card #btn-topbar-menu {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 0.95rem;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.topbar-logo {
    height: 52px;
    width: auto;
    flex-shrink: 0;
    mix-blend-mode: screen;
}

.topbar-card .topbar-logo {
    height: 52px;
}

html.light-mode .topbar-logo {
    filter: invert(1) hue-rotate(180deg);
    mix-blend-mode: multiply;
}

.topbar-titles {
    flex: 1;
    min-width: 0;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    white-space: nowrap;
}

.topbar-sub {
    margin: 2px 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.topbar-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    position: relative;
}

.topbar-overflow {
    position: relative;
}

.topbar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
    max-width: min(86vw, 320px);
    padding: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.topbar-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: var(--tap);
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.topbar-menu-item:hover,
.topbar-menu-item:focus-visible {
    background: var(--bg-surface-hover);
    outline: none;
}

.topbar-menu-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.topbar-menu-item-label {
    flex: 1;
    min-width: 0;
}

.account-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-wrap.is-logged-out .topbar-menu-item {
    opacity: 0.85;
    border: 1px dashed var(--border-color);
}

.account-wrap.is-logged-out .topbar-menu-item-icon {
    opacity: 0.7;
}

.account-menu {
    padding: 8px 12px 10px;
    border-radius: 10px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
}

.account-menu strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}

.account-menu span {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    word-break: break-all;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.screen {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lead, .muted {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.card, .action-card, .mission-row, .empty, .capture-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card h2 {
    margin: 0;
    font-size: 1.15rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.field input,
.field select,
.btn {
    min-height: var(--tap);
    font-size: 16px;
    border-radius: 12px;
    font-family: inherit;
}

.field input,
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
    color: var(--text-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 8px 20px var(--brand-glow);
}

.btn-secondary {
    background: var(--bg-base);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

.mission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    cursor: pointer;
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px var(--brand-glow);
}

.mission-row strong { display: block; margin-bottom: 4px; }
.mission-row span { color: var(--text-secondary); font-size: 0.88rem; }
.mission-row i { color: var(--brand-primary); }

.action-stack { display: flex; flex-direction: column; gap: 8px; }

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    min-height: 84px;
    color: inherit;
    text-decoration: none;
    text-align: left;
    width: 100%;
    font: inherit;
    cursor: pointer;
}

.action-card:disabled { opacity: 0.55; cursor: not-allowed; }
.action-card-primary { border-color: var(--brand-primary); box-shadow: 0 4px 12px var(--brand-glow); }
.action-card-finish { border-color: var(--success); }
.action-card.is-done { border-color: var(--success); }

.action-stack > .action-card-finish,
.action-stack > .action-card.is-done {
    width: 72%;
    align-self: center;
    justify-content: center;
    border-width: 3px;
    border-color: var(--success);
}

.action-stack > .action-card-finish > .fa-chevron-right {
    margin-left: 4px;
}
.action-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    color: var(--brand-primary);
    position: relative;
    flex-shrink: 0;
    font-size: 1.25rem;
}
.action-text { flex: 1; min-width: 0; }
.action-text strong { display: block; }
.action-text em {
    display: block;
    margin-top: 3px;
    font-style: normal;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.action-card > .fa-chevron-right { color: var(--text-secondary); }

.action-card-compact {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    gap: 8px;
    padding: 6px 10px;
    min-height: 44px;
}

.action-card-compact .action-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.action-card-compact .action-text strong {
    font-size: 0.82rem;
    line-height: 1.15;
}

.action-card-compact .action-text em {
    margin-top: 0;
    font-size: 0.72rem;
    line-height: 1.15;
}

.action-card-compact > .fa-chevron-right {
    font-size: 0.75rem;
    margin-left: auto;
}

.photo-tabs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.photo-tablist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    padding: 3px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.photo-tab {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-weight: 600;
    font-size: 0.86rem;
    line-height: 1.15;
    min-height: 40px;
    padding: 6px 8px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.photo-tab[aria-selected="true"] {
    background: var(--brand-primary);
    color: #fff;
}

.photo-tab-count {
    display: inline-flex;
    min-width: 1.35em;
    height: 1.35em;
    padding: 0 5px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--bg-base);
    color: var(--text-secondary);
}

.photo-tab[aria-selected="true"] .photo-tab-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

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

.photo-empty {
    margin: 0;
    padding: 22px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.92rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
}

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

.photo-group h2 {
    margin: 4px 0 0;
    font-size: 1.05rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.photo-tile {
    display: block;
    width: 100%;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: #111;
    cursor: pointer;
}

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

.photo-preview {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: calc(12px + var(--safe-top)) 16px calc(12px + var(--safe-bottom));
}

.photo-preview-close {
    position: absolute;
    top: calc(10px + var(--safe-top));
    right: 12px;
    z-index: 82;
    background: rgba(15, 17, 21, 0.72);
    border-color: rgba(248, 250, 252, 0.28);
    color: #f8fafc;
}

body.photo-preview-open {
    overflow: hidden;
}

.photo-preview-stage {
    aspect-ratio: 3 / 4;
    width: min(calc(100vw - 32px), calc(min(82dvh, 100dvh - 130px) * 3 / 4));
    height: auto;
    max-height: min(82dvh, calc(100dvh - 130px));
    flex: 0 0 auto;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
    background: #0b0d12;
    border: 1px solid rgba(248, 250, 252, 0.14);
    border-radius: 16px;
    cursor: grab;
}

.photo-preview-stage.is-lp {
    border: 1px solid #94a3b8;
    box-shadow:
        0 0 6px rgba(148, 163, 184, 0.9),
        0 0 14px rgba(100, 116, 139, 0.45);
}

.photo-preview-stage.is-gelb {
    border: 1px solid #facc15;
    box-shadow:
        0 0 6px rgba(250, 204, 21, 0.9),
        0 0 14px rgba(234, 179, 8, 0.4);
}

.photo-preview-stage.is-rezept {
    border: 2px solid transparent;
    background:
        linear-gradient(#0b0d12, #0b0d12) padding-box,
        linear-gradient(135deg, #86efac, #7dd3fc) border-box;
    box-shadow:
        0 0 6px rgba(134, 239, 172, 0.75),
        0 0 14px rgba(125, 211, 252, 0.45);
}

.photo-preview-stage:active {
    cursor: grabbing;
}

.photo-preview-sizer {
    min-width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview-stage img {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.photo-preview-hint {
    margin: 0;
    text-align: center;
    color: #cbd5e1;
    font-size: 0.82rem;
}

.empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-secondary);
}
.empty i { font-size: 2rem; margin-bottom: 8px; display: block; }

.patient-screen { padding-bottom: 8px; }

.capture-hint {
    margin: 0;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.capture-card {
    display: block;
    position: relative;
    aspect-ratio: 3 / 4;
    width: min(100%, calc(min(52dvh, 100dvh - 280px) * 3 / 4));
    height: auto;
    max-height: min(52dvh, calc(100dvh - 280px));
    margin-inline: auto;
    overflow: hidden;
    cursor: pointer;
    border-radius: var(--radius);
}

.capture-card input[type="file"] {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.capture-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: inherit;
    padding: 8px;
    box-sizing: border-box;
}

.capture-empty img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.finish-modal {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 16px calc(16px + var(--safe-bottom));
}

.finish-modal-card {
    width: min(430px, 100%);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.finish-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.finish-modal-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.finish-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--text-secondary);
}

.finish-check input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.finish-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.85rem;
}

.finish-success-card {
    align-items: center;
    text-align: center;
    padding: 22px 16px 16px;
}

.finish-success-card h2 {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.35;
}

.finish-success-icon {
    color: var(--success);
    font-size: 2.1rem;
}

.toast {
    position: sticky;
    top: 0;
    z-index: 50;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.toast.error { border-color: var(--danger); color: #fecaca; }
html.light-mode .toast.error { color: #b91c1c; }

.editor-screen {
    padding-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-toolbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 2px 0 4px;
    background: linear-gradient(180deg, var(--bg-base) 70%, transparent);
}

.editor-toolbar-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: min(100%, calc(min(68dvh, 100dvh - 210px) * 3 / 4));
    max-width: 100%;
    margin-inline: auto;
}

.editor-toolbar-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

.btn-editor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto;
    flex: 0 0 auto;
    min-height: 30px;
    min-width: 0;
    padding: 5px 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: none;
    white-space: nowrap;
}

.btn-editor i {
    font-size: 0.75rem;
    opacity: 0.9;
}

.btn-editor:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-editor-primary {
    border-color: rgba(99, 102, 241, 0.55);
    background: rgba(99, 102, 241, 0.88);
    color: #fff;
    font-weight: 600;
}

html.light-mode .btn-editor {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(148, 163, 184, 0.55);
    color: #0f172a;
}

html.light-mode .btn-editor-primary {
    background: rgba(79, 70, 229, 0.92);
    border-color: rgba(79, 70, 229, 0.65);
    color: #fff;
}

.crop-wrapper {
    position: relative;
    aspect-ratio: 3 / 4;
    width: min(100%, calc(min(68dvh, 100dvh - 210px) * 3 / 4));
    height: auto;
    max-height: min(68dvh, calc(100dvh - 210px));
    margin-inline: auto;
    overflow: hidden;
    background: #111;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-sizing: border-box;
    flex: 0 1 auto;
}

.crop-wrapper img {
    display: block;
    max-width: 100%;
}

.crop-wrapper .cropper-container {
    width: 100% !important;
    height: 100% !important;
}

.cropper-view-box {
    outline: 2px solid #00ff44;
}

.cropper-line,
.cropper-point {
    background-color: #00ff44;
}

.cropper-point {
    width: 12px;
    height: 12px;
}

.cropper-point.point-se {
    width: 16px;
    height: 16px;
    right: -8px;
    bottom: -8px;
}

.cropper-modal {
    background: rgba(0, 0, 0, 0.55);
}

.cropper-dashed {
    border-color: rgba(99, 102, 241, 0.65);
}

.crop-wrapper .cropper-bg {
    background-image: none !important;
    background-color: #111 !important;
}

html.light-mode .crop-wrapper,
html.light-mode .cropper-bg,
html.light-mode .photo-tile {
    background-color: #e2e8f0;
}

code { font-size: 0.85em; }

/* Custom sheet frames for Gelber Notfallschein / generic sheets */
.sheet-frames-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.sheet-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-surface);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.sheet-frame:hover {
    transform: scale(1.02);
}

.sheet-frame-gelb {
    border-color: #eab308; /* yellow */
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.15);
}
.sheet-frame-gelb:hover {
    border-color: #ca8a04;
    box-shadow: 0 4px 16px rgba(234, 179, 8, 0.3);
}

.sheet-frame-empty {
    border-style: dashed;
    background: rgba(26, 29, 36, 0.4);
}
html.light-mode .sheet-frame-empty {
    background: rgba(226, 232, 240, 0.4);
}

.sheet-frame-empty .plus-icon {
    font-size: 2.2rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.sheet-frame-empty span {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    padding: 0 8px;
}

.sheet-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sheet-frame-action {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(15, 17, 21, 0.75);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 10;
}
html.light-mode .sheet-frame-action {
    background: rgba(255, 255, 255, 0.85);
}

.sheet-frame-action:hover {
    background: var(--brand-primary);
    color: #fff;
    transform: scale(1.1);
}

.sheet-frame.is-done {
    cursor: default;
}
.sheet-frame.is-done:hover {
    transform: none;
}

/* Contextual orientation colors for Schein views */

/* Leistungsprotokoll (Upload-Typ notfallschein) */
[data-typ="notfallschein"] .capture-card {
    border: 1px solid #94a3b8;
    box-shadow: 0 4px 14px rgba(148, 163, 184, 0.25);
}
[data-typ="notfallschein"] .capture-empty {
    border-width: 1px;
    border-color: #94a3b8;
}
[data-typ="notfallschein"] .crop-wrapper {
    border: 1px solid #94a3b8;
    aspect-ratio: 4 / 3;
    width: min(100%, calc(min(62dvh, 100dvh - 210px) * 4 / 3));
}
[data-typ="notfallschein"] .editor-toolbar-row {
    width: min(100%, calc(min(62dvh, 100dvh - 210px) * 4 / 3));
}
[data-typ="notfallschein"] .cropper-view-box {
    outline: 2px solid #00ff44;
}
[data-typ="notfallschein"] .cropper-line,
[data-typ="notfallschein"] .cropper-point {
    background-color: #00ff44;
}

/* Gelber Notfallschein */
[data-typ="gelber_schein"] .capture-card {
    border: 1px solid #eab308;
    box-shadow: 0 4px 14px rgba(234, 179, 8, 0.25);
}
[data-typ="gelber_schein"] .capture-empty {
    border-width: 1px;
    border-color: #eab308;
}
[data-typ="gelber_schein"] .crop-wrapper {
    border: 1px solid #eab308;
    /* Schein gelb ist Hochformat (Muster ~3:4) – Editor nicht quer wie LP */
    aspect-ratio: 3 / 4;
    width: min(100%, calc(min(68dvh, 100dvh - 210px) * 3 / 4));
}
[data-typ="gelber_schein"] .editor-toolbar-row {
    width: min(100%, calc(min(68dvh, 100dvh - 210px) * 3 / 4));
}
[data-typ="gelber_schein"] .cropper-view-box {
    outline: 2px solid #00ff44;
}
[data-typ="gelber_schein"] .cropper-line,
[data-typ="gelber_schein"] .cropper-point {
    background-color: #00ff44;
}

/* Container for multiple patient sheet frames */
.sheet-frames-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Overlay Modal */
.capture-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}
.capture-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.overlay-box {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    width: 80%;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.overlay-box p {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.sheet-pair-header {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sheet-pair-header::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--brand-primary);
}

/* Karte lesen – Offline-Liste */
.card-read-modal-box {
    text-align: left;
}
.card-read-modal-box h3 {
    text-align: center;
}
.offline-cards-link {
    appearance: none;
    background: none;
    border: none;
    padding: 4px 0 0;
    margin: 0;
    color: #93c5fd;
    font-size: 0.92rem;
    text-decoration: underline;
    cursor: pointer;
    text-align: center;
    width: 100%;
}
.offline-cards-link:hover,
.offline-cards-link:focus-visible {
    color: #bfdbfe;
}
html.light-mode .offline-cards-link {
    color: #2563eb;
}
html.light-mode .offline-cards-link:hover,
html.light-mode .offline-cards-link:focus-visible {
    color: #1d4ed8;
}
.offline-cards-empty {
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.4;
}
.offline-cards-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(50vh, 320px);
    overflow-y: auto;
    margin-bottom: 4px;
}
.offline-card-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: var(--text-primary);
    cursor: pointer;
}
.offline-card-item:hover,
.offline-card-item:focus-visible {
    border-color: #6366f1;
    outline: none;
}
html.light-mode .offline-card-item {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.offline-card-name {
    font-weight: 600;
    font-size: 1rem;
}
.offline-card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

