/*
  Farbrollen
  --paper/--ink/--line: ausschließlich Dokument
  --action: Fokus, aktive Bedienelemente und primäre Aktion
  --success/--warning/--danger: ausschließlich Status und Rückmeldung
*/
@font-face {
  font-family: "Kalam Local";
  src: url("/static/assets/fonts/Kalam-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fffefa;
  --paper-muted: #f4f2eb;
  --canvas: #e9e8e3;
  --ink: #151715;
  --ink-secondary: #565a56;
  --ink-tertiary: #767a75;
  --line: #373a36;
  --line-soft: #a7aaa5;
  --action: #155fc5;
  --action-strong: #0d47a1;
  --action-soft: #e8f1ff;
  --success: #147647;
  --success-soft: #e8f5ed;
  --warning: #96650c;
  --warning-soft: #fff4d6;
  --danger: #b02924;
  --danger-soft: #fdeceb;
  --font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-form: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  --font-hand: "Kalam Local", "Segoe Print", cursive;
  --sheet-width: min(34rem, calc(100vw - 2rem));
  --focus: 0 0 0 3px color-mix(in srgb, var(--action) 35%, transparent);
}

* {
  box-sizing: border-box;
  touch-action: manipulation;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,.22), rgba(255,255,255,0) 30%),
    var(--canvas);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
}

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

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: rgba(21, 95, 197, .14);
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

/* Anmeldung */
.login-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 40px);
}

.login-paper {
  position: relative;
  width: min(100%, 720px);
  min-height: min(900px, calc(100vh - 32px));
  display: grid;
  align-content: center;
  padding: clamp(32px, 8vw, 88px);
  overflow: hidden;
  background:
    repeating-linear-gradient(to bottom, transparent 0 39px, rgba(55,58,54,.09) 39px 40px),
    var(--paper);
  border: 1px solid #c9c8c3;
  box-shadow: 0 18px 55px rgba(32, 35, 31, .13);
}

.login-form-mark {
  position: absolute;
  top: 34px;
  left: 34px;
  font-family: var(--font-form);
  font-size: clamp(18px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -.03em;
}

.login-number-line {
  position: absolute;
  top: 75px;
  right: 34px;
  width: 28%;
  border-top: 1px solid var(--line);
}

.login-copy {
  max-width: 34rem;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  line-height: 1.2;
}

.login-copy h1 {
  margin: 0 0 10px;
  font-family: var(--font-form);
  font-size: clamp(36px, 8vw, 64px);
  line-height: .98;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.login-copy p:last-child {
  max-width: 36ch;
  margin: 0;
  color: var(--ink-secondary);
  text-wrap: pretty;
}

.login-form {
  width: min(100%, 27rem);
  display: grid;
  gap: 10px;
}

.login-form label,
.form-field label,
.field-label {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .015em;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  color: var(--ink);
  background: #fff;
}

input,
select {
  padding: 0 13px;
}

textarea {
  min-height: 120px;
  padding: 12px 13px;
  line-height: 1.5;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--action);
  outline: 2px solid var(--action);
  outline-offset: 1px;
}

.code-input {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .22em;
  text-align: center;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .01em;
}

.button:disabled {
  cursor: wait;
  opacity: .55;
}

.button-primary {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.button-primary:hover:not(:disabled) {
  background: var(--action-strong);
  border-color: var(--action-strong);
}

.button-secondary {
  background: white;
  border-color: var(--line);
}

.button-danger {
  color: var(--danger);
  background: white;
  border-color: var(--danger);
}

.button-text {
  min-height: 38px;
  justify-self: start;
  padding: 0;
  color: var(--action-strong);
  background: transparent;
  border: 0;
}

.form-hint,
.form-error {
  margin: 0;
  font-size: 13px;
  letter-spacing: .01em;
}

.form-hint {
  color: var(--ink-secondary);
}

.form-error {
  min-height: 22px;
  color: var(--danger);
}

.login-footer {
  position: absolute;
  right: 34px;
  bottom: 30px;
  left: 34px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-tertiary);
  font-family: var(--font-form);
  font-size: 11px;
  letter-spacing: .025em;
}

/* Blatt */
.app-stage {
  position: relative;
  min-height: 100vh;
  padding: clamp(10px, 2.5vw, 30px) clamp(10px, 4vw, 56px) 40px;
}

.paper-viewport {
  width: 100%;
  display: grid;
  place-items: start center;
}

.report-page {
  --paper-font: clamp(6px, 1.15vw, 12px);
  position: relative;
  width: min(100%, 880px, calc((100vh - 64px) * .70707));
  aspect-ratio: 210 / 297;
  display: grid;
  grid-template-rows: 12.5% 60% 12.5% 12%;
  gap: 1%;
  padding: 4.2% 5.2% 3.8%;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 11%, rgba(80,80,70,.025), transparent 18%),
    radial-gradient(circle at 79% 69%, rgba(80,80,70,.02), transparent 22%),
    var(--paper);
  border: 1px solid #c9c8c3;
  box-shadow: 0 18px 55px rgba(32,35,31,.14);
  font-family: var(--font-form);
  font-size: var(--paper-font);
  line-height: 1.15;
}

