/* Lemmikkimagneetit – yksi tyylitiedosto asiakassivulle ja ylläpidolle.
   Värit mainoksen mukaan: kermapaperi, metsänvihreä, lehdenvihreä. */
:root {
  --paper: #fef0c9;      /* sama kuin yläkuvan tausta: reunat sulautuvat */
  --paper-2: #fff9ea;    /* kortit ja kentät */
  --sunken: #f4e8c6;
  --forest: #1f4a2c;
  --forest-2: #2b5f37;
  --leaf: #6e9632;
  --moss: #e4ecd2;
  --ink: #1f2a20;
  --muted: #5d6857;
  --line: #e2d5b2;
  --line-2: #d3c49b;
  --warn: #9a3a16;
  --warn-bg: #fbe5d8;
  --amber: #e0a43a;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --r-lg: 18px;
  --r-md: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1rem/1.55 var(--sans); color: var(--ink); background: var(--paper); }
h1, h2, h3 { font-family: var(--serif); color: var(--forest); line-height: 1.15; margin: 0; font-weight: 700; font-variant-numeric: lining-nums; }
p { margin: 0; }
a { color: var(--forest-2); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
button { font: inherit; }

/* Painikkeet */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 0 20px; border: 0; border-radius: var(--r-md); background: var(--forest); color: #fff8e4;
  font-weight: 650; font-size: 1rem; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--forest-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.wide { width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .92rem; }
.btn.ghost { background: transparent; color: var(--forest); box-shadow: inset 0 0 0 1.5px var(--forest); }
.btn.ghost:hover { background: var(--moss); }
.btn.danger { background: transparent; color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.btn.danger:hover { background: var(--warn-bg); }
.btn.quiet { background: transparent; color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
.btn.primary { min-height: 58px; font-size: 1.15rem; border-radius: 14px; }

/* Kentät */
.field { display: block; font-weight: 600; font-size: .95rem; margin-top: 14px; }
.field small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 48px;
  font: 400 16px/1.4 var(--sans); color: var(--ink); background: #fff;
  border: 1.5px solid var(--line-2); border-radius: var(--r-md); }
textarea { resize: vertical; min-height: 72px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px rgba(110,150,50,.25); }
.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; cursor: pointer; }
.check input { flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--forest); }
.error { background: var(--warn-bg); color: var(--warn); border-radius: var(--r-md); padding: 10px 14px; font-weight: 600; }
.muted { color: var(--muted); }

/* ================================================================ Asiakassivu */
.hero { position: relative; background: var(--paper); text-align: center; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9%; background: linear-gradient(rgba(254,240,201,0), var(--paper)); pointer-events: none; }
.hero img { display: block; width: 100%; max-width: 860px; height: auto; margin: 0 auto;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%); }
@media (max-width: 600px) { .hero img { -webkit-mask-image: none; mask-image: none; } }

.page { max-width: 560px; margin: 0 auto; padding: 4px 18px 56px; }
.intro { text-align: center; margin: 6px 0 22px; }
.intro h1 { font-size: clamp(1.75rem, 1.3rem + 2.2vw, 2.35rem); }
.intro p { margin-top: 8px; font-size: 1.06rem; color: var(--ink); }
.ts { display: flex; justify-content: center; margin-bottom: 12px; }
.ts:empty { display: none; }

