/* VezinoKids
   Ideja: aplikacija je mirna i čista, a jedino "glasno" mesto je ime za vez,
   prikazano kao izvezena etiketa sa isprekidanim bodom. Status je niz od 6 bodova. */

:root {
  --bg: #f2f4f3;        /* platno */
  --surface: #ffffff;
  --ink: #1d2b3a;       /* teget konac */
  --muted: #65717d;
  --line: #dde2e0;
  --thread: #1f6f6b;    /* glavni konac, teal */
  --thread-soft: #e3f0ee;
  --on-thread: #ffffff;
  --late: #b8323f;
  --late-soft: #fbeaec;
  --soon: #a86a05;
  --soon-soft: #fdf3df;
  --radius: 14px;
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a1f; --surface: #1c242b; --ink: #e8eef2; --muted: #9aa7b2; --line: #2c3740;
    --thread: #5fbcb3; --thread-soft: #1d3432; --on-thread: #0c1a19;
    --late: #ff8a8f; --late-soft: #3a2024; --soon: #f0b54f; --soon-soft: #3a2f18;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--font); font-optical-sizing: auto;
  background: var(--bg); color: var(--ink); }
a { color: var(--thread); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--thread); outline-offset: 2px; border-radius: 6px; }
main { max-width: 680px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; margin: 8px 0 12px; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 10px; }

/* ---------- zaglavlje ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { text-decoration: none; padding: 6px 10px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.top nav a.on { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.short { display: none; }
@media (max-width: 520px) {
  .brand { display: none; }
  .long { display: none; } .short { display: inline; }
  .top { gap: 6px; padding: 8px 12px; }
  .top nav a { padding: 6px 8px; }
}

/* ---------- dugmad ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 .95rem var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--thread); border-color: var(--thread); color: var(--on-thread); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn.new { min-height: 38px; }
.link { background: none; border: 0; padding: 0; color: var(--thread); font: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; }
.link.danger { color: var(--late); }
form.inline { display: inline; }

.flash { padding: 12px 14px; border-radius: var(--radius); margin: 10px 0; background: var(--thread-soft); color: var(--ink); }
.flash.error { background: var(--late-soft); color: var(--late); }
.flash.warn { background: var(--soon-soft); color: var(--ink); }

/* ---------- Danas ---------- */
.lead h1 { font-size: clamp(1.5rem, 5.5vw, 2rem); font-weight: 750; margin: 12px 0 4px; max-width: 22ch; }
.lead .count { color: var(--late); }
.lead .sub { margin: 0 0 6px; color: var(--muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.chip { white-space: nowrap; text-decoration: none; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .88rem; }
.chip b { color: var(--ink); margin-left: 2px; }

/* ---------- kartica porudžbine ---------- */
.card { position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin: 10px 0; padding: 14px 14px 12px; }
.card.soon { border-color: color-mix(in srgb, var(--soon) 45%, var(--line)); }
.card.late { border-color: color-mix(in srgb, var(--late) 55%, var(--line)); background: var(--late-soft); }
.card-main { display: block; text-decoration: none; color: inherit; }
.card-top { display: flex; align-items: baseline; gap: 8px; }
.no { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.who { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due { font-size: .85rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due.soon { color: var(--soon); font-weight: 700; }
.due.late { color: var(--late); font-weight: 700; }
.what { color: var(--muted); font-size: .92rem; margin-top: 6px; }
.unpaid { margin-left: 8px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: .78rem; color: var(--ink); }
.card .next { margin-top: 10px; display: flex; justify-content: flex-end; }

/* izvezena etiketa sa imenom: jedini ukrasni element */
.tag-name { display: inline-block; margin-top: 10px; padding: 6px 14px 7px;
  font-weight: 750; font-size: 1.25rem; letter-spacing: 0.01em; line-height: 1.2;
  color: var(--thread); background: var(--thread-soft); border-radius: 10px;
  outline: 2px dashed color-mix(in srgb, var(--thread) 55%, transparent); outline-offset: -6px;
  overflow-wrap: anywhere; white-space: pre-wrap; }
.tag-name.big { font-size: clamp(1.8rem, 9vw, 2.6rem); padding: 14px 26px 16px; border-radius: 16px; outline-offset: -9px; }

/* status kao niz bodova */
.progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.stitches { display: inline-flex; gap: 4px; }
.stitches i { width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
.stitches i.done { background: var(--thread); }
.plabel { font-size: .82rem; color: var(--muted); font-weight: 500; }
.progress.cancelled .plabel { color: var(--late); text-decoration: line-through; }

.search { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.search input { flex: 1 1 220px; }
.search input, .search select { width: auto; margin: 0; }

/* ---------- forme ---------- */
input, select, textarea { width: 100%; font: 400 1rem var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 4px; min-height: 44px; }
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--thread);
  box-shadow: 0 0 0 3px var(--thread-soft); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--thread); }
.form fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 6px; }
.form fieldset:first-of-type { border-top: 0; padding-top: 0; }
.form legend { font-weight: 700; font-size: 1.05rem; padding: 0 0 2px; float: left; width: 100%; }
.form legend + * { clear: both; }
.form label { display: block; margin: 10px 0; font-size: .9rem; color: var(--muted); font-weight: 500; }
.form label small { font-weight: 400; }
.form .check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1rem; }
.radios { display: flex; gap: 8px; margin: 10px 0 4px; }
.radio { flex: 1; display: flex !important; align-items: center; justify-content: center; gap: 8px; margin: 0 !important;
  min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink) !important; font-size: 1rem !important; font-weight: 600 !important; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--thread); background: var(--thread-soft); color: var(--thread) !important; }
