/* hallmark 2.0.0 | theme: dakimakura-shop | shape: workbench | signature: centimetre rulers on the 145 by 95 sheet */
/* critique: the cloth sheet is the screen; the rails only hold the arts and the order */

:root {
  --bg: #f4f8fb;
  --paper: #ffffff;
  --ink: #16324a;
  --muted: #5b7386;
  --line: #d7e4ee;
  --accent: #2aa8d1;
  --accent-hover: #1c93b8;
  --accent-ink: #ffffff;
  --accent-soft: #e7f6fb;
  --warn: #9a3d2f;
  --shadow: 0 18px 40px rgba(22, 50, 74, 0.14);
  --radius: 12px;
  --bar: 64px;
  --rail: 248px;
  --order: 300px;
  --font: Manrope, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
}

button, input, textarea { font: inherit; color: inherit; }

button, .add, .send, a.send {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection { background: var(--accent-soft); color: var(--ink); }

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--bar) minmax(0, 1fr);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-mark { font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.brand-size { color: var(--muted); font-weight: 600; }

.views { display: flex; gap: 4px; }
.view-btn {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}
.view-btn.is-on { background: var(--accent-soft); color: var(--ink); }

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--order);
}

.rail, .order {
  min-height: 0;
  overflow: auto;
  background: var(--paper);
  padding: 18px 16px 24px;
}

.rail { border-right: 1px solid var(--line); }
.order { border-left: 1px solid var(--line); }

.pagebar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.page-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 14px;
}
.page-btn.is-on { background: var(--accent-soft); border-color: var(--accent); }

.rail-head, .row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

h1, h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
  overflow-wrap: break-word;
  min-width: 0;
  text-wrap: balance;
}
h1 { font-size: 22px; }
h2 { font-size: 18px; margin-bottom: 10px; }

.add, .ghost, .send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 8px 12px;
  font-weight: 700;
  text-decoration: none;
}

.add:hover, .ghost:hover { background: var(--accent-soft); }

.send {
  width: 100%;
  margin-top: 8px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 16px;
}
.send img { filter: brightness(10); }
.send:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.send:disabled { opacity: 0.55; cursor: wait; }
#done-files { display: flex; flex-direction: column; gap: 8px; }

.inbox-lock { max-width: 320px; margin-top: 18px; }
.inbox-lock .send { width: auto; }
.art-list, .inbox-list { list-style: none; margin: 14px 0 0; padding: 0; }

.art-list li, .inbox-list li { margin: 0 0 8px; }

.art-btn, .inbox-card {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid transparent;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px;
}

.art-btn.is-on { border-color: var(--accent); background: var(--accent-soft); }

.thumb, .inbox-card img {
  width: 48px;
  height: 64px;
  object-fit: contain;
  background: var(--paper);
  border-radius: 6px;
}

.art-btn > span { display: grid; min-width: 0; }
.art-btn b, .inbox-card b {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.quiet { color: var(--muted); font-size: 14px; line-height: 1.45; }
.measure { margin: 0 0 4px; font-variant-numeric: tabular-nums; font-weight: 700; }
.warn { color: var(--warn); font-size: 14px; font-weight: 700; }

.block { margin-bottom: 22px; }
.field { display: grid; gap: 6px; margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  font-weight: 500;
}
.field textarea { resize: vertical; }

.table {
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 28px 16px 16px 40px;
}

.sheet-frame {
  width: 100%;
  height: 100%;
  container-type: size;
  display: grid;
  place-items: center;
}

.sheet-box {
  position: relative;
  width: min(100cqw, calc(100cqh * 145 / 95));
}

.ruler { position: absolute; color: var(--muted); font-size: 11px; font-weight: 700; }
.ruler-x { left: 0; right: 0; bottom: 100%; height: 22px; }
.ruler-y { top: 0; bottom: 0; right: 100%; width: 32px; }

.tick { position: absolute; font-variant-numeric: tabular-nums; }
.ruler-x .tick { top: 4px; transform: translateX(-50%); }
.ruler-y .tick { right: 4px; transform: translateY(-50%); }

.sheet {
  position: relative;
  width: 100%;
  aspect-ratio: 145 / 95;
  background: var(--paper);
  box-shadow: var(--shadow);
  touch-action: none;
  overflow: clip;
}

.margin {
  position: absolute;
  left: calc(1.1 / 145 * 100%);
  top: calc(1.1 / 95 * 100%);
  right: calc(1.1 / 145 * 100%);
  bottom: calc(1.1 / 95 * 100%);
  border: 1px dashed var(--line);
  pointer-events: none;
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}

.piece {
  position: absolute;
  cursor: grab;
  outline: 1px solid transparent;
}
.piece.is-on { outline: 2px solid var(--accent); z-index: 2; }
.piece.is-bad { outline-color: var(--warn); }
.piece img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--img-w);
  height: var(--img-h);
  transform: translate(-50%, -50%) rotate(var(--rot));
  pointer-events: none;
  user-select: none;
}
.handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  padding: 0;
  cursor: nwse-resize;
}

