/* איפה השקית? — "קרפט ותוויות": paper background, kraft tags tied with string, ink-brown type. */
:root {
  --paper: #EEE6D6;
  --paper-hi: #F2EBDD;
  --paper-lo: #E9DFCC;
  --kraft: #CDAB7B; --kraft-hi: #D9BC90; --kraft-lo: #BE9A69;
  --ink: #3A2819; --ink2: #5A4230; --muted: #86694C;
  --rust: #7E4325; --line: #A88458; --cream: #F6EFE3;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  font-family: Assistant, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(rgba(120,88,48,.07) .9px, transparent 1.1px) 0 0/6px 6px,
    radial-gradient(rgba(120,88,48,.05) .9px, transparent 1.1px) 3px 2px/11px 11px,
    linear-gradient(180deg, var(--paper-hi) 0%, var(--paper-lo) 100%) fixed;
  background-color: var(--paper);
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { display: block; }
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.muted { color: var(--muted); }

.top, main { max-width: 560px; margin-inline: auto; }

/* header */
.top { padding: calc(14px + env(safe-area-inset-top, 0px)) 0 0; }
.top-row { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 42px; height: 46px; flex: none; }
.app-title { font-family: Karantina, Assistant, sans-serif; font-weight: 700; font-size: 50px; line-height: .9; letter-spacing: .5px; color: var(--ink); }
.total { font-size: 14px; font-weight: 600; color: var(--muted); padding-bottom: 6px; text-align: left; line-height: 1.25; }
.total b { display: block; font-family: Karantina, Assistant, sans-serif; font-weight: 700; font-size: 26px; color: var(--ink2); line-height: .9; }

/* search */
.search {
  margin: 14px 16px 0; height: 48px; border-radius: 12px; background: rgba(250,245,236,.85);
  border: 1.5px dashed var(--line); display: flex; align-items: center; gap: 10px; padding: 0 14px 0 6px; color: var(--muted);
}
.search:focus-within { border-style: solid; background: #FBF7F0; }
.search-ico { width: 20px; height: 20px; flex: none; }
.search-ico svg { width: 100%; height: 100%; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font: 600 16px Assistant, sans-serif; color: var(--ink); outline: none; }
.search input::placeholder { color: #9C8164; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--ink2); }
.search-clear svg { width: 18px; height: 18px; }

/* place filter */
.places { display: flex; gap: 6px; margin: 12px 16px 0; overflow-x: auto; scrollbar-width: none; }
.places::-webkit-scrollbar { display: none; }
.place-chip {
  flex: 1 0 auto; font: 700 15px Assistant, sans-serif; color: var(--ink2); background: transparent; border: 1.5px solid var(--line);
  border-radius: 9px; height: 38px; padding: 0 8px 0 7px; display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;
}
.place-chip b { font-weight: 800; font-size: 12.5px; min-width: 20px; height: 20px; border-radius: 10px; background: rgba(168,132,88,.22); display: grid; place-items: center; padding: 0 5px; }
.place-chip.on { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.place-chip.on b { background: rgba(246,239,227,.18); }

.offline { max-width: 528px; margin: 10px auto 0; padding: 8px 12px; border: 1.5px dashed var(--rust); border-radius: 10px; color: var(--rust); font-weight: 700; font-size: 14px; text-align: center; margin-inline: 16px; }
@media (min-width: 560px) { .offline { margin-inline: auto; } }

.hint { margin: 10px 22px 4px; font-family: 'Amatic SC', Assistant, sans-serif; font-weight: 700; font-size: 21px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.hint svg { width: 30px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.list-title { margin: 14px 22px 6px; font-size: 15px; font-weight: 700; color: var(--muted); }

/* tags */
.list { padding: 4px 0 calc(130px + var(--safe-b)); }
.tagw { position: relative; margin: 0 34px 12px 14px; filter: drop-shadow(0 1px 0 rgba(90,60,30,.18)) drop-shadow(0 3px 5px rgba(90,60,30,.16)); }
.tagw:nth-child(odd) { transform: rotate(-.5deg); }
.tagw:nth-child(even) { transform: rotate(.45deg); }
.tag {
  position: relative; padding: 0 44px 0 10px;
  clip-path: polygon(5px 0, calc(100% - 28px) 0, 100% 28px, 100% calc(100% - 28px), calc(100% - 28px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
  background:
    radial-gradient(rgba(95,62,28,.11) .8px, transparent 1px) 0 0/5px 5px,
    radial-gradient(rgba(255,248,232,.16) .8px, transparent 1px) 2px 3px/8px 8px,
    linear-gradient(165deg, var(--kraft-hi), var(--kraft) 55%, var(--kraft-lo));
}
.eyelet {
  position: absolute; right: 15px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%;
  background: #E9DFCC; box-shadow: 0 0 0 4px #EBDDC2, 0 0 0 5px rgba(120,88,48,.25), inset 0 1.5px 2px rgba(60,40,20,.35);
}
.string { position: absolute; right: -34px; top: 50%; margin-top: -30px; width: 60px; height: 60px; pointer-events: none; overflow: visible; }
.string path { fill: none; stroke: #9E7E58; stroke-width: 1.6; stroke-linecap: round; }

.tag-main { display: flex; width: 100%; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 11px 0 4px; text-align: right; }
.tag-info { display: flex; flex-direction: column; min-width: 0; }
.who { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 15px; color: var(--ink2); }
.who .ico { width: 17px; height: 17px; }
.sizeRow { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; margin-top: -2px; }
.size { font-family: 'Amatic SC', Assistant, sans-serif; font-weight: 700; font-size: 42px; line-height: 1.05; color: var(--ink); overflow-wrap: anywhere; }
.type { font-weight: 800; font-size: 17px; color: var(--ink2); }
.note { font-family: 'Amatic SC', Assistant, sans-serif; font-weight: 700; font-size: 22px; line-height: 1.1; color: var(--rust); margin-top: -2px; display: flex; gap: 5px; align-items: flex-start; }
.note .ico { width: 15px; height: 15px; margin-top: 4px; }
.stamps { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; padding-top: 3px; flex: none; }
.stamp {
  font-family: Karantina, Assistant, sans-serif; font-weight: 700; font-size: 21px; line-height: 1; color: var(--rust); border: 2px solid currentColor;
  border-radius: 5px; padding: 2px 8px 0; transform: rotate(-5deg); opacity: .82; mix-blend-mode: multiply; letter-spacing: .5px;
}
.stamp + .stamp { transform: rotate(3deg); }
.stamp:nth-child(3) { transform: rotate(-2deg); }

.where { display: flex; align-items: center; flex-wrap: wrap; column-gap: 2px; margin-top: 4px; padding: 3px 0 5px; border-top: 1.5px dashed rgba(58,40,25,.33); }
.where .lbl { font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; margin-left: 3px; }
.opt { display: flex; align-items: center; gap: 5px; min-height: 40px; padding: 0 4px; font-size: 15px; font-weight: 600; color: var(--ink2); white-space: nowrap; border-radius: 8px; }
.opt:active { background: rgba(255,250,240,.25); }
.opt i { position: relative; width: 17px; height: 17px; border: 1.7px solid var(--ink2); border-radius: 3px; background: rgba(255,250,240,.35); flex: none; }
.opt.on { font-weight: 800; color: var(--ink); }
.opt.on i { border-color: var(--ink); }
.opt.on i::after {
  content: ""; position: absolute; left: -1px; top: -9px; width: 22px; height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M3 13.5c2 1.5 3.3 3.2 4.6 5.6C10 12 14 6.5 20.5 2' fill='none' stroke='%232A1A0E' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center/contain;
  animation: tick .22s ease-out;
}
@keyframes tick { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* empty / loading */
.empty { margin: 34px 24px; text-align: center; color: var(--ink2); font-size: 17px; font-weight: 600; line-height: 1.5; }
.empty .muted { font-size: 15px; font-weight: 400; }
.empty-ico { width: 54px; height: 54px; margin: 0 auto 10px; color: var(--line); }
.empty-ico svg { width: 100%; height: 100%; }

/* add button */
.fade { position: fixed; left: 0; right: 0; bottom: 0; height: calc(120px + var(--safe-b)); background: linear-gradient(180deg, rgba(234,224,205,0), rgba(234,224,205,.92) 45%, #EAE0CD); pointer-events: none; z-index: 5; }
.add-btn {
  position: fixed; left: 16px; right: 16px; bottom: calc(18px + var(--safe-b)); height: 58px; max-width: 528px; margin-inline: auto; border-radius: 14px;
  background: var(--ink); color: var(--cream); display: flex; align-items: center; justify-content: center; gap: 10px; font: 800 19px Assistant, sans-serif;
  box-shadow: 0 6px 16px rgba(58,40,25,.32); outline: 1.5px dashed rgba(246,239,227,.45); outline-offset: -7px; z-index: 6;
}
.add-btn:active { transform: translateY(1px); }
.add-btn .plus { width: 26px; height: 26px; border-radius: 50%; background: var(--kraft); color: var(--ink); display: grid; place-items: center; font-size: 22px; line-height: 1; font-weight: 800; }

/* bottom sheet: add / edit */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(42,28,16,0); display: flex; align-items: flex-end; justify-content: center; transition: background .2s; }
.overlay.show { background: rgba(42,28,16,.42); }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background:
    radial-gradient(rgba(120,88,48,.06) .9px, transparent 1.1px) 0 0/6px 6px,
    var(--cream);
  border-radius: 18px 18px 0 0; padding: 6px 18px 0;
  transform: translateY(100%); transition: transform .22s ease-out; box-shadow: 0 -6px 24px rgba(42,28,16,.25);
}
.overlay.show .sheet { transform: none; }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: rgba(90,66,48,.25); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h2 { font-family: Karantina, Assistant, sans-serif; font-weight: 700; font-size: 38px; line-height: 1; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--ink2); }
.icon-btn svg { width: 22px; height: 22px; }

.field { margin-top: 14px; }
.label { display: block; font-size: 15px; font-weight: 800; color: var(--ink2); margin-bottom: 7px; }
.label .soft { font-weight: 400; color: var(--muted); font-size: 14px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1.5px dashed var(--line); background: rgba(255,250,240,.6); font-size: 16px; font-weight: 700; color: var(--ink2);
}
.choice .ico { width: 18px; height: 18px; }
.choice.on { background: var(--ink); color: var(--cream); border: 1.5px solid var(--ink); }
.input {
  width: 100%; min-height: 48px; border-radius: 10px; border: 1.5px dashed var(--line); background: #FBF7F0;
  padding: 10px 12px; font: 600 17px Assistant, sans-serif; color: var(--ink); outline: none;
}
.input:focus { border-style: solid; }
textarea.input { resize: vertical; line-height: 1.4; }
.input::placeholder { color: #A99075; font-weight: 400; }
.row { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
.row-name { width: 46px; flex: none; padding-top: 9px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.chip {
  min-width: 40px; min-height: 38px; padding: 0 10px; border-radius: 19px; background: rgba(205,171,123,.32);
  color: var(--ink2); font-weight: 700; font-size: 15px; border: 1.5px solid transparent;
}
.chip.on { background: var(--ink); color: var(--cream); }
.chip.add { background: transparent; border: 1.5px dashed var(--line); color: var(--ink); }
.chip.ghost { background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; min-width: 0; padding: 0 6px; }
.chip.removable { background: rgba(142,44,24,.1); color: #8E2C18; border: 1.5px dashed rgba(142,44,24,.45); }
.chosen { display: inline-block; margin-inline-start: 6px; padding: 1px 9px; border-radius: 10px; background: var(--ink); color: var(--cream); font-size: 13.5px; font-weight: 700; vertical-align: 1px; }
.add-opt { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.add-opt .input { flex: 1; min-width: 0; }
.btn.small { min-height: 48px; padding: 0 14px; font-size: 16px; border: 1.5px dashed var(--line); border-radius: 10px; }
.btn.small.primary { border-color: var(--ink); }
.form-error { min-height: 20px; margin-top: 10px; color: #9A2F1A; font-weight: 700; font-size: 15px; }
.sheet-actions {
  position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 10px; margin: 4px -18px 0;
  padding: 12px 18px calc(18px + var(--safe-b)); background: linear-gradient(180deg, rgba(246,239,227,0), var(--cream) 14px);
}
.btn { min-height: 54px; border-radius: 12px; font: 800 18px Assistant, sans-serif; display: flex; align-items: center; justify-content: center; }
.btn:disabled { opacity: .55; }
.btn.primary { background: var(--ink); color: var(--cream); box-shadow: 0 4px 12px rgba(58,40,25,.25); }
.btn.secondary { color: var(--ink); border: 1.5px dashed var(--ink2); background: rgba(205,171,123,.22); }
.btn.danger { color: #8E2C18; border: 1.5px dashed rgba(142,44,24,.5); min-height: 48px; font-size: 16px; }
.added { margin-top: 2px; padding: 8px 12px; border-radius: 10px; background: rgba(205,171,123,.3); color: var(--ink); font-weight: 700; font-size: 15px; }

/* toast */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(88px + var(--safe-b)); max-width: 528px; margin-inline: auto; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 6px 8px 6px 16px;
  border-radius: 12px; background: #2E2014; color: var(--cream); font-weight: 700; font-size: 16px; box-shadow: 0 6px 18px rgba(30,20,10,.35);
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast button { min-height: 40px; padding: 0 14px; border-radius: 9px; background: var(--kraft); color: var(--ink); font-weight: 800; }

/* pairing */
.pair { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: inherit; background-color: var(--paper); }
.pair-card { width: 100%; max-width: 380px; text-align: center; }
.pair-logo { width: 84px; height: 92px; margin: 0 auto 6px; }
.pair-title { font-family: Karantina, Assistant, sans-serif; font-size: 60px; line-height: 1; font-weight: 700; }
.pair-sub { font-family: 'Amatic SC', Assistant, sans-serif; font-weight: 700; font-size: 26px; color: var(--muted); margin-bottom: 22px; }
.pair-label { display: block; text-align: right; font-weight: 800; color: var(--ink2); margin-bottom: 6px; }
.pair .btn { width: 100%; margin-top: 12px; }
.pair-error { min-height: 22px; margin-top: 10px; color: #9A2F1A; font-weight: 700; }
.pair-help { color: var(--muted); font-size: 14px; }

@media (max-width: 375px) {
  .where .lbl { display: none; }
}
@media (max-width: 360px) {
  .app-title { font-size: 44px; }
  .tagw { margin-right: 28px; margin-left: 10px; }
  .opt { padding: 0 4px; font-size: 14px; gap: 5px; }
  .where .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay, .sheet, .toast { transition: none; }
  .opt.on i::after { animation: none; }
}