input.big { font-size: 1.3rem; font-weight: 700; color: var(--thread); border-style: dashed; border-width: 2px;
  border-color: color-mix(in srgb, var(--thread) 45%, var(--line)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.actions { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 0;
  background: var(--bg); border-top: 1px solid var(--line); margin-top: 8px; }
.actions .btn.primary { flex: 1; }

/* ---------- detalji porudžbine ---------- */
.head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.head h1 { margin: 8px 0; }
.h-who { font-weight: 500; color: var(--muted); }
.personal { text-align: center; padding: 18px 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); margin: 6px 0 4px; }
.personal .label { font-size: .85rem; color: var(--muted); }
.personal .none { color: var(--muted); padding: 10px 0; }
.personal .for { margin-top: 10px; color: var(--muted); font-size: .92rem; }
.personal + .progress { justify-content: center; margin: 12px 0 4px; }
.details { display: grid; grid-template-columns: 112px 1fr; gap: 10px 12px; margin: 16px 0 0; padding: 0; }
.details dt { color: var(--muted); font-size: .9rem; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 16px; }
.stack { display: grid; gap: 10px; margin-bottom: 12px; }
.stack label { font-size: .9rem; color: var(--muted); }
.row { display: flex; gap: 8px; }
.row select { margin: 0; flex: 1; }
#conf { font-size: .95rem; margin: 0 0 10px; background: var(--bg); }
.history { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.history li { padding: 6px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.history time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }

/* ---------- zalihe ---------- */
.inv { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.inv th, .inv td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--line); }
.inv thead th { border-top: 0; font-size: .82rem; color: var(--muted); font-weight: 500; }
.inv tr.low td { background: var(--soon-soft); }
.qty { display: flex; align-items: center; gap: 10px; }
.qty b { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.qty .btn { width: 36px; padding: 0; }
.hint { color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }

/* ---------- prijava ---------- */
.login { max-width: 360px; margin: 14vh auto 0; }
.login h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; text-align: center; margin-bottom: 20px; }
.login label { display: block; margin: 12px 0; font-size: .9rem; color: var(--muted); font-weight: 500; }
.login .btn { width: 100%; margin-top: 10px; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px 0 32px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