/* Kuvan lisäys */
.add { position: relative; display: flex; align-items: center; gap: 16px; padding: 20px 22px; min-height: 92px;
  border-radius: var(--r-lg); background: var(--forest); color: #fff8e4; cursor: pointer;
  box-shadow: 0 4px 0 #13301c; }
.add:hover { background: var(--forest-2); }
.add:active { transform: translateY(2px); box-shadow: 0 2px 0 #13301c; }
.add:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 3px; }
.add input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.add-icon { flex: 0 0 auto; width: 46px; height: 46px; padding: 9px; border-radius: 50%; background: #fff8e4; color: var(--forest); }
.add-text { display: flex; flex-direction: column; text-align: left; }
.add-text b { font: 700 1.3rem/1.2 var(--serif); }
.add-text small { opacity: .85; font-size: .95rem; margin-top: 2px; }
.add.more { background: transparent; color: var(--forest); box-shadow: inset 0 0 0 2px var(--leaf); min-height: 72px; padding: 14px 18px; margin-top: 4px; }
.add.more:hover { background: var(--moss); }
.add.more .add-icon { width: 40px; height: 40px; padding: 8px; background: var(--moss); }
.add.more .add-text b { font-size: 1.1rem; }

/* Tarjolla olevat magneetit (ennen ensimmäistä kuvaa) */
.offer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.offer figure { margin: 0; padding: 14px 10px 12px; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-lg); text-align: center; }
.offer img { width: auto; height: 120px; object-fit: contain; }
.offer figcaption { display: flex; flex-direction: column; margin-top: 6px; }
.offer figcaption b { font: 700 1.15rem var(--serif); color: var(--forest); }
.offer figcaption span { font-size: .88rem; color: var(--muted); }
.photo-tip { grid-column: 1 / -1; font-size: .95rem; color: var(--muted); padding: 2px 4px 0; }

/* Kuvakortti */
.items { display: grid; gap: 16px; margin-bottom: 14px; }
.items:empty { display: none; }
.item { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  scroll-margin-top: 16px; }
.item.attn { animation: attn 1.6s ease-out; }
@keyframes attn { 0%, 40% { box-shadow: 0 0 0 4px var(--amber); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .item.attn { animation: none; box-shadow: 0 0 0 4px var(--amber); } }

.photo { position: relative; aspect-ratio: 4 / 3; max-height: 300px; width: 100%; background: var(--sunken);
  display: flex; flex-direction: column; justify-content: flex-end; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo .fname { display: none; }
.photo.noprev { justify-content: center; align-items: center; aspect-ratio: auto; min-height: 150px; padding: 16px 0; }
.photo.noprev .fname { display: block; position: relative; max-width: 80%; font-size: .9rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo.noprev::before { content: ""; width: 44px; height: 44px; margin-bottom: 8px; opacity: .45;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f4a2c' stroke-width='1.6'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='M21 16l-5-5-9 9'/%3E%3C/svg%3E"); }
.photo .pstatus { position: absolute; left: 10px; bottom: 14px; z-index: 1; padding: 4px 10px; border-radius: 999px;
  background: rgba(31,74,44,.9); color: #fff8e4; font-size: .82rem; font-weight: 600; }
.photo.noprev .pstatus { position: static; margin-top: 8px; }
.photo.st-error .pstatus { background: var(--warn); max-width: calc(100% - 20px); border-radius: 10px; }
.photo .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.12); z-index: 1; }
.photo .fill { display: block; height: 100%; width: 0; background: var(--leaf); transition: width .25s; }
.photo.st-done .bar { display: none; }
.photo .retry { position: absolute; z-index: 2; left: 50%; top: 42%; transform: translate(-50%, -50%);
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--forest); color: #fff8e4;
  font-weight: 650; cursor: pointer; }

.item-body { padding: 14px 16px 16px; }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.item-head h3 { font-size: 1.15rem; }
.remove { border: 0; background: none; color: var(--muted); font-size: .9rem; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; padding: 8px 0 8px 8px; }
.item-head + .field { margin-top: 6px; }

.choice { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.choice legend { font-weight: 600; font-size: .95rem; padding: 0; margin-bottom: 8px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 8px 12px 8px 8px;
  background: #fff; border: 2px solid var(--line-2); border-radius: 14px; cursor: pointer; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt img { flex: 0 0 auto; width: 48px; height: 54px; object-fit: contain; }
.opt-text { display: flex; flex-direction: column; line-height: 1.2; }
.opt-text b { font: 700 1.05rem var(--serif); color: var(--forest); }
.opt-text small { color: var(--muted); font-size: .85rem; }
.opt.on { border-color: var(--forest); background: var(--moss); }
.opt.on::after { content: ""; position: absolute; top: -9px; right: -9px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--forest) no-repeat center/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23fff8e4' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.opt:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 2px; }
.opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opt-text b { overflow-wrap: anywhere; }
@media (max-width: 459px) {
  .opt { flex-direction: column; justify-content: center; gap: 4px; text-align: center; padding: 12px 6px 10px; min-height: 118px; }
  .opt img { width: 56px; height: 60px; }
  .opt-text { align-items: center; }
}

.item-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty-label { color: var(--muted); font-size: .92rem; margin-right: 2px; }
.step { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--forest); background: #fff;
  color: var(--forest); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.step:disabled { opacity: .3; cursor: default; }
.qty-val { min-width: 1.6em; text-align: center; font-weight: 700; font-size: 1.1rem; }
.add-note { border: 0; background: none; color: var(--forest-2); font-weight: 600; font-size: .92rem; cursor: pointer;
  padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }
.item-body textarea { margin-top: 10px; }

@media (min-width: 600px) {
  .page { max-width: 680px; }
  .item { display: grid; grid-template-columns: 230px 1fr; }
  .photo { aspect-ratio: auto; max-height: none; min-height: 100%; }
}

/* Yhteystiedot ja lähetys */
.rest { margin-top: 26px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 18px; }
.rest h2 { font-size: 1.35rem; }
.rest h2 + .field { margin-top: 10px; }
.privacy { margin-top: 14px; font-size: .86rem; color: var(--muted); }
.sendbar { margin-top: 20px; display: grid; gap: 10px; }
.total { font-weight: 650; color: var(--forest); }
.total:empty { display: none; }
.hint { font-size: .9rem; color: var(--muted); text-align: center; }
.hint:empty { display: none; }

/* Valmis */
.done { text-align: center; padding-top: 8px; }
.done-mark { width: 64px; height: 64px; }
.done h1 { font-size: 2.2rem; margin-top: 8px; }
.done > p { margin: 10px auto 0; max-width: 30rem; font-size: 1.05rem; }
.ticket { margin: 22px auto 0; max-width: 360px; padding: 18px; background: #fff; border: 2px dashed var(--leaf); border-radius: var(--r-lg); }
.ticket span { color: var(--muted); font-size: .95rem; }
.ticket strong { display: block; font: 800 2.7rem/1.1 var(--sans); letter-spacing: .04em; color: var(--forest);
  font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.ticket p { font-size: .98rem; }
.done-items { list-style: none; padding: 0; margin: 18px auto 10px; max-width: 360px; text-align: left; }
.done-items li { padding: 8px 2px; border-bottom: 1px solid var(--line); }

/* ================================================================ Ylläpito */
body.admin { background: #f7f0dc; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--forest); color: #fff8e4; }
.brand { color: #fff8e4; text-decoration: none; font: 700 1.15rem var(--serif); }
.brand span { font: 400 .9rem var(--sans); opacity: .75; margin-left: 4px; }
.bar-user { display: flex; align-items: center; gap: 12px; }
.bar-user form { margin: 0; }
.logout { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid rgba(255,248,228,.7); background: transparent; color: #fff8e4; font-weight: 600; cursor: pointer; }
.logout:hover { background: rgba(255,248,228,.12); }

.awrap { max-width: 1000px; margin: 0 auto; padding: 22px 18px 64px; }
.awrap h1 { font-size: 1.9rem; }
.awrap h2 { font-size: 1.25rem; margin-bottom: 10px; }
.awrap section { margin-top: 26px; }
.ahead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.howto { margin-top: 12px; background: var(--moss); border-radius: var(--r-md); padding: 12px 14px; max-width: 46rem; }
.todo { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; }
.search { display: flex; gap: 10px; margin-top: 16px; }
.search input { margin: 0; font-size: 1.05rem; min-height: 52px; }
.search .btn { min-height: 52px; }
.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 2px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 10px; color: var(--muted); text-decoration: none;
  font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.on { color: var(--forest); border-bottom-color: var(--forest); }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--sunken);
  font-size: .8rem; text-align: center; color: var(--ink); }
.tab.on .count { background: var(--forest); color: #fff8e4; }

.olist { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.orow { display: grid; grid-template-columns: 96px minmax(0, 1.2fr) minmax(0, 1.6fr) 170px 130px; gap: 12px;
  align-items: center; padding: 14px 16px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.orow:first-child { border-top: 0; }
.orow:hover { background: #fbf6e6; }
.ono { font-weight: 700; color: var(--forest); font-variant-numeric: tabular-nums; }
.oname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oqty { font-size: .92rem; color: var(--muted); }
.otime { font-size: .85rem; color: var(--muted); text-align: right; }
.empty { padding: 22px 16px; color: var(--muted); }
@media (max-width: 760px) {
  .orow { grid-template-columns: 1fr auto; grid-template-areas: "no st" "name name" "qty time"; gap: 4px 10px; }
  .ono { grid-area: no; } .ost { grid-area: st; } .oname { grid-area: name; font-size: 1.05rem; }
  .oqty { grid-area: qty; } .otime { grid-area: time; align-self: end; }
}

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 650;
  background: var(--sunken); color: var(--ink); white-space: nowrap; }
.pill.st-unpaid { background: #fbe3bd; color: #6d4206; }
.pill.st-paid { background: var(--moss); color: var(--forest); }
.pill.st-drawing, .pill.st-approval, .pill.st-printing { background: #dfe9f0; color: #234257; }
.pill.st-done, .pill.st-picked { background: var(--forest); color: #fff8e4; }
.pill.st-cancelled { background: #eee; color: #666; }

.back { display: inline-block; margin-bottom: 12px; font-weight: 600; text-decoration: none; padding: 6px 0; }
.ohead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ometa { margin-top: 8px; line-height: 1.6; }
.notice { background: var(--moss); color: var(--forest); font-weight: 650; border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 14px; }
.paybox { background: #fff; border: 2px solid var(--forest); border-radius: var(--r-lg); padding: 20px; }
.summary { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.charge { list-style: none; padding: 0; margin: 0; font-size: 1.2rem; font-weight: 700; }
.charge li { padding: 2px 0; }
.payform { display: grid; grid-template-columns: minmax(0, 260px) 1fr auto; gap: 14px; align-items: end; margin-top: 16px; }
.payform label:first-child { font-weight: 600; }
.payform .check { margin: 0 0 12px; }
@media (max-width: 760px) { .payform { grid-template-columns: 1fr; } .payform .check { margin: 0; } }
.paid { margin-top: 10px; color: var(--forest); }

.acards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.acard { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.acard > div { padding: 12px 14px 14px; }
.athumb { display: block; aspect-ratio: 4 / 3; background: var(--sunken); }
.athumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.athumb.noprev { display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.acard h3 { font-size: 1.1rem; }
.prod { margin-top: 2px; font-weight: 600; }
.notes { margin-top: 8px; white-space: pre-wrap; background: var(--paper-2); border-radius: 10px; padding: 8px 10px; font-size: .93rem; }
.dl { display: inline-block; margin-top: 10px; font-weight: 600; }
.handle { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.handle p { margin-top: 12px; }
.status-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.status-form label { flex: 1; min-width: 220px; font-weight: 600; }
.mails { padding-left: 18px; }
.cancel { margin-top: 34px; }

.login { max-width: 400px; margin: 9vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px 24px; }
.login h1 { font-size: 1.7rem; margin-bottom: 16px; }
.stack { display: grid; gap: 16px; }
.stack > label { font-weight: 600; }
.segs { border: 0; padding: 0; margin: 0; min-width: 0; }
.segs legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.segrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: var(--r-md);
  border: 1.5px solid var(--line-2); font-weight: 650; cursor: pointer; background: #fff; }
.seg input:checked + span { background: var(--forest); border-color: var(--forest); color: #fff8e4; }
.seg input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
