/* Preferito · Demandes. The form is a kitchen ticket: white paper, torn top edge, ticket number at the end. */
@font-face { font-family: "Sora"; font-weight: 600; font-display: swap; src: url(fonts/sora-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Sora"; font-weight: 600; font-display: swap; src: url(fonts/sora-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF; }
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url(fonts/instrument-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url(fonts/instrument-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url(fonts/instrument-sans-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url(fonts/instrument-sans-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
  --plum: #5B2148;
  --plum-deep: #3F1632;
  --plum-tint: #F6ECF2;
  --rose: #E9A9C6;
  --ground: #ECE7EE;
  --paper: #FFFFFF;
  --ink: #24161F;
  --muted: #6F6470;
  --line: #E1D8E0;
  --urgent: #B42A2A;
  --important: #9A5B00;
  --ok: #2D7A4E;
  --focus: #2B6CDF;
  --display: "Sora", system-ui, sans-serif;
  --text: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.5 var(--text); min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--plum); }
h1, .brand, .tk-num { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------ the plum band the ticket comes out of */
.top { background: var(--plum); color: #fff; display: flex; align-items: center; gap: 12px; padding: max(18px, env(safe-area-inset-top)) 20px 64px; }
.top.slim { padding-bottom: 56px; }
.top .logo { border-radius: 11px; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .25); }
.top .brand { margin: 0; font-size: 18px; line-height: 1.2; }
.top .sub { margin: 2px 0 0; font-size: 14px; color: var(--rose); }
.top .out { margin-left: auto; }
.top .back { color: #fff; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.link { background: none; border: 0; color: #fff; font: 600 14px var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px 0; }

.wrap { max-width: 560px; margin: -36px auto 0; padding: 0 12px 40px; }
.wrap.wide { max-width: 760px; }

/* ------------------------------------------------ the ticket */
.ticket { position: relative; background: var(--paper); border-radius: 0 0 14px 14px; box-shadow: 0 1px 0 rgba(63, 22, 50, .06), 0 14px 32px -18px rgba(63, 22, 50, .35); }
.tear { position: absolute; top: -8px; left: 0; right: 0; height: 8px; background: conic-gradient(from 135deg at 50% 0, transparent 90deg, var(--paper) 0) 0 0 / 16px 100% repeat-x; }
.tk-body { padding: 22px 20px 26px; display: grid; gap: 22px; }
.tk-body > h1 { margin: 0; font-size: 26px; line-height: 1.15; }
.lead { margin: -14px 0 0; color: var(--muted); }

/* ------------------------------------------------ fields */
fieldset.grp { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
legend, .fld > span { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 6px; display: block; }
legend { margin-bottom: 10px; }
.fld { display: grid; gap: 0; }
.fld em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 4px; }
.two { display: grid; gap: 12px; grid-template-columns: 1fr; }
input:not([type=radio]):not([type=file]), select, textarea {
  width: 100%; font: 400 16px/1.4 var(--text); color: var(--ink); background: #fff; border: 1.5px solid var(--line);
  border-radius: 10px; padding: 12px 14px; min-height: 48px; appearance: none; -webkit-appearance: none; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236F6470' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
textarea { resize: vertical; min-height: 120px; }
input:focus, select:focus, textarea:focus { border-color: var(--plum); outline: none; box-shadow: 0 0 0 3px rgba(91, 33, 72, .18); }
[aria-invalid="true"] { border-color: var(--urgent) !important; }
fieldset[aria-invalid="true"] .kind { border-color: rgba(180, 42, 42, .5); }
.err { margin: 6px 0 0; color: var(--urgent); font-size: 14px; font-weight: 600; }
.banner { margin: 0; padding: 12px 14px; border-radius: 10px; background: #FBEAEA; color: var(--urgent); font-weight: 600; }
.hp { position: absolute; left: -9999px; }
::placeholder { color: #A398A2; }

/* the five subjects, as tiles */
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind { position: relative; display: grid; gap: 2px; align-content: start; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.kind:last-child:nth-child(odd) { grid-column: 1 / -1; }
.kind input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.kind .k-ic { color: var(--plum); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--plum-tint); margin-bottom: 6px; }
.kind b { font-size: 15px; line-height: 1.25; }
.kind small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.kind:has(input:checked) { border-color: var(--plum); background: var(--plum-tint); }
.kind:has(input:checked) .k-ic { background: var(--plum); color: #fff; }
.kind:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

/* urgency */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg label { position: relative; padding: 10px 6px; text-align: center; cursor: pointer; display: grid; gap: 1px; }
.seg label + label { border-left: 1.5px solid var(--line); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg b { font-size: 15px; }
.seg small { font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.seg label:has(input:checked) { background: var(--plum); color: #fff; }
.seg label:has(input:checked) small { color: var(--rose); }
.seg label.u-urgent:has(input:checked) { background: var(--urgent); }
.seg label.u-urgent:has(input:checked) small { color: #FFD9D9; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }
.fld.inline input { max-width: 220px; }

/* photos */
.drop { position: relative; display: flex; gap: 12px; align-items: center; padding: 16px; border: 1.5px dashed #C9B9C6; border-radius: 12px; background: #FBF8FA; cursor: pointer; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop.full { opacity: .5; pointer-events: none; }
.drop-ic { flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--plum); color: #fff; display: grid; place-items: center; }
.drop-t { display: grid; }
.drop-t b { font-size: 15px; }
.drop-t small { color: var(--muted); font-size: 13.5px; }
.thumbs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumbs:empty { display: none; }
.thumbs li { position: relative; display: grid; gap: 4px; }
.thumbs img, .thumbs .doc { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--plum-tint); display: grid; place-items: center; color: var(--plum); font-weight: 600; }
.thumbs small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumbs .rm { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(36, 22, 31, .78); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--plum); background: #fff; color: var(--plum); font: 600 15px var(--text); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--plum); color: #fff; }
.btn.primary:hover { background: var(--plum-deep); }
.btn.big { width: 100%; min-height: 56px; font-size: 17px; border-radius: 14px; }
.btn:disabled { opacity: .65; cursor: wait; }
.fine { margin: -10px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ------------------------------------------------ sent: the ticket number */
.ticket.done .tk-body { text-align: center; gap: 8px; padding-top: 30px; }
.tk-label { margin: 0; color: var(--ok); font-weight: 600; }
.tk-num { margin: 0; font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--plum); }
.tk-title { margin: 8px 0 0; font-size: 18px; font-weight: 600; }
.tk-meta { margin: 0; color: var(--muted); }
.tk-note { margin: 12px 0 14px; padding-top: 14px; border-top: 1.5px dashed var(--line); color: var(--muted); font-size: 15px; }
@media (prefers-reduced-motion: no-preference) {
  .ticket.done { animation: print .55s cubic-bezier(.2, .8, .2, 1) both; transform-origin: top; }
  @keyframes print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
}

/* ------------------------------------------------ admin */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--plum); }
.login { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 28px 22px; display: grid; gap: 16px; }
.login img { border-radius: 14px; }
.login h1 { margin: 0; font-size: 26px; }
.login .lead { margin: -10px 0 0; }

.counts { display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 14px 32px -20px rgba(63, 22, 50, .35); }
.counts p { margin: 0; padding: 14px 12px; color: var(--muted); font-size: 14px; }
.counts p + p { border-left: 1.5px solid var(--line); }
.counts b { display: block; font: 600 28px/1.1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.counts .hot b { color: var(--urgent); }
.tabs { display: flex; gap: 6px; margin: 18px 0 10px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 9px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, .7); font-weight: 600; font-size: 14.5px; }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }
.resto { margin: 0 0 12px; }
.resto select { background-color: #fff; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; padding: 14px; background: #fff; border-radius: 12px; text-decoration: none; color: var(--ink); border-left: 4px solid var(--line); }
.item.s-new { border-left-color: var(--plum); }
.item.s-progress { border-left-color: var(--important); }
.item.s-done, .item.s-archived { opacity: .72; }
.item .num { font: 600 14px var(--display); color: var(--plum); font-variant-numeric: tabular-nums; padding-top: 2px; }
.item .main { display: grid; min-width: 0; }
.item .main b { font-size: 16px; line-height: 1.3; }
.item .main small { color: var(--muted); font-size: 13.5px; }
.item .tags { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.chip, .stat { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.chip.u-urgent { background: #FBEAEA; color: var(--urgent); }
.chip.u-important { background: #FBF0DC; color: var(--important); }
.chip.u-normal { background: #F1EEF1; color: var(--muted); }
.stat { background: #F1EEF1; color: var(--muted); }
.stat.s-new { background: var(--plum-tint); color: var(--plum); }
.stat.s-progress { background: #FBF0DC; color: var(--important); }
.stat.s-done { background: #E3F2E9; color: var(--ok); }
.empty { background: #fff; border-radius: 12px; padding: 22px; text-align: center; }
.empty p { margin: 0 0 6px; }

.row { display: flex; gap: 6px; flex-wrap: wrap; }
.d-title { margin: -8px 0 0; font-size: 24px; line-height: 1.2; }
.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 14px 0; border-top: 1.5px dashed var(--line); border-bottom: 1.5px dashed var(--line); }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.desc { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; background: var(--plum-tint); }
.gallery .file { aspect-ratio: 1; border-radius: 10px; background: var(--plum-tint); text-decoration: none; display: grid; place-content: center; text-align: center; padding: 8px; gap: 4px; }
.gallery .file small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.statuses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.statuses button { min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font: 600 14px var(--text); color: var(--ink); cursor: pointer; padding: 0 4px; }
.statuses button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.statuses button.s-done[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.note { display: grid; gap: 10px; justify-items: start; }
.note .fld { width: 100%; }
.toast { margin: 0 0 10px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; position: relative; z-index: 1; }

@media (min-width: 520px) {
  .tk-body { padding: 28px 30px 32px; }
  .two { grid-template-columns: 1fr 1fr; }
  .kinds { grid-template-columns: repeat(3, 1fr); }
  .kind:last-child:nth-child(odd) { grid-column: auto; }
  .item { grid-template-columns: auto 1fr auto; }
  .item .tags { grid-column: 3; justify-content: flex-end; }
}