.paper-fold {
  position: absolute;
  z-index: 8;
  top: -1px;
  right: -1px;
  width: clamp(30px, 5vw, 54px);
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.paper-fold::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(225deg, var(--canvas) 0 48%, var(--line) 49% 51%, #f4f2eb 52% 100%);
  clip-path: polygon(0 0, 100% 100%, 100% 0);
  pointer-events: none;
}

.paper-fold:hover::before,
.paper-fold:focus-visible::before {
  background: linear-gradient(225deg, var(--action-soft) 0 48%, var(--action) 49% 51%, #fff 52% 100%);
}

.ink {
  color: #1d2932;
  font-family: var(--font-hand);
  font-weight: 400;
}

.report-head {
  position: relative;
  display: grid;
  grid-template-columns: 50% minmax(0, 1fr);
  gap: 2%;
  min-height: 0;
}

.report-heading-line {
  display: flex;
  align-items: end;
  gap: 4%;
  padding-bottom: 4%;
}

.report-heading-line h1 {
  margin: 0;
  font-size: 2em;
  font-weight: 800;
  letter-spacing: -.04em;
  white-space: nowrap;
}

.report-number {
  min-width: 12%;
  padding: 0 2% 1%;
  border-bottom: 1px solid var(--line);
  font-size: 2em;
  text-align: center;
}

.head-fields {
  min-width: 0;
  display: grid;
  align-content: end;
  gap: 3%;
  padding-right: 3%;
}

.field-line {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 2%;
}

.field-line > span {
  flex: none;
  color: var(--ink-secondary);
  font-size: .86em;
  font-weight: 700;
  letter-spacing: .025em;
}

.field-line > b {
  min-width: 0;
  flex: 1;
  min-height: 1.35em;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  font-size: 1.38em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#training-job {
  font-size: 1.12em;
}

.head-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr .9fr;
  gap: 3%;
}

.status-stamp {
  position: absolute;
  z-index: 1;
  right: 1.5%;
  bottom: -14%;
  padding: .45em .7em .32em;
  border: 2px solid currentColor;
  color: var(--warning);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  font-family: var(--font-form);
  font-size: 1em;
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1;
  transform: rotate(-4deg);
}

.status-stamp[data-status="submitted"] {
  color: var(--action-strong);
}

.status-stamp[data-status="signed"] {
  color: var(--success);
}

.status-stamp[data-status="changes_requested"] {
  color: var(--danger);
}

.week-paper {
  min-height: 0;
  display: grid;
  grid-template-rows: 7.5% 1fr 5%;
  border: 1px solid var(--line);
}

.week-column-head,
.day-row {
  display: grid;
  grid-template-columns: 5.5% 4.5% 75% 7.5% 7.5%;
}

.week-column-head {
  min-height: 0;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  text-align: center;
}

.week-column-head > span {
  display: grid;
  place-items: center;
  padding: 1% 2%;
  border-right: 1px solid var(--line);
  font-size: .78em;
  line-height: 1.05;
}

.week-column-head > span:last-child {
  border-right: 0;
}

.head-activity {
  letter-spacing: .02em;
  text-align: left;
}

.week-rows {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
}

.day-row {
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.day-row > * {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.day-row > *:last-child {
  border-right: 0;
}

.day-name {
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: .88em;
  font-weight: 700;
  letter-spacing: .025em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.entry-number {
  padding-top: 18%;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.day-content {
  position: relative;
  padding: 1.4% 2.2%;
  overflow: hidden;
  background: repeating-linear-gradient(to bottom, transparent 0 1.6em, rgba(55,58,54,.14) 1.6em calc(1.6em + 1px));
}

.day-content p {
  margin: 0;
  overflow: hidden;
  font-size: 1.45em;
  line-height: 1.15;
  white-space: pre-line;
}

.entry-hours,
.day-total {
  display: grid;
  place-items: center;
  padding: 5%;
  overflow: hidden;
  font-size: 1.55em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.entry-hours {
  grid-auto-rows: min-content;
  align-content: start;
  gap: .18em;
}

.week-total-row {
  display: grid;
  grid-template-columns: 1fr 7.5%;
  min-height: 0;
  font-weight: 700;
}

.week-total-row span {
  align-self: center;
  padding-right: 1.5%;
  text-align: right;
}

.week-total-row b {
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  font-size: 1.45em;
  font-variant-numeric: tabular-nums;
}

.other-paper,
.signature-paper {
  min-height: 0;
}

.other-paper h2,
.signature-paper h2 {
  margin: 0 0 .7%;
  font-size: .88em;
  font-weight: 700;
  letter-spacing: .015em;
}

.other-grid,
.signature-grid {
  height: calc(100% - 1.6em);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.other-grid > div,
.signature-cell {
  position: relative;
  min-width: 0;
  padding: 1.3% 2%;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.other-grid > div:last-child,
.signature-cell:last-child {
  border-right: 0;
}

.other-grid span {
  color: var(--ink-secondary);
  font-size: .8em;
}

.other-grid p {
  margin: 2% 0 0;
  overflow: hidden;
  font-size: 1.3em;
  line-height: 1.2;
  white-space: pre-line;
}

.signature-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 1%;
}

.signature-cell::after {
  content: "";
  position: absolute;
  right: 5%;
  bottom: 29%;
  left: 5%;
  border-top: 1px solid var(--line-soft);
}

.signature-cell img {
  position: absolute;
  z-index: 1;
  bottom: 31%;
  width: 78%;
  height: 55%;
  object-fit: contain;
}

.submission-mark {
  position: absolute;
  bottom: 39%;
  color: var(--success);
  font-size: 1.25em;
  font-weight: 800;
  letter-spacing: .07em;
  transform: rotate(-3deg);
}

.signature-date {
  position: relative;
  z-index: 1;
  width: 90%;
  font-size: .86em;
  font-variant-numeric: tabular-nums;
}

.signature-cell small {
  width: 90%;
  color: var(--ink-secondary);
  font-size: .75em;
}

.zone-hitbox {
  position: absolute;
  z-index: 5;
  left: 4.2%;
  width: 91.6%;
  padding: 0;
  border: 2px solid transparent;
  color: var(--action-strong);
  background: transparent;
  cursor: pointer;
}

.zone-hitbox span {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 4px 7px 3px;
  opacity: 0;
  color: white;
  background: var(--action-strong);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}

.zone-hitbox:hover,
.zone-hitbox:focus-visible {
  border-color: var(--action);
  background: color-mix(in srgb, var(--action) 5%, transparent);
  outline: none;
}

.zone-hitbox:hover span,
.zone-hitbox:focus-visible span {
  opacity: 1;
}

.zone-info { top: 3.8%; height: 13.4%; }
.zone-week { top: 17.8%; height: 60.8%; }
.zone-other { top: 79.2%; height: 12.8%; }
.zone-trainer { top: 92.5%; height: 7%; }

.page-caption {
  margin: 12px 0 0;
  color: var(--ink-secondary);
  font-size: 12px;
  letter-spacing: .015em;
  text-align: center;
}

/* Dokumentnavigation */
.document-dock {
  position: fixed;
  z-index: 15;
  top: 50%;
  right: max(8px, calc((100vw - min(100vw - 112px, 880px)) / 2 - 58px));
  display: grid;
  gap: 2px;
  padding: 5px;
  background: var(--ink);
  transform: translateY(-50%);
}

.dock-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.dock-button {
  position: relative;
  width: 44px;
  height: 44px;
  color: white;
  background: transparent;
}

.dock-button:hover,
.dock-button:focus-visible {
  color: var(--ink);
  background: white;
}

.dock-button svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-button span {
  position: absolute;
  top: 50%;
  right: calc(100% + 9px);
  padding: 5px 7px;
  opacity: 0;
  color: white;
  background: var(--ink);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%);
}

.dock-button:hover span,
.dock-button:focus-visible span {
  opacity: 1;
}

/* Sheets */
.sheet-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(14, 17, 15, .42);
}

.editor-sheet {
  position: fixed;
  z-index: 31;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sheet-width);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: #fbfaf6;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px rgba(18,20,18,.18);
  overscroll-behavior: contain;
}

.sheet-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.sheet-header h2 {
  margin: 0;
  font-family: var(--font-form);
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.icon-button {
  flex: none;
  width: 44px;
  height: 44px;
  background: transparent;
}

.icon-button:hover {
  background: var(--paper-muted);
}

.sheet-content {
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  overscroll-behavior: contain;
}

.sheet-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.sheet-footer .button-primary {
  margin-left: auto;
}

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

.form-field {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.helper-text {
  margin: 5px 0 0;
  color: var(--ink-secondary);
  font-size: 12px;
  letter-spacing: .01em;
}

.day-tabs,
.step-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-soft);
}

.day-tab,
.step-tab {
  min-width: 44px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.day-tab[aria-selected="true"],
.step-tab[aria-selected="true"] {
  border-bottom-color: var(--action);
  color: var(--action-strong);
}

.entry-editor-list {
  display: grid;
  gap: 18px;
}

.entry-editor {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.entry-editor:last-child {
  border-bottom: 0;
}

.entry-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-editor-head h3 {
  margin: 0;
  font-size: 15px;
}

.entry-editor-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.entry-editor textarea {
  min-height: 104px;
  font-family: var(--font-hand);
  font-size: 19px;
}

.text-button {
  min-height: 36px;
  padding: 0;
  border: 0;
  color: var(--danger);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.notice {
  margin: 0 0 16px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  font-size: 13px;
}

.notice-info { border-color: var(--action); background: var(--action-soft); }
.notice-success { border-color: var(--success); background: var(--success-soft); }
.notice-warning { border-color: var(--warning); background: var(--warning-soft); }
.notice-danger { border-color: var(--danger); background: var(--danger-soft); }

.signature-canvas-wrap {
  position: relative;
  margin-top: 12px;
  background: white;
  border: 1px solid var(--line);
}

.signature-canvas-wrap::after {
  content: "";
  position: absolute;
  right: 5%;
  bottom: 28%;
  left: 5%;
  border-top: 1px solid var(--line-soft);
  pointer-events: none;
}

#signature-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 210px;
  display: block;
  cursor: crosshair;
}

.signature-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.learn-intro {
  display: grid;
  gap: 12px;
}

.learn-intro h3,
.review-section h3 {
  margin: 0;
  font-size: 18px;
}

.learn-prompt {
  padding: 14px;
  color: #e9f0eb;
  background: #182019;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.check-list {
  display: grid;
  gap: 9px;
}

.check-row {
  display: flex;
  align-items: start;
  gap: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  margin: 1px 0 0;
}

.person-list,
.review-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.person-row,
.review-row {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.person-row:hover,
.review-row:hover {
  background: rgba(21,95,197,.05);
}

.row-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.row-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title small {
  color: var(--ink-secondary);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
}

.status-dot[data-status="signed"] { background: var(--success); }
.status-dot[data-status="submitted"] { background: var(--action); }
.status-dot[data-status="changes_requested"] { background: var(--danger); }

.metrics-line {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  padding: 13px 10px;
  border-right: 1px solid var(--line-soft);
}

.metric:last-child { border-right: 0; }
.metric strong { display: block; font-size: 25px; font-variant-numeric: tabular-nums; }
.metric span { color: var(--ink-secondary); font-size: 11px; letter-spacing: .03em; text-transform: uppercase; }

.toast {
  position: fixed;
  z-index: 60;
  right: 18px;
  bottom: 18px;
  max-width: min(26rem, calc(100vw - 36px));
  padding: 12px 15px;
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  font-size: 14px;
}

@media (max-width: 760px) {
  .app-stage {
    min-height: 100svh;
    padding: 6px 6px 52px;
  }

  .report-page {
    --paper-font: clamp(4.2px, 1.42vw, 7px);
    width: 100%;
    box-shadow: 0 7px 24px rgba(32,35,31,.12);
  }

  .document-dock {
    top: auto;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    grid-auto-flow: column;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    transform: none;
  }

  .dock-button {
    width: auto;
  }

  .dock-button span {
    display: none;
  }

  .editor-sheet {
    top: auto;
    left: 0;
    width: 100%;
    max-height: min(88svh, 760px);
    border-top: 1px solid var(--line);
    border-left: 0;
    box-shadow: 0 -18px 50px rgba(18,20,18,.2);
  }

  .sheet-header {
    min-height: 70px;
    padding: 14px 16px 11px;
  }

  .sheet-header h2 {
    font-size: 25px;
  }

  .sheet-content {
    padding: 16px;
  }

  .sheet-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .form-grid,
  .entry-editor-grid {
    grid-template-columns: 1fr;
  }

  .form-field-wide {
    grid-column: auto;
  }

  .entry-editor-grid select,
  .entry-editor-grid input {
    max-width: none;
  }

  .zone-hitbox span {
    display: none;
  }
}

@media (max-width: 440px) {
  .login-paper {
    min-height: calc(100svh - 16px);
    padding: 106px 24px 70px;
  }

  .login-form-mark {
    top: 22px;
    left: 24px;
  }

  .login-number-line {
    top: 57px;
    right: 24px;
  }

  .login-footer {
    right: 24px;
    bottom: 20px;
    left: 24px;
  }

  .metrics-line {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

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

@media (prefers-reduced-motion: no-preference) {
  .editor-sheet:not([hidden]) {
    animation: sheet-in 180ms ease-out;
  }

  .toast:not([hidden]) {
    animation: toast-in 160ms ease-out;
  }
}

@keyframes sheet-in {
  from { transform: translateX(20px); }
  to { transform: translateX(0); }
}

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 760px) and (prefers-reduced-motion: no-preference) {
  @keyframes sheet-in {
    from { transform: translateY(18px); }
    to { transform: translateY(0); }
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body,
  .app-stage,
  .paper-viewport {
    width: 210mm;
    height: 297mm;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: white;
  }

  .report-page {
    --paper-font: 9pt;
    width: 210mm;
    height: 297mm;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
  }

  .document-dock,
  .paper-fold,
  .zone-hitbox,
  .page-caption,
  .editor-sheet,
  .sheet-backdrop,
  .toast {
    display: none !important;
  }
}
