/* Von MiniBills-App/web erzeugt — sync-demo.py. Nicht hier editieren. */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif.woff2") format("woff2");
}

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/figtree-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  color-scheme: only light;
  --bg: #f4f2ee;
  --bg-2: #ebe8e2;
  --ink: #141414;
  --ink-soft: #5f5c57;
  --paper: #ffffff;
  --line: #e0ddd6;
  --copper: #b4451a;
  --copper-dark: #8c3010;
  --sage: #3d5a4c;
  --shadow: 0 16px 40px -20px rgba(20, 20, 20, 0.22);
  --sans: "Figtree", "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --header-bg: #ffffff;
  --panel-bg: #ffffff;
  --btn-hover: rgba(20, 20, 20, 0.05);
  --radius: 8px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
}

html {
  color-scheme: light;
  color-scheme: only light;
  background-color: var(--bg);
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--bg);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  color-scheme: light;
}

input,
select,
textarea {
  background-color: var(--paper);
  color: var(--ink);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.nav-btn {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: var(--radius);
}

.nav-btn:hover:not(:disabled) {
  background: var(--btn-hover);
}

.nav-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.mark {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 10px;
}

.brand-name {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  font-style: normal;
  font-synthesis: none;
  letter-spacing: -0.03em;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-more {
  display: block;
  position: relative;
}

.header-more > summary {
  list-style: none;
  cursor: pointer;
  min-width: 42px;
  text-align: center;
  letter-spacing: 0.08em;
}

.header-more > summary::-webkit-details-marker {
  display: none;
}

.header-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 8;
  min-width: 180px;
  display: grid;
  gap: 4px;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.header-more-menu .btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.btn {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 9px 14px;
  cursor: pointer;
  border-radius: var(--radius);
  font-weight: 500;
}

.btn:hover {
  background: var(--btn-hover);
  border-color: #cfcbc3;
}

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

.btn-primary {
  background: var(--copper);
  border-color: var(--copper);
  color: #fffaf2;
}

.btn-primary:hover {
  background: var(--copper-dark);
  border-color: var(--copper-dark);
}

.btn-primary:disabled:hover {
  background: var(--copper);
  border-color: var(--copper);
}

.btn-copper {
  background: var(--copper);
  border-color: var(--copper);
  color: #fffaf2;
}

.btn-copper:hover {
  background: var(--copper-dark);
  border-color: var(--copper-dark);
}

.layout {
  display: grid;
  grid-template-columns: 76px minmax(300px, 400px) 1fr;
  gap: 16px;
  padding: 16px 20px 20px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

.layout > * {
  min-width: 0;
}

.nav-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  position: sticky;
  top: 72px;
  align-self: start;
}

.rail-btn {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 4px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}

.rail-btn:hover {
  background: var(--btn-hover);
  color: var(--ink);
}

.rail-btn[aria-selected="true"] {
  color: var(--copper);
  background: rgba(180, 69, 26, 0.08);
}

.rail-ico {
  display: block;
}

.rail-label {
  display: block;
  text-align: center;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 1px 0 rgba(20, 20, 20, 0.03);
}

.tabs {
  display: none;
}

.tab {
  border: 0;
  background: transparent;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--ink-soft);
  border-radius: var(--radius);
  font-weight: 500;
}

.tab:hover {
  background: var(--btn-hover);
  color: var(--ink);
}

.tab[aria-selected="true"] {
  color: var(--copper);
  background: rgba(180, 69, 26, 0.08);
  box-shadow: inset 0 -2px 0 var(--copper);
}

.panel-body {
  padding: 12px 10px 16px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

body.is-archive .preview-toolbar,
body.is-archive .preview-hint {
  display: none;
}

.archive-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.archive-panel-head h2 {
  margin: 0;
}

.archive-panel .picker-archive-backup {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-panel .picker-list {
  max-height: min(48vh, 520px);
  margin-top: 10px;
}

.archive-panel-actions {
  margin-top: 12px;
}

.inv-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 10px 0 4px;
}

.inv-crumb-btn {
  border: 0;
  background: transparent;
  color: var(--copper);
  padding: 2px 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.inv-crumb-btn:hover {
  text-decoration: underline;
}

.inv-crumb-sep {
  color: var(--ink-soft);
  font-size: 13px;
}

.inv-actions {
  margin-top: 10px;
}

.inv-add-note {
  color: var(--copper);
}

.inv-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
}

.inv-folder {
  grid-template-columns: 28px 1fr auto;
}

.inv-twist {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  width: 28px;
  height: 32px;
  padding: 0;
}

.inv-row-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-width: 0;
}

.inv-row-main strong {
  font-weight: 650;
}

.inv-folder.is-focus,
.inv-root-drop.is-focus {
  border-color: var(--copper);
  box-shadow: inset 0 0 0 1px var(--copper);
}

.inv-drop-over {
  outline: 2px dashed var(--copper);
  outline-offset: 1px;
  background: #f8efe9;
}

.inv-drop-group.inv-drop-over > .inv-row.inv-folder,
.inv-drop-group.inv-drop-over > .inv-drop-body {
  background: #f8efe9;
}

.inv-drop-group {
  border-radius: var(--radius);
}

.inv-drop-body {
  min-height: 8px;
  padding-bottom: 4px;
}

.inv-drop-hint {
  margin: 4px 0 8px;
  font-size: 12px;
}

.inv-row.is-dragging {
  opacity: 0.45;
}

.inv-root-drop {
  background: var(--bg-2);
}

.inv-mini {
  padding: 4px 8px;
  font-size: 12px;
}

.inv-editor {
  background: var(--bg-2);
}

.form-block {
  padding: 14px 10px 16px;
  border-bottom: 1px solid var(--line);
}

.form-block:last-child {
  border-bottom: 0;
  padding-bottom: 8px;
}

.form-block > h2 {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink);
}