.inbox { padding: 28px 32px 48px; overflow: auto; }
.inbox-card {
  grid-template-columns: 92px minmax(0, 1fr);
  max-width: 760px;
  align-items: center;
}
.inbox-card img { width: 92px; height: 60px; }
.inbox-card a { margin-right: 12px; font-weight: 800; color: var(--accent); }

#done-preview {
  width: 100%;
  height: auto;
  margin: 8px 0 12px;
  background: var(--bg);
}

@media (max-width: 980px) {
  .app { height: auto; min-height: 100dvh; }
  .workspace { grid-template-columns: 1fr; }
  .rail, .order { border: 0; }
  .table { padding: 36px 12px 12px; }
  .sheet-box { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}

.order-page {
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 36px;
}

.order-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.order-head h2 { margin: 0; }
.order-head .note { margin: 4px 0 0; }

.order-layout {
  display: grid;
  gap: 18px;
  align-items: start;
}

.order-layout.has-map { grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); }
.order-layout:not(.has-map) { grid-template-columns: minmax(280px, 640px); }

.order-page .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.order-page .ghost {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.order-page .checkout label:not(.check) {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.order-page .checkout input,
.order-page .checkout textarea,
.order-page .point-list select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.order-page .note { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

.ship-methods { display: grid; gap: 8px; margin-top: 12px; }

.order-page .chip {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 700;
  text-align: left;
}

.order-page .chip.is-on,
.order-page .chip:hover,
.order-page .ghost:hover { border-color: var(--accent); background: var(--accent-soft); }

.city-box { position: relative; }

.city-list {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow: auto;
}

.city-list button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px;
}

.city-list button:hover { background: var(--accent-soft); }

.grid-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.order-page .check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fbfd;
  line-height: 1.45;
}

.order-page .check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.order-page .check + .check { margin-top: 8px; }
.order-page .check a { color: var(--accent-hover); font-weight: 700; }

.picked {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #8fd0e6;
  border-radius: 14px;
  background: var(--accent-soft);
}

.picked span { color: var(--muted); font-size: 13px; }

.totals { margin-top: 14px; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }

#pickup-map {
  height: min(68vh, 640px);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #e7f1f6;
}

.point-list { display: grid; gap: 4px; margin-top: 12px; font-size: 13px; color: var(--muted); }

.map-card h2 { margin: 0 0 10px; font-size: 16px; }

.order-done { display: grid; gap: 8px; }
.order-done p { margin: 0; color: var(--muted); line-height: 1.45; }
.order-done .order-sums { color: var(--ink); font-size: 16px; font-weight: 600; }
.order-sums strong { font-weight: 800; }
.order-done ul { margin: 4px 0 0; padding-left: 18px; }
.order-done li { margin: 4px 0; }

.order-page .cta {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 14px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 16px;
  text-align: center;
  text-decoration: none;
}

.order-page .cta:hover { background: var(--accent-hover); }
.order-page .cta-secondary {
  margin-top: 8px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.order-page .cta-secondary:hover { background: var(--accent-soft); }

#cdek-code[readonly],
#cdek-address[readonly],
#post-office[readonly] { background: var(--bg); }

@media (max-width: 980px) {
  .order-layout.has-map { grid-template-columns: 1fr; }
  #pickup-map { min-height: 280px; height: 420px; }
}
