:root {
  --paper: #F4F1EA;
  --ink: #1C1915;
  --muted: #726C5E;
  --line: #E4DDD0;
  --green: #2F6F5E;
  --warn: #8C3B2F;
  --warnbg: #ECE2D2;
  --serif: Newsreader, Georgia, serif;
  --sans: "IBM Plex Sans", Arial, sans-serif;
  --dock-h: calc(87px + env(safe-area-inset-bottom));
  --actions-h: calc(88px + env(safe-area-inset-bottom));
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
}

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

button, .btn { appearance: none; -webkit-appearance: none; }

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

a { color: inherit; }

::selection { background: var(--line); color: var(--ink); }

body.home,
body.capture-page,
body.reading-page,
body.edit-page,
body.split-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sheet, .pane, .capture {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.home .sheet,
.edit-page .sheet,
.capture {
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.edit-page .sheet > form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.scroll { flex: 1; overflow: auto; }

.with-dock { padding-bottom: var(--dock-h); }

.pad-actions { padding-bottom: var(--actions-h); }

.brand {
  font: 600 34px var(--serif);
  font-variant: small-caps;
  letter-spacing: .05em;
}

.sub { color: var(--muted); font-size: 14px; margin-top: 5px; }

.top {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}

.top h2 {
  font: 600 25px var(--serif);
  font-variant: small-caps;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.back {
  text-decoration: none;
  font-family: var(--sans);
  font-variant: normal;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
}

.eyebrow, .fieldlabel {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
}

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

.amount {
  font-family: var(--serif);
  color: var(--green);
  font-weight: 500;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.total { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }

.total .hero { font-size: 39px; margin-top: 4px; }

.monthline { margin-top: 6px; }

.month-amount { font-size: 16px; }

.group-entry { padding-top: 16px; }

.group-entry .sectionhead { padding: 0 24px; margin-bottom: 0; }

.group-entry .filters a {
  color: var(--ink);
  border-bottom: 2px solid var(--line);
}

.section { padding: 20px 24px 0; }

.sectionhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.section h3 { font-size: 15px; font-weight: 600; }

.recent { padding-bottom: 8px; }

.recent .row { padding-left: 0; padding-right: 0; }

/* Jedna kolumna: nazwa po lewej, kwota po prawej, liczba pod kwotą. */
.cats {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.cat {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.cat-figures { text-align: right; }

.cat .amount { font-size: 17px; }

.cat-count {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.filters {
  display: flex;
  gap: 18px;
  overflow: auto;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  flex: none;
  scrollbar-width: thin;
}

.filters a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
  min-height: 34px;
}

.filters a.active {
  color: var(--ink);
  font-weight: 700;
  border-bottom: 2px solid var(--ink);
}

.personfilter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.select, .personfilter select {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 9px 12px;
  min-height: 42px;
  width: 100%;
  border-radius: 0;
}

.month {
  padding: 16px 24px 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}

.row {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  text-decoration: none;
  color: inherit;
}

.shop { font-size: 15px; font-weight: 600; }

.row .date { color: var(--muted); font-size: 12px; }

.row-sums {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  text-align: right;
}

.row .amount {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
}

.paper-note {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--sans);
}

.row.current { box-shadow: inset 3px 0 0 var(--ink); }

.review { color: var(--warn); }

.empty { padding: 8px 24px 20px; color: var(--muted); }

.section .empty { padding-left: 0; padding-right: 0; }

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: var(--dock-h);
  box-sizing: border-box;
  padding: 14px 24px calc(21px + env(safe-area-inset-bottom));
  background: linear-gradient(#f4f1ea00, var(--paper) 35%);
}

.home .dock {
  left: 50%;
  right: auto;
  width: min(720px, 100%);
  transform: translateX(-50%);
}

.btn {
  min-height: 52px;
  border: 0;
  border-radius: 3px;
  width: 100%;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0 16px;
  text-align: center;
}

.btn.primary, a.btn.primary {
  background: var(--green);
  color: var(--paper);
}

.btn.secondary, a.btn.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.item-slot { position: relative; }
.item-slot > summary { list-style: none; cursor: pointer; }
.item-slot > summary::-webkit-details-marker { display: none; }
.item-slot[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 250px);
  gap: 8px 12px;
  align-items: start;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.item-slot[open] > summary.row {
  padding: 6px 0;
  border-bottom: 0;
}
.line-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: baseline;
}
.line-name { font-weight: 600; }
.line-group { font-weight: 500; color: var(--muted); font-size: 12px; }
.line-qty, .line-sum { font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.item-panel label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.item-panel input,
.item-panel select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.item-panel-actions { display: flex; gap: 8px; }
.item-panel .btn {
  min-height: 40px;
  width: auto;
  flex: 1;
  border-radius: 6px;
}
.item-panel .btn.primary { background: #d9480f; color: #fff; border: 0; }
.item-panel .btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
@media (max-width: 720px) {
  .item-slot[open] { grid-template-columns: 1fr; }
}

.login {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 440px;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.login form { display: flex; flex-direction: column; }

.accounts { margin-top: 42px; }

.account {
  position: relative;
  height: 60px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 18px;
  cursor: pointer;
}

.account input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.account .mark { margin-left: auto; color: var(--muted); }

.account:not(:has(input:checked)) .mark::before { content: "›"; }

.account:has(input:checked) {
  border-left: 3px solid var(--ink);
  padding-left: 13px;
  font-weight: 700;
}

.account:has(input:checked) .mark { color: var(--ink); }

.account:has(input:checked) .mark::before { content: "✓"; }

.password { margin-top: 28px; }

.underline,
.receipt-fields input,
.item-name,
.item-sub input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: none;
  padding: 11px 2px;
  border-radius: 0;
  font-size: 16px;
  outline: none;
}

.receipt-fields input,
.item-name,
.item-sub input { border-bottom-color: var(--line); padding: 6px 0; }

.loginbtn { margin-top: 22px; }

.form-error { color: var(--warn); font-size: 14px; margin-top: 16px; }

.foot {
  margin-top: auto;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding-top: 30px;
}

.who { position: relative; color: var(--muted); font-size: 14px; }

.who summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.who summary::-webkit-details-marker { display: none; }

.who summary::after { content: "⌄"; margin-left: 4px; }

.who form { margin: 0 0 8px; text-align: right; }

.who button {
  border: 0;
  background: none;
  padding: 8px 0;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.capturehead {
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.view {
  margin: 18px 20px 0;
  flex: 1;
  min-height: 180px;
  background: #282521;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receiptshape {
  width: 60%;
  height: 72%;
  background: #fffdf8;
  box-shadow: 0 8px 18px #0005;
  transform: rotate(-2deg);
  padding: 22px 15px;
  color: #777;
  font-size: 12px;
  text-align: center;
  letter-spacing: .08em;
}

.guide {
  position: absolute;
  inset: 15% 10%;
  border: 2px solid #f4f1ea99;
}

.captureactions {
  padding: 18px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
}

.capture-error { padding: 0 20px; }

.capture-error[hidden] { display: none; }

.wait-list {
  display: none;
  margin: 0;
  padding: 0 20px;
  list-style: none;
}

.capture.has-queue .view {
  display: none;
}

.capture.has-queue .wait-list {
  display: block;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 6px;
}

.wait-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.wait-item img {
  width: 48px;
  height: 64px;
  object-fit: cover;
  flex: none;
  background: #fffdf8;
  border: 1px solid var(--line);
}

.wait-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.wait-x {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.status {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 20px 22px;
  flex: none;
}

.file-btn { position: relative; overflow: hidden; }

.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}

.loading {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 22px 18px;
  text-align: center;
}

.loading-main {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.readlog {
  flex: none;
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 10px 2px 0;
  border-top: 1px solid var(--line);
  list-style: none;
  text-align: left;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.readlog li + li { margin-top: 2px; }

.readlog li:last-child { color: var(--ink); }

.loading h2 { font: 500 26px var(--serif); }

.read-caption {
  margin: 0;
  max-width: 320px;
  font: 500 22px/1.3 var(--serif);
}

.progress {
  width: min(100%, 320px);
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: inherit;
  transition: width .4s ease;
}

.queue-wait {
  width: min(100%, 320px);
  max-height: 96px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
}

.queue-wait li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

.thumb-frame {
  width: 64px;
  height: 80px;
  flex: none;
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px #0002;
  transform: rotate(-3deg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-frame.big { width: 92px; height: 124px; }

.thumb-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .progress-bar { transition: none; }
}

.textbtn {
  min-height: 48px;
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 0;
  color: var(--ink);
}

.receipthead {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.receipt-fields, .receiptinfo { flex: 1; min-width: 0; }

.receiptinfo h2 { font-size: 18px; font-weight: 600; }

.receiptinfo p { font-size: 13px; color: var(--muted); margin-top: 5px; }

.store-input { font-size: 18px; font-weight: 600; }

.field { display: block; margin-top: 12px; }

.split-fields { display: flex; gap: 16px; }

.split-fields .field { flex: 1; min-width: 0; }

.bigsum { padding: 18px 24px; border-bottom: 1px solid var(--line); }

.bigsum .amount { font-size: 37px; }

.sumpair {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: flex-end;
}

.sumpair > * { flex: 1 1 9rem; min-width: 0; }

.bigsum.sumpair .amount,
.sumpair .sum-input { font-size: 30px; }

.meta-sum { padding-top: 10px; padding-bottom: 14px; }

.sum-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: 500 37px var(--serif);
  color: var(--green);
  padding: 4px 0;
  border-radius: 0;
}

.editbody { padding: 18px 24px 8px; }

.select { margin-top: 8px; }

.item-edit { padding: 13px 0; border-bottom: 1px solid var(--line); }

.item-edit.is-aside .item-name,
.item-edit.is-aside .line-sum { color: var(--muted); }

.item-edit.is-aside .count-toggle,
.item-edit [data-remont-toggle][aria-pressed="true"] { color: var(--ink); }

.item-name { display: block; }

.item-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.item-sub label {
  flex: 1 1 38%;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
}

.item-sub input {
  display: block;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--ink);
}

.line-sum {
  flex: 0 0 auto;
  font-family: var(--serif);
  color: var(--green);
  font-size: 18px;
  padding-bottom: 6px;
  white-space: nowrap;
}

.item-sub button {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 0;
  min-height: 44px;
  cursor: pointer;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.add-item { margin: 8px 0 18px; }

.items-sum { margin-top: 8px; }

.items-sum .amount { font-size: 28px; margin-top: 4px; }

.warning {
  margin: 18px 0;
  padding: 11px 12px;
  background: var(--warnbg);
  color: var(--warn);
  font-size: 13px;
}

.warning[hidden] { display: none; }

.grocery-banner p { margin: 0; }

.grocery-banner .btn {
  width: auto;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 18px;
}

.actions {
  display: flex;
  gap: 10px;
  padding: 14px 24px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
  flex: none;
}

.actions .btn, .actions form { flex: 1; }

.actions form { margin: 0; }

.detailitems { padding: 0 24px 12px; }

.detail-item {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  row-gap: 2px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.detail-item .name { grid-column: 1; grid-row: 1; font-size: 14px; }

.detail-item .meta { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 12px; }

.detail-item .amount {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 18px;
  white-space: nowrap;
}

.detail-item.is-aside .name,
.detail-item.is-aside .amount { color: var(--muted); }

.list-total { font-size: 18px; }

.empty-detail {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.message {
  max-width: 440px;
  margin: 0 auto;
  padding: 48px 24px;
}

.message h2 { margin-top: 18px; font: 500 26px var(--serif); }

.message .muted { margin-top: 10px; }

.backline { margin-top: 22px; }

.backline a { text-underline-offset: 3px; }

.split { min-height: 100%; }

.pane { min-height: 100vh; min-height: 100dvh; }

@media (max-width: 899px) {
  .mode-list .detail-pane { display: none; }
  .mode-detail .list-pane { display: none; }
  .mode-detail .actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
  }
  .edit-page .actions {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 0;
    width: min(720px, 100%);
    transform: translateX(-50%);
    z-index: 5;
  }
}

@media (min-width: 900px) {
  .split-page .split {
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .pane {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .detail-pane { border-left: 1px solid var(--line); }
  .split .dock {
    right: auto;
    width: 50%;
  }
  .mode-detail .detail-pane { display: flex; }
  .mode-list .detail-pane { display: flex; }
  .pad-actions { padding-bottom: 24px; }
  .mode-modal .split { display: block; }
  .mode-modal .list-pane { height: 100%; }
  .mode-modal .split .dock { width: auto; right: 0; }
}

/* Okno szczegółu. Wygląd z ai-renovation-receipt-dashboard/src/components/dashboard/ReceiptModal.tsx */
@font-face {
  font-family: "RM Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/rm-manrope-latinext.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: "RM Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/rm-manrope-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;
}
@font-face {
  font-family: "RM Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/rm-space-latinext.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: "RM Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/rm-space-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;
}
@font-face {
  font-family: "RM JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/rm-jet-latinext.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: "RM JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/rm-jet-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;
}

.rm {
  --rm-paper: #f3f1ea;
  --rm-ink: #23221c;
  --rm-soft: #6b675b;
  --rm-faint: #98948a;
  --rm-line: #e5e1d4;
  --rm-linedark: #d5d0bf;
  --rm-accent: #d9480f;
  --rm-accent-deep: #b93c0a;
  --rm-accent-soft: #fdeadd;
  --rm-bad: #b3362b;
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: var(--rm-ink);
  font-family: "RM Manrope", "IBM Plex Sans", Arial, sans-serif;
}

.rm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 34, 28, 0.45);
  backdrop-filter: blur(2px);
}

.rm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 48rem;
  max-height: 92vh;
  overflow: hidden;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.28);
  animation: rm-pop 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.rm-head,
.rm-body,
.rm-foot { padding-left: 20px; padding-right: 20px; }

.rm-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rm-line);
  flex: none;
}

.rm-titleblock { min-width: 0; }

.rm-titleblock h2 {
  font-family: "RM Space Grotesk", "RM Manrope", "IBM Plex Sans", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  font-variant: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-titleblock p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--rm-soft);
}

.rm-x {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--rm-faint);
  text-decoration: none;
}

.rm-x:hover { background: var(--rm-paper); color: var(--rm-ink); }

.rm-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 16px;
  padding-bottom: 16px;
}

.rm-grid { display: grid; gap: 20px; }

.rm-side { display: flex; flex-direction: column; gap: 12px; }

.rm-shot {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  object-position: top center;
  background: #fff;
  border: 1px solid var(--rm-line);
  border-radius: 8px;
}

.rm-missing {
  display: none;
  aspect-ratio: 3 / 4;
  width: 100%;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  border: 1px dashed var(--rm-linedark);
  border-radius: 8px;
  background: rgba(243, 241, 234, 0.6);
  color: var(--rm-faint);
  font-size: 12px;
}

.rm-missing p { margin: 0; padding: 0 16px; }

.rm-photo.is-missing .rm-shotlink { display: none; }

.rm-photo.is-missing .rm-missing { display: grid; }

.rm-raw summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--rm-soft);
}

.rm-raw summary::-webkit-details-marker { display: none; }

.rm-raw summary:hover { color: var(--rm-ink); }

.rm-caret {
  display: inline-block;
  color: var(--rm-faint);
  transition: transform 0.15s ease;
}

.rm-raw[open] .rm-caret { transform: rotate(90deg); }

.rm-raw pre {
  margin: 8px 0 0;
  max-height: 12rem;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 6px;
  background: var(--rm-paper);
  padding: 12px;
  font-family: "RM JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--rm-soft);
}

.rm-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rm-stat {
  min-width: 0;
  border: 1px solid var(--rm-line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 12px;
}

.rm-stat p {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rm-faint);
}

.rm-stat.is-strong {
  border-color: rgba(217, 72, 15, 0.3);
  background: var(--rm-accent-soft);
}

.rm-num {
  font-family: "RM JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--rm-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-stat .rm-num {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--rm-ink);
}

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

.rm-stat.is-strong .rm-num {
  font-weight: 700;
  color: var(--rm-accent-deep);
}

.rm-num.soft { color: var(--rm-soft); font-weight: 400; }

.rm-tablewrap {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--rm-line);
  border-radius: 8px;
}

.rm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.rm-table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rm-line);
  background: rgba(243, 241, 234, 0.7);
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rm-faint);
}