.form-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.form-block-head > h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.form-block-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.form-block-tools .icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: var(--radius);
  color: var(--ink-soft);
}

.form-block-tools .icon-btn:hover {
  color: var(--ink);
  background: var(--btn-hover);
}

.panel-body > h2 {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}

.stack {
  display: grid;
  gap: 12px;
}

label.field {
  display: grid;
  gap: 5px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  color: var(--ink-soft);
}

.number-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.number-row input {
  flex: 1;
  min-width: 0;
}

.gear-btn {
  flex: 0 0 40px;
  width: 40px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: var(--radius);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.gear-btn:hover {
  color: var(--ink);
  background: var(--btn-hover);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

#picker-modal {
  z-index: 45;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 20, 16, 0.35);
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 20px 20px;
}

.kit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 52px;
  padding: 10px;
  background: var(--paper);
  border: 1px dashed var(--line);
}

.kit-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: grab;
  user-select: none;
}

.kit-chip.is-dragging {
  opacity: 0.45;
}

.kit-chip.is-over {
  border-color: var(--copper);
  box-shadow: inset 0 0 0 1px var(--copper);
}

.kit-handle {
  color: var(--ink-soft);
  letter-spacing: -1px;
  font-size: 12px;
  line-height: 1;
}

.kit-kind {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.kit-chip input {
  width: 4.2rem;
  padding: 5px 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
}

.kit-chip input[data-kit-text] {
  width: 5.2rem;
}

.kit-chip .icon-btn {
  height: 28px;
  min-width: 28px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
}

.kit-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-card h2 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 8px;
}

