/* Demo pages, on top of styles.css tokens: the app shell, the order board and the quote calculator. */

:root { --amber: #8a5a00; --amber-bg: #fff4dc; --brick-bg: #fbe9e4; --brick-ink: #9c3b27; --ok-bg: #e5f2ec; --blue: #2b4c7e; --blue-bg: #e8eef8; }

.demo-page { background: var(--surf); min-height: 100vh; padding: 32px 0 64px; }
.demo-intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.demo-intro h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1; font-weight: 900; font-stretch: 72%; }
.demo-intro p { color: var(--mut); max-width: 40em; margin-top: 8px; }
.demo-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mut); }
.demo-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* App window */
.app { display: grid; grid-template-columns: 64px minmax(0, 1fr); background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 32px 64px -40px rgba(27, 27, 27, 0.35); min-height: 640px; }
.app-side { background: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0; }
.app-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--board); color: #fff; display: grid; place-items: center; font-weight: 900; font-stretch: 80%; margin-bottom: 16px; }
.app-nav { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #9a948c; }
.app-nav[aria-current] { background: #2e2e2e; color: #fff; }
.app-nav svg { width: 20px; height: 20px; }
.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-top { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.app-top h2 { font-size: 18px; font-weight: 800; white-space: nowrap; }
.app-top h2 small { display: block; font-size: 12px; font-weight: 500; color: var(--mut); }
.app-search { flex: 1; max-width: 360px; margin-left: auto; position: relative; }
.app-search input { min-height: 40px; padding: 8px 12px 8px 36px; font-size: 15px; border-radius: 10px; border-width: 1px; }
.app-search svg { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--mut); }
.app-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--ink); color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.app-btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.app-btn.ghost:hover { border-color: var(--ink); }
.app-btn svg { width: 16px; height: 16px; }

/* KPI row */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 24px 0; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.kpi p { font-size: 13px; color: var(--mut); }
.kpi b { display: block; font-size: 28px; font-weight: 900; font-stretch: 80%; line-height: 1.1; margin-top: 4px; }
.kpi.warn b { color: var(--brick-ink); }
.kpi.ok b { color: var(--ok); }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 24px 24px; flex: 1; align-items: start; }
.col { background: var(--surf); border-radius: 12px; padding: 8px; min-height: 360px; border: 2px solid transparent; transition: border-color 0.15s; }
.col.over { border-color: var(--ink); background: #efece8; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 12px; font-size: 14px; font-weight: 800; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.col-head .n { font-weight: 600; color: var(--mut); background: #fff; border-radius: 999px; padding: 0 8px; font-size: 13px; }
.col[data-col="Ny"] .dot { background: #9a948c; }
.col[data-col="I gang"] .dot { background: var(--blue); }
.col[data-col="Klar til afhentning"] .dot { background: var(--ok); }
.col[data-col="Afhentet"] .dot { background: var(--ink); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(27, 27, 27, 0.04); position: relative; }
.card:hover { border-color: #cfc8c0; }
.card.dragging { opacity: 0.4; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--mut); }
.card-top .tag { margin-right: auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 4px; }
.card h3 { font-size: 16px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card p { font-size: 14px; color: var(--ink); margin-top: 2px; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px; background: var(--surf); color: var(--mut); white-space: nowrap; }
.chip.late { background: var(--brick-bg); color: var(--brick-ink); }
.chip.today { background: var(--amber-bg); color: var(--amber); }
.chip.done { background: var(--ok-bg); color: var(--ok); }
.tag { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; color: var(--mut); }
.mek { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: var(--ink); flex: none; }
.mek.b { background: var(--board); }
.price { font-size: 13px; font-weight: 700; white-space: nowrap; }
.moves { display: flex; gap: 4px; margin-left: auto; }
.moves button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; font: inherit; font-size: 14px; line-height: 1; }
.moves button:hover { border-color: var(--ink); }
mark { background: #ffe9a8; color: inherit; border-radius: 2px; }

/* Slide-over for a new order */
.sheet-over { position: fixed; inset: 0; background: rgba(27, 27, 27, 0.35); display: flex; justify-content: flex-end; z-index: 50; }
.sheet-over[hidden] { display: none !important; }
.panel { width: min(420px, 100%); background: #fff; height: 100%; padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: -24px 0 48px -24px rgba(0, 0, 0, 0.3); }
.panel h2 { font-size: 22px; font-weight: 800; }
.panel label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.panel .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel .actions { display: flex; gap: 8px; margin-top: auto; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 60; }
.toast[hidden] { display: none !important; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app-side { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(4, minmax(240px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .app-top { flex-wrap: wrap; }
  .app-search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
}

.app { overflow: clip; } /* hidden would make .app a scroll container and break the sticky total */
.calc { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; padding: 24px; background: var(--surf); flex: 1; align-items: start; }
.job { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.job h3 { font-size: 18px; font-weight: 800; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; border: 0; padding: 0; margin: 0; }
.field input:not([type="range"]):not([type="radio"]) { min-height: 44px; font-size: 16px; border-width: 1px; border-radius: 10px; }
.range { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.range input { grid-column: 1 / -1; accent-color: var(--ink); width: 100%; min-height: 24px; padding: 0; border: 0; }
.range output { font-weight: 800; font-variant-numeric: tabular-nums; }
#copy { margin-left: auto; }
.field legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span { display: grid; place-items: center; min-height: 40px; border-radius: 8px; font-size: 15px; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--ok); outline-offset: 2px; }
.step { flex-direction: row; justify-content: space-between; align-items: center; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: #fff; font: inherit; font-size: 20px; cursor: pointer; }
.stepper button:hover { background: var(--surf); }
.stepper input { width: 56px; text-align: center; border: 0 !important; border-radius: 0 !important; min-height: 44px; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; min-height: 0; padding: 0; border-radius: 999px; background: #d9d4cd; position: relative; cursor: pointer; border: 0; order: 2; transition: background 0.2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }

.paper { position: relative; background: #fff; border-radius: 4px; padding: 40px; transform: rotate(-1deg); box-shadow: 0 32px 56px -32px rgba(50, 10, 0, 0.5); margin-top: 8px; }
.paper-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.firm { font-size: 22px; font-weight: 900; font-stretch: 80%; line-height: 1; }
.meta { text-align: right; font-size: 13px; color: var(--mut); line-height: 1.6; }
.meta b { color: var(--ink); }
.paper h2 { font-size: 22px; font-weight: 800; margin: 20px 0 8px; }
.lines { width: 100%; border-collapse: collapse; font-size: 15px; }
.lines td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines td small { display: block; color: var(--mut); font-size: 13px; }
.lines td:last-child { text-align: right; white-space: nowrap; font-weight: 600; padding-left: 16px; font-variant-numeric: tabular-nums; }
.sums { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.sums p { display: flex; justify-content: space-between; font-size: 15px; color: var(--mut); }
.sums b { color: var(--ink); font-weight: 600; }
.sums .grand { margin-top: 8px; padding-top: 12px; border-top: 2px solid var(--ink); color: var(--ink); font-weight: 800; font-size: 18px; align-items: baseline; }
.sums .grand b { font-size: 36px; font-weight: 900; font-stretch: 80%; }
.accept { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: 24px; }
.accept > div { flex: 1; }
.accept .line { border-bottom: 1px solid var(--ink); height: 28px; }
.accept small { color: var(--mut); font-size: 13px; }

@media (max-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .paper { padding: 24px 20px; transform: none; }
  .paper-head { flex-direction: column; }
  .meta { text-align: left; }
  .sums .grand b { font-size: 28px; white-space: nowrap; }
  /* While the inputs fill the screen, a sticky bar keeps the total in view. */
  .peek { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: space-between; align-items: center; margin: 0 16px 16px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.5); }
  .peek b { font-size: 20px; font-weight: 900; font-stretch: 80%; font-variant-numeric: tabular-nums; }
}
@media (min-width: 901px) { .peek { display: none; } }
@media print {
  body * { visibility: hidden; }
  .paper, .paper * { visibility: visible; }
  .paper { position: absolute; left: 0; top: 0; width: 100%; transform: none; box-shadow: none; }
  .paper .tape { display: none; }
}
.peek { transition: opacity 0.2s, transform 0.2s; }
.peek.away { opacity: 0; transform: translateY(8px); pointer-events: none; }

.note { margin-top: 16px; }
.demo-foot { margin-top: 32px; }
.demo-foot a { font-weight: 700; }

.search-feedback { padding: 16px 24px; }
.search-feedback p { margin-bottom: 8px; }

/* Launch pass: 44 px touch targets on touch screens. */
@media (pointer: coarse), (max-width: 760px) {
  .moves button { width: 44px; height: 44px; }
  .app-btn { min-height: 44px; }
  .range input { min-height: 44px; }
  .field label, .field .check { min-height: 44px; }
}