.rm-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(229, 225, 212, 0.6);
  vertical-align: top;
}

.rm-table tr:last-child td { border-bottom: 0; }

.rm-table .num,
.rm-table th.num { text-align: right; white-space: nowrap; }

.line-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.line-name { font-weight: 500; }

.line-group {
  color: var(--rm-soft);
  font-size: 11px;
  font-weight: 600;
}

.rm-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: none;
  padding-top: 14px;
  padding-bottom: 14px;
  border-top: 1px solid var(--rm-line);
  background: rgba(243, 241, 234, 0.6);
}

.rm button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.rm-ghost,
.rm-quiet,
.rm-edit,
.rm-tak,
.rm-nie {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.2;
}

.rm-ghost {
  border: 1px solid var(--rm-line);
  background: #fff;
  color: var(--rm-soft);
  padding: 8px 12px;
  font-size: 12.5px;
}

.rm-ghost:hover { border-color: var(--rm-accent); color: var(--rm-accent); }

.rm-ask:hover { border-color: var(--rm-bad); color: var(--rm-bad); }

.rm-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  background: rgba(179, 54, 43, 0.1);
  padding: 4px 8px;
  color: var(--rm-bad);
  font-size: 12px;
  font-weight: 600;
}

.rm-confirm form { display: flex; margin: 0; }