.number-preview {
  margin: 0;
  font-size: 15px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.picker-card {
  width: min(1100px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.picker-card.is-archive .picker-list,
.picker-card.is-archive .picker-sheet-clip {
  max-height: min(54vh, 560px);
}

.picker-card.is-archive .picker-layout {
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
}

.picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.picker-head-main {
  min-width: 0;
  flex: 1;
}

.picker-head-main h2 {
  margin-bottom: 8px;
}

.picker-archive-backup:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.picker-archive-backup .btn {
  font-size: 12px;
  padding: 6px 10px;
  white-space: nowrap;
}

.picker-side {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.archive-purge-row:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.archive-purge-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.archive-purge-inline select,
.archive-purge-inline input {
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 2px;
}

.archive-purge-inline input {
  width: 3.4rem;
  padding: 4px 6px;
  font-size: 13px;
}

.archive-purge-row .btn {
  font-size: 12px;
  padding: 4px 9px;
}

.picker-layout {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 16px;
  margin: 12px 0 0;
  align-items: start;
}

.picker-list {
  max-height: min(62vh, 640px);
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

.picker-choice {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.picker-choice:hover {
  background: var(--btn-hover);
}

.picker-choice.is-on {
  background: var(--bg-2);
  box-shadow: inset 3px 0 0 var(--copper);
}

.picker-choice.is-paid strong {
  color: var(--ink-soft);
}

.picker-choice.is-overdue strong {
  color: var(--copper);
}

.picker-paid.is-overdue {
  color: #fffaf2;
  background: var(--copper);
  border-color: var(--copper);
}

.picker-choice strong {
  display: block;
}

.picker-choice .muted {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.picker-choice.picker-arch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  cursor: default;
}

.picker-arch-pick {
  flex: 1 1 140px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.picker-arch-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-left: auto;
  justify-content: flex-end;
}

.picker-paid {
  border: 1px solid var(--line);
  background: var(--paper);
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 2px;
  color: var(--copper);
  white-space: nowrap;
  flex-shrink: 0;
}

.picker-paid.is-paid {
  color: var(--ink-soft);
}

.picker-paid:hover,
.picker-op:hover {
  background: var(--btn-hover);
  color: var(--ink);
}

.picker-op {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  color: var(--ink-soft);
  flex-shrink: 0;
  border-radius: 2px;
}

.picker-preview-wrap > .hint {
  margin: 0 0 8px;
}

.picker-sheet-clip {
  overflow: auto;
  max-height: min(62vh, 720px);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 12px;
}

.picker-sheet-scale {
  transform-origin: top left;
}

.picker-sheet-clip .sheet {
  transform-origin: top left;
}

.picker-empty {
  margin: 8px 4px;
}

.field input,
.field select,
.field textarea {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  width: 100%;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

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

.color-picks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.color-picks input[type="color"] {
  padding: 2px;
  height: 40px;
  cursor: pointer;
  background: var(--paper);
}

#theme-custom .field-hint {
  margin-top: 4px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}

.check[hidden] {
  display: none !important;
}

h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  margin: 4px 0 10px;
  letter-spacing: -0.03em;
}

.hint {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin: 0 0 8px;
}

.muted {
  color: var(--ink-soft);
  font-size: 13px;
}

.item-row {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 52px 64px;
  align-items: stretch;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}

.item-drag {
  display: block;
  cursor: grab;
  background:
    radial-gradient(circle, var(--ink-soft) 1.1px, transparent 1.2px) 50% 30% / 6px 6px repeat-y,
    radial-gradient(circle, var(--ink-soft) 1.1px, transparent 1.2px) 50% 30% / 6px 6px repeat-y;
  background-size: 6px 6px, 6px 6px;
  background-position: 3px 8px, 9px 8px;
  opacity: 0.35;
  border-right: 1px solid var(--line);
}

.item-drag:active {
  cursor: grabbing;
}

.item-row.is-dragging {
  opacity: 0.55;
}

.item-desc-wrap {
  min-width: 0;
  display: flex;
  border-right: 1px solid var(--line);
}

.item-desc-wrap input {
  width: 100%;
  min-height: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: 0;
  font: inherit;
  color: inherit;
}

.item-qty-unit {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.item-qty-unit input {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 4px 6px;
  font-size: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  color: inherit;
}

.item-qty-unit input + input {
  border-top: 1px solid var(--line);
}

.item-row > input[data-k="price"] {
  width: 100%;
  min-height: 100%;
  padding: 6px 26px 6px 6px;
  font-size: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  color: inherit;
}

.item-row > .row-del {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 1;
  width: 22px;
  height: 22px;
  min-width: 22px;
  background: transparent;
  opacity: 0.45;
}

.item-row > .row-del:hover,
.item-row > .row-del:focus-visible {
  opacity: 1;
  background: transparent;
  color: var(--copper);
}

.text-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.text-row:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.text-row-head {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 6px;
  align-items: end;
}

.text-row-head .field {
  margin: 0;
}

.text-row > .field {
  margin: 0;
}

.row-del {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  width: 32px;
  height: 38px;
  min-width: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
  opacity: 0.5;
}

.row-del:hover,
.row-del:focus-visible {
  opacity: 1;
  color: var(--copper);
  background: var(--btn-hover);
  outline: none;
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  height: 36px;
  cursor: pointer;
}

.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 40px;
  overflow-x: auto;
  overflow-y: clip;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  max-width: 100%;
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  width: 100%;
  max-width: 210mm;
  margin: 0 0 10px;
}

.layout-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
}

.layout-bar[hidden] {
  display: none !important;
}

.layout-bar-modes {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.layout-bar-modes .btn {
  border: 0;
  border-radius: 0;
  margin: 0;
}

.layout-bar-modes .btn + .btn {
  border-left: 1px solid var(--line);
}

.layout-bar-modes .btn.is-on,
#layout-grid.is-on {
  background: var(--ink);
  color: var(--paper);
}

.layout-hidden-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  justify-content: center;
}

.layout-hidden-list[hidden] {
  display: none !important;
}

.layout-chip {
  border: 1px dashed var(--ink);
  background: transparent;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
}

.layout-chip:hover {
  background: var(--btn-hover);
}

body.layout-edit .preview-wrap {
  touch-action: pan-y;
}

.preview-hint {
  display: none;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.preview-stage {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.sheet {
  width: 210mm;
  min-width: 210mm;
  min-height: 297mm;
  background: var(--sheet-paper, #fffaf2);
  box-shadow: var(--shadow);
  padding: 18mm 18mm 16mm;
  position: relative;
  color: var(--sheet-ink, #161410);
  font-family: var(--sheet-sans, var(--sans));
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
  transform-origin: top left;
  color-scheme: only light;
  forced-color-adjust: none;
}

.sheet.is-export {
  box-shadow: none;
  transform: none !important;
}

.sheet.demo::after {
  content: "MINIBILLS";
  position: absolute;
  inset: 40% auto auto 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  font-family: var(--sheet-serif, var(--serif));
  font-size: 110px;
  color: var(--sheet-watermark, rgba(180, 69, 26, 0.12));
  letter-spacing: 0.12em;
  pointer-events: none;
}

.sheet:not(.layout-free) {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sheet-row,
.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 24px;
  width: 100%;
  margin-bottom: 0;
}

.sheet-row > .sheet-block,
.sheet-top > .sheet-block {
  flex: 1 1 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.sheet:not(.layout-free) .parties,
.sheet:not(.layout-free) .sheet-text,
.sheet:not(.layout-free) .totals,
.sheet:not(.layout-free) .paybox,
.sheet:not(.layout-free) .legal {
  margin-top: 0;
  margin-bottom: 0;
}

.sheet-intro,
.sheet-text {
  margin: 0 0 18px;
  font-size: 14px;
}

.sheet.layout-edit .sheet-text.is-placeholder {
  min-height: 18px;
  margin: 0;
}

.sheet-block {
  position: relative;
}

.sheet.layout-free {
  min-height: 297mm;
}

.sheet.layout-free .sheet-block {
  position: absolute;
  min-width: 36mm;
  min-height: 12mm;
  max-width: 210mm;
}

.sheet.layout-free .sheet-block-inner {
  height: 100%;
  overflow: hidden;
}

.sheet.layout-grid {
  background-image:
    repeating-linear-gradient(
      to right,
      rgba(22, 20, 16, 0.06) 0,
      rgba(22, 20, 16, 0.06) 1px,
      transparent 1px,
      transparent 4mm
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(22, 20, 16, 0.06) 0,
      rgba(22, 20, 16, 0.06) 1px,
      transparent 1px,
      transparent 4mm
    );
}

.sheet.layout-edit .sheet-block {
  outline: 1px dashed rgba(22, 20, 16, 0.22);
  outline-offset: 4px;
  cursor: grab;
}

.sheet.layout-edit .sheet-block.is-dragging,
.sheet.layout-edit .sheet-block.is-resizing {
  cursor: grabbing;
  z-index: 6;
  outline-color: var(--sheet-accent, #b4451a);
  box-shadow: 0 10px 28px -18px rgba(40, 28, 12, 0.45);
}

.sheet.layout-edit .sheet-block.is-drop-top::before,
.sheet.layout-edit .sheet-block.is-drop-bottom::after,
.sheet.layout-edit .sheet-block.is-drop-left::before,
.sheet.layout-edit .sheet-block.is-drop-right::after {
  content: "";
  position: absolute;
  background: var(--sheet-accent, #b4451a);
  pointer-events: none;
  z-index: 4;
}

.sheet.layout-edit .sheet-block.is-drop-top::before,
.sheet.layout-edit .sheet-block.is-drop-bottom::after {
  left: 0;
  right: 0;
  height: 3px;
}

.sheet.layout-edit .sheet-block.is-drop-left::before,
.sheet.layout-edit .sheet-block.is-drop-right::after {
  top: 0;
  bottom: 0;
  width: 3px;
}

.sheet.layout-edit .sheet-block.is-drop-top::before {
  top: -2px;
}

.sheet.layout-edit .sheet-block.is-drop-bottom::after {
  bottom: -2px;
}

.sheet.layout-edit .sheet-block.is-drop-left::before {
  left: -2px;
}

.sheet.layout-edit .sheet-block.is-drop-right::after {
  right: -2px;
}

.sheet.layout-edit .sheet-block.is-snap-top {
  box-shadow: 0 -3px 0 var(--sheet-accent, #b4451a);
}

.sheet.layout-edit .sheet-block.is-snap-bottom {
  box-shadow: 0 3px 0 var(--sheet-accent, #b4451a);
}

.sheet.layout-edit .sheet-block.is-snap-left {
  box-shadow: -3px 0 0 var(--sheet-accent, #b4451a);
}

.sheet.layout-edit .sheet-block.is-snap-right {
  box-shadow: 3px 0 0 var(--sheet-accent, #b4451a);
}

.sheet.layout-edit .sheet-block.is-snap-top.is-snap-left {
  box-shadow: 0 -3px 0 var(--sheet-accent, #b4451a), -3px 0 0 var(--sheet-accent, #b4451a);
}

.sheet.layout-edit .sheet-block.is-snap-top.is-snap-right {
  box-shadow: 0 -3px 0 var(--sheet-accent, #b4451a), 3px 0 0 var(--sheet-accent, #b4451a);
}

.sheet.layout-edit .sheet-block.is-snap-bottom.is-snap-left {
  box-shadow: 0 3px 0 var(--sheet-accent, #b4451a), -3px 0 0 var(--sheet-accent, #b4451a);
}

.sheet.layout-edit .sheet-block.is-snap-bottom.is-snap-right {
  box-shadow: 0 3px 0 var(--sheet-accent, #b4451a), 3px 0 0 var(--sheet-accent, #b4451a);
}

.layout-resize {
  display: none;
  position: absolute;
  z-index: 5;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
}

.sheet.layout-edit.layout-free .layout-resize {
  display: block;
}

.layout-resize::after {
  content: "";
  position: absolute;
  background: var(--sheet-accent, #b4451a);
  opacity: 0.4;
  pointer-events: none;
}

.sheet-block:hover .layout-resize::after,
.sheet-block.is-resizing .layout-resize::after,
.layout-resize:focus-visible::after {
  opacity: 0.95;
}

.layout-resize[data-layout-resize="n"],
.layout-resize[data-layout-resize="s"] {
  left: 14px;
  right: 14px;
  height: 10px;
  cursor: ns-resize;
}

.layout-resize[data-layout-resize="n"] { top: 0; }
.layout-resize[data-layout-resize="s"] { bottom: 0; }

.layout-resize[data-layout-resize="n"]::after,
.layout-resize[data-layout-resize="s"]::after {
  left: 22%;
  right: 22%;
  height: 3px;
  border-radius: 2px;
}

.layout-resize[data-layout-resize="n"]::after { top: 3px; }
.layout-resize[data-layout-resize="s"]::after { bottom: 3px; }

.layout-resize[data-layout-resize="e"],
.layout-resize[data-layout-resize="w"] {
  top: 14px;
  bottom: 14px;
  width: 10px;
  cursor: ew-resize;
}

.layout-resize[data-layout-resize="e"] { right: 0; }
.layout-resize[data-layout-resize="w"] { left: 0; }

.layout-resize[data-layout-resize="e"]::after,
.layout-resize[data-layout-resize="w"]::after {
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 2px;
}

.layout-resize[data-layout-resize="e"]::after { right: 3px; }
.layout-resize[data-layout-resize="w"]::after { left: 3px; }

.layout-resize[data-layout-resize="ne"],
.layout-resize[data-layout-resize="nw"],
.layout-resize[data-layout-resize="se"],
.layout-resize[data-layout-resize="sw"] {
  width: 14px;
  height: 14px;
}

.layout-resize[data-layout-resize="ne"],
.layout-resize[data-layout-resize="sw"] { cursor: nesw-resize; }

.layout-resize[data-layout-resize="nw"],
.layout-resize[data-layout-resize="se"] { cursor: nwse-resize; }

.layout-resize[data-layout-resize="ne"] { top: 0; right: 0; }
.layout-resize[data-layout-resize="nw"] { top: 0; left: 0; }
.layout-resize[data-layout-resize="se"] { bottom: 0; right: 0; }
.layout-resize[data-layout-resize="sw"] { bottom: 0; left: 0; }

.layout-resize[data-layout-resize="ne"]::after,
.layout-resize[data-layout-resize="nw"]::after,
.layout-resize[data-layout-resize="se"]::after,
.layout-resize[data-layout-resize="sw"]::after {
  width: 8px;
  height: 8px;
  border-radius: 1px;
}

.layout-resize[data-layout-resize="ne"]::after { top: 2px; right: 2px; }
.layout-resize[data-layout-resize="nw"]::after { top: 2px; left: 2px; }
.layout-resize[data-layout-resize="se"]::after { bottom: 2px; right: 2px; }
.layout-resize[data-layout-resize="sw"]::after { bottom: 2px; left: 2px; }

.layout-guides {
  position: absolute;
  left: 0;
  top: 0;
  width: 210mm;
  height: 297mm;
  pointer-events: none;
  z-index: 8;
}

.layout-guide {
  position: absolute;
  background: var(--sheet-accent, #b4451a);
}

.layout-guide.is-v {
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
}

.layout-guide.is-h {
  left: 0;
  right: 0;
  height: 2px;
  margin-top: -1px;
}

.layout-guide[hidden] {
  display: none !important;
}

.layout-ui {
  position: absolute;
  top: -10px;
  left: -4px;
  z-index: 3;
  display: flex;
  gap: 4px;
  pointer-events: auto;
}

.layout-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--sheet-line, #d5ccbb);
  border-radius: 4px;
  background: var(--sheet-paper, #fffaf2);
  color: var(--sheet-ink, #161410);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.layout-handle {
  cursor: grab;
  touch-action: none;
  background-image: radial-gradient(circle, var(--sheet-ink, #161410) 1.1px, transparent 1.2px);
  background-size: 6px 6px;
  background-position: 4px 4px;
}

.layout-handle:active {
  cursor: grabbing;
}

.sheet-field > .layout-ui {
  left: auto;
  right: -2px;
  top: -8px;
  opacity: 0;
}

.sheet-field:hover > .layout-ui,
.sheet-field:focus-within > .layout-ui {
  opacity: 1;
  z-index: 7;
}

.layout-eye {
  position: relative;
}

.layout-eye::after,
.layout-tint::after,
.layout-type::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 8px;
  background: var(--sheet-ink, #161410);
  color: var(--sheet-paper, #fffaf2);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
}

.layout-eye:hover::after,
.layout-eye:focus-visible::after,
.layout-tint:hover::after,
.layout-tint:focus-within::after,
.layout-type:hover::after,
.layout-type:focus-visible::after {
  opacity: 1;
}

.layout-type {
  position: relative;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.layout-type-pop {
  position: fixed;
  z-index: 60;
  min-width: 220px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layout-type-pop[hidden] {
  display: none !important;
}

.layout-type-pop .field {
  margin: 0;
}

.layout-type-pop .item-actions {
  margin: 0;
}

.layout-tint {
  position: relative;
  overflow: visible;
  cursor: pointer;
}

.layout-tint input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  cursor: pointer;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

.layout-tint input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.layout-tint input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 2px;
}

.layout-tint input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 2px;
}

.sheet-field {
  position: relative;
}

.sheet-field.has-color,
.sheet-field.has-color .kicker,
.sheet-field.has-color .label,
.sheet-field.has-color strong,
.sheet-field.has-color .paybox,
.sheet-field.has-color .paybox strong,
.sheet-field.has-color table.positions th,
.sheet-field.has-color .grand {
  color: var(--field-ink);
}

.sheet-field.has-font,
.sheet-field.has-font * {
  font-family: var(--field-font) !important;
}

.sheet-field.has-size {
  font-size: var(--field-size);
}

.sheet-field.has-size .doc-title,
.sheet-field.has-size strong.doc-title,
.sheet-field.has-size h1 {
  font-size: 1em;
}

.sheet-field.has-size table.positions,
.sheet-field.has-size table.positions td {
  font-size: 1em;
}

.sheet-field.has-size table.positions th {
  font-size: 0.82em;
}

body.layout-edit .sheet-field > .layout-ui {
  opacity: 1;
}

.meta .sheet-field.has-color,
.meta .sheet-field.has-color strong {
  color: var(--field-ink);
}

.sheet-ph {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sheet-muted, #5c574e);
  padding: 4px 0;
}

.meta .sheet-field {
  display: block;
}

.sheet.is-export .layout-ui,
.sheet.is-export .layout-resize,
.sheet.is-export .sheet-ph,
.sheet.is-export .sheet-field.is-off,
.sheet.is-export .sheet-field.is-empty {
  display: none !important;
}

.sheet:not(.layout-edit) .layout-ui,
.sheet:not(.layout-edit) .layout-resize {
  display: none !important;
}

body.layout-edit .sheet-block,
body.layout-edit .layout-handle,
body.layout-edit .layout-resize {
  touch-action: none;
}

body.layout-edit .sheet-block,
body.layout-dragging {
  user-select: none;
  -webkit-user-select: none;
}

.logo {
  max-width: 160px;
  max-height: 72px;
  object-fit: contain;
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sheet-accent, #b4451a);
  margin: 0 0 6px;
}

.sheet h1 {
  font-family: var(--sheet-serif, var(--serif));
  font-size: 54px;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.meta {
  text-align: right;
  font-size: 13px;
  line-height: 1.55;
  color: var(--sheet-muted, #5c574e);
}

.meta strong {
  color: var(--sheet-ink, #161410);
  font-weight: 600;
}

.parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 8px 0 28px;
  font-size: 14px;
  line-height: 1.5;
}

.sheet-field .label,
.parties .label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sheet-muted, #5c574e);
  margin-bottom: 6px;
}

table.positions {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.positions th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sheet-muted, #5c574e);
  font-weight: 600;
  border-bottom: 1px solid var(--sheet-ink, #161410);
  padding: 0 8px 8px 0;
}

table.positions td {
  padding: 11px 8px 11px 0;
  border-bottom: 1px solid var(--sheet-line, #d5ccbb);
  vertical-align: top;
}

table.positions .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.totals {
  width: min(320px, 100%);
  margin-left: auto;
  margin-top: 18px;
  font-size: 14px;
}

.totals .sheet-field > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
}

.totals .grand {
  border-top: 1px solid var(--sheet-ink, #161410);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 18px;
  font-family: var(--sheet-serif, var(--serif));
}

.paybox,
.legal {
  margin-top: 28px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--sheet-muted, #5c574e);
}

.paybox {
  background: var(--sheet-pay, #f3ece0);
  padding: 14px 16px;
  color: var(--sheet-ink, #161410);
}

.paybox strong {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--sheet-sage, #3d5a4c);
}

.archive-item,
.client-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.archive-item {
  align-items: center;
  flex-wrap: nowrap;
}

.archive-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.archive-meta strong,
.archive-meta .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.archive-actions .btn {
  padding: 4px 7px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.archive-purge {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.archive-months {
  display: flex;
  align-items: center;
  gap: 8px;
}

.archive-months input {
  width: 5.5rem;
}

.archive-months span {
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.field-hint {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--copper-dark);
}

.logo-row {
  display: grid;
  gap: 8px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.backup-block {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.backup-block .hint {
  margin: 0 0 10px;
}

.archive-open-sum {
  margin: 0 0 12px;
  font-size: 14px;
}

.list-more {
  margin: 10px 0 0;
  font-size: 13px;
}

.archive-item.is-paid .archive-meta strong {
  color: var(--ink-soft);
}

.demo-banner {
  background: var(--copper);
  color: #fffaf2;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
  align-items: center;
}

.demo-banner a,
.demo-legal {
  width: 100%;
  font-size: 12px;
  opacity: 0.92;
}


body.demo-lock .modal {
  display: none !important;
}

.full-version-toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 650;
  pointer-events: none;
}

.full-version-toast[hidden] {
  display: none !important;
}

.guide-page .guide {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 22px 80px;
}

.guide h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 52px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 8px 0 16px;
}

.guide .lead {
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 40px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.guide-toc a {
  color: var(--ink);
  font-size: 14px;
}

.guide section {
  margin-bottom: 36px;
  scroll-margin-top: 80px;
}

.guide h2 {
  font-size: 32px;
  margin: 0 0 12px;
}

.guide h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  margin: 20px 0 8px;
}

.guide p,
.guide li,
.guide dd {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
}

.guide ul,
.guide ol {
  margin: 0 0 14px;
  padding-left: 1.2em;
}

.guide li + li {
  margin-top: 6px;
}

.guide code {
  font-size: 0.92em;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 2px;
}

.guide dl {
  margin: 0;
}

.guide dt {
  font-weight: 600;
  margin-top: 16px;
}

.guide dd {
  margin: 4px 0 0;
  color: var(--ink-soft);
}

.guide-end {
  margin: 40px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .nav-rail {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: visible;
    gap: 0;
    padding: 4px;
    width: 100%;
  }

  .rail-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 6px 2px;
    gap: 2px;
    font-size: 9px;
  }

  .rail-ico {
    width: 16px;
    height: 16px;
  }

  .rail-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-header {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    gap: 6px;
  }

  .header-actions > .btn,
  .header-more > summary {
    flex: 1;
    min-height: 40px;
    padding: 6px 8px;
    font-size: 13px;
    touch-action: manipulation;
  }

  .header-more-menu {
    left: auto;
    right: 0;
    min-width: min(220px, calc(100vw - 24px));
  }

  .header-more-menu .btn {
    min-height: 44px;
  }

  .panel-body {
    max-height: none;
  }

  .item-row {
    grid-template-columns: 14px minmax(0, 1fr) 52px 64px;
  }

  .item-desc-wrap {
    grid-column: 2 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .item-drag {
    grid-row: 1 / span 2;
  }

  .item-row > input[data-k="price"] {
    padding-right: 28px;
  }

  .text-row-head {
    grid-template-columns: 1fr 44px;
  }

  .text-row-head .row-del {
    width: 40px;
    height: 44px;
    min-width: 40px;
  }

  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .icon-btn.picker-op {
    min-width: 32px;
    min-height: 32px;
    width: 32px;
    height: 32px;
  }

  .preview-wrap {
    padding: 0 0 24px;
    width: 100%;
  }

  .preview-hint {
    display: block;
    align-self: flex-start;
  }

  .color-picks {
    grid-template-columns: 1fr;
  }

  .archive-purge {
    grid-template-columns: 1fr;
  }

  .picker-layout,
  .picker-card.is-archive .picker-layout {
    grid-template-columns: 1fr;
  }

  .picker-list,
  .picker-sheet-clip {
    max-height: 28vh;
  }
}

@media (max-width: 520px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .rail-btn {
    min-height: 40px;
    padding: 4px 1px;
    font-size: 8px;
  }

  .rail-ico {
    width: 15px;
    height: 15px;
  }
}

@media print {
  html,
  body {
    color-scheme: only light !important;
    background: #fff;
    color: #161410;
  }

  body {
    background: var(--sheet-paper, white);
  }

  .no-print,
  .guide-toc {
    display: none !important;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .preview-wrap {
    display: block;
    overflow: visible;
    padding: 0;
  }

  .preview-hint {
    display: none !important;
  }

  .preview-stage {
    overflow: visible;
    width: 210mm !important;
    height: auto !important;
  }

  .sheet {
    box-shadow: none;
    width: 210mm;
    min-width: 210mm;
    min-height: 297mm;
    padding: 18mm 18mm 16mm;
    background: var(--sheet-paper, white);
    transform: none !important;
  }

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