.rm-tak {
  background: var(--rm-bad);
  color: #fff;
  padding: 4px 10px;
  font-size: 12px;
}

.rm-tak:hover { filter: brightness(1.08); }

.rm-nie {
  color: var(--rm-soft);
  padding: 4px 8px;
  font-size: 12px;
}

.rm-nie:hover { background: rgba(229, 225, 212, 0.6); }

.rm-foot-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rm-quiet {
  color: var(--rm-soft);
  padding: 8px 14px;
  font-size: 13px;
}

.rm-quiet:hover { background: rgba(229, 225, 212, 0.6); color: var(--rm-ink); }

.rm-edit {
  background: var(--rm-ink);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(35, 34, 28, 0.12);
}

.rm-edit:hover { background: rgba(35, 34, 28, 0.85); }

@media (min-width: 640px) {
  .rm { align-items: center; padding: 16px; }
  .rm-card { border-radius: 12px; }
  .rm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .rm-grid { grid-template-columns: 240px minmax(0, 1fr); }
  .rm-shot { max-height: 460px; }
}

@media (max-width: 899px) {
  .mode-modal .list-pane { display: flex; }
  .mode-modal .detail-pane { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rm-card { animation: none; }
  .rm-caret { transition: none; }
}

@keyframes rm-pop {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to { opacity: 1; transform: none; }
}
