/* Looma Orders — mobile-first styles */
:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf0f5;
  --border: #e3e7ee;
  --border-strong: #cfd5df;
  --text: #172033;
  --text-2: #4b5466;
  --muted: #7c8495;
  --brand: #2563eb;
  --brand-2: #1d4fd7;
  --accent: #2563eb;
  --accent-soft: #e8effd;
  --ok-bg: #e7f5ec; --ok: #166534;
  --err-bg: #fdecea; --err: #b42318;
  --warn-bg: #fdf3dc; --warn: #8a5a00;
  --st-pending: #8a5a00; --st-pending-bg: #fdf3dc;
  --st-printed: #1d4ed8; --st-printed-bg: #e8effd;
  --st-packed: #5b3fd1; --st-packed-bg: #efebfd;
  --st-shipped: #166534; --st-shipped-bg: #e7f5ec;
  --st-delayed: #ffffff; --st-delayed-bg: #d92d20;
  --st-plain: #4a4f5c; --st-plain-bg: #eceae4;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23,32,51,.04), 0 2px 10px rgba(23,32,51,.04);
  --shadow-lg: 0 10px 40px rgba(23,32,51,.14);
  --tabbar-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
h2 { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 14px; }
h2.inline { display: inline; }
h3, h4 { margin: 18px 0 8px; font-size: .92rem; font-weight: 700; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.ico { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 900; font-size: 1.05rem; letter-spacing: -.04em; }
.brand-text { display: grid; line-height: 1.05; }
.brand-text b { font-weight: 800; letter-spacing: .16em; font-size: .95rem; }
.brand-text small { font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.nav { display: none; gap: 2px; }
.nav a { color: var(--text-2); padding: 8px 12px; border-radius: 9px; white-space: nowrap; font-weight: 500; font-size: .92rem; transition: background .15s, color .15s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.nav-new { background: var(--brand); color: #fff; font-weight: 700; margin-left: 4px; }
.nav a.nav-new.on { box-shadow: 0 0 0 3px var(--accent-soft); }
.me { margin-left: auto; position: relative; }
.me summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); font-size: .88rem; }
.me summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.me-name { display: none; }
.menu { position: absolute; right: 0; top: calc(100% + 10px); width: 220px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: grid; }
.menu-head small { color: var(--muted); }
.menu a, .menu button, .sheet a, .sheet button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 8px;
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover, .sheet a:hover, .sheet button:hover { background: var(--surface-2); }
.menu .ico, .sheet .ico { width: 18px; height: 18px; color: var(--muted); }
.menu a.on, .sheet a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu a.on .ico, .sheet a.on .ico { color: var(--accent); }
.menu-group { padding: 10px 10px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-more { position: relative; }
.nav-more > summary { list-style: none; cursor: pointer; color: var(--text-2); padding: 8px 12px; border-radius: 9px; font-weight: 500; font-size: .92rem; white-space: nowrap; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover { background: var(--surface-2); color: var(--text); }
.nav-more > summary.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-more .menu { left: 0; right: auto; width: 240px; max-height: calc(100vh - 90px); overflow: auto; }
.sheet { max-height: calc(100vh - var(--tabbar-h) - 40px); overflow: auto; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.sheet-grid a { font-size: .9rem; }
@media (min-width: 1200px) { .me-name { display: inline; } }
@media (min-width: 900px) {
  .nav { display: flex; align-items: center; }
  .topbar { padding: 12px 28px; }
}

/* ---------- phone tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
}
.tabbar > a, .tab-more > summary {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .7rem; font-weight: 600; list-style: none; cursor: pointer;
}
.tab-more { flex: 1; display: flex; }
.tab-more > summary::-webkit-details-marker { display: none; }
.tabbar > a.on, .tab-more.on > summary { color: var(--accent); }
.tab-new .ico { width: 44px; height: 44px; padding: 11px; border-radius: 14px; background: var(--brand); color: #fff; margin-top: -18px; box-shadow: 0 6px 16px rgba(37,99,235,.35); }
.tab-new span { color: var(--text); }
.sheet { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; }
.sheet a.on { background: var(--surface-2); font-weight: 600; }
@media (min-width: 900px) { .tabbar { display: none; } }

.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px calc(var(--tabbar-h) + 40px); }
@media (min-width: 900px) { .wrap { padding: 28px 28px 60px; } }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { font-size: .85rem; display: inline-flex; margin-bottom: 6px; color: var(--muted); font-weight: 500; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.22); }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 1rem; cursor: pointer; }
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.linkbtn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 4px; }
form.inline { display: inline; }

input, select, textarea {
  width: 100%; min-height: 46px; padding: 11px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zooming into fields */
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 70px; }
/* Same look for dropdowns in every browser (Safari ignores height/padding on native selects). */
select {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer; line-height: 1.3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858891' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; display: block; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=number] { -moz-appearance: textfield; }
input[type=file] { font-size: .9rem; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
input[type=color] { width: 46px; padding: 4px; flex: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input:user-invalid, textarea:user-invalid { border-color: var(--err); }
.w-sm { width: 140px; } .w-xs { width: 76px; }
label { display: block; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; font-weight: 500; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.req { color: var(--err); font-style: normal; }

/* ---------- alerts, badges, tags ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; font-weight: 500; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.err { background: var(--err-bg); color: var(--err); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; vertical-align: middle; }
.badge.pending { color: var(--st-pending); background: var(--st-pending-bg); }
.badge.printing { color: var(--st-printed); background: var(--st-printed-bg); box-shadow: inset 0 0 0 1px currentColor; }
.badge.printed { color: var(--st-printed); background: var(--st-printed-bg); }
.badge.packed { color: var(--st-packed); background: var(--st-packed-bg); }
.badge.shipped { color: var(--st-shipped); background: var(--st-shipped-bg); }
.badge.delayed { color: var(--st-delayed); background: var(--st-delayed-bg); }
.badge.plain { color: var(--st-plain); background: var(--st-plain-bg); }
.late { color: var(--err); font-weight: 600; font-size: .8rem; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .84rem; color: var(--text-2); }
.tag-on { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.tag-off { color: var(--muted); }
.mini-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; background: var(--st-plain-bg); color: var(--st-plain); white-space: nowrap; display: inline-block; }

/* ---------- panels, grids ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel.narrow { max-width: 480px; }
.panel-alert { border-color: color-mix(in srgb, var(--st-delayed-bg) 50%, var(--border)); }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-self: end; }
.lbl { font-size: .76rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.val { font-size: 1rem; word-break: break-word; display: flex; align-items: center; gap: 8px; }
.val.strong { font-size: 1.15rem; font-weight: 700; }
.dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); flex: none; }
.two-col { display: grid; gap: 14px; }
.two-col .panel { margin: 0; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; margin-bottom: 14px; } }

/* ---------- tabs & filters ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 2px 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; font-weight: 600; font-size: .87rem; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs a.warn:not(.on) { border-color: color-mix(in srgb, var(--st-delayed-bg) 45%, transparent); color: var(--err); }
.tabs .count { font-size: .72rem; background: rgba(127,127,127,.16); padding: 1px 7px; border-radius: 999px; }
.tabs a.on .count { background: rgba(255,255,255,.2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.filters input[type=search] { flex: 1 1 220px; padding-left: 40px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858891' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 18px; }
.filters select, .filters input:not([type=search]) { flex: 1 1 160px; width: auto; max-width: 100%; }
@media (min-width: 700px) { .filters select, .filters input:not([type=search]) { flex: 0 1 220px; } }
.filters > .btn { flex: none; }
.filters details { flex: 1 1 100%; order: 3; }
.filters summary { cursor: pointer; color: var(--text-2); font-size: .88rem; font-weight: 600; padding: 4px 0; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.filter-grid label { font-size: .78rem; color: var(--text-2); display: grid; gap: 4px; font-weight: 600; }

/* ---------- order cards ---------- */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); color: var(--text); display: block; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--border-strong); }
.card.is-delayed { box-shadow: inset 4px 0 0 var(--st-delayed-bg), var(--shadow); }
.card.inactive, .inactive { opacity: .55; }
.card-link { position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.card-top { display: flex; gap: 12px; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--surface-2); flex: none; border: 1px solid var(--border); }
.swatch-thumb { display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--sw) 55%, var(--surface-2)); }
.card-main { flex: 1; min-width: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cust { margin-top: 2px; font-size: .92rem; }
.spec { color: var(--text-2); font-size: .88rem; margin-top: 2px; }
.qty { font-weight: 700; color: var(--text); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--muted); margin-top: 6px; align-items: center; }
.ticks { display: flex; gap: 6px; margin-top: 12px; position: relative; z-index: 2; }
.tick {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.tick .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong); display: inline-grid; place-items: center; font-size: 12px; line-height: 1; color: transparent; background: var(--surface); }
.tick.done { background: var(--st-shipped-bg); color: var(--st-shipped); border-color: transparent; }
.tick.done .box { background: var(--st-shipped); border-color: var(--st-shipped); color: var(--surface); }
.tick:disabled { cursor: default; }
.tick:not(.done):disabled { opacity: .7; }
.tick.busy { opacity: .5; pointer-events: none; }
.tick.info { cursor: default; }
.ticks-panel { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .ticks-panel { grid-template-columns: repeat(3, 1fr); } }
.tick.big { min-height: 64px; justify-content: flex-start; padding: 10px 14px; font-size: 1rem; text-align: left; }
.tick.big .box { width: 28px; height: 28px; font-size: 16px; flex: none; border-radius: 8px; }
.tick.big small { display: block; font-weight: 500; font-size: .76rem; opacity: .85; }
.tick.big:not(.done):not(:disabled):not(.info) { border-color: var(--border-strong); background: var(--surface); }
.tick.big:not(.done):not(:disabled):not(.info):hover { border-color: var(--st-shipped); }
.user-card { display: grid; gap: 4px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; }

/* ---------- mock-up gallery & upload ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
@media (min-width: 700px) { .gallery:not(.edit) { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.gal-item { display: block; position: relative; }
.gal-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: block; }
.gal-item .del { display: flex; gap: 6px; align-items: center; font-size: .82rem; padding: 6px 0; }
.upload-box { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.upload-box:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-box input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-box > span { min-width: 0; }
.upload-box:focus-within { border-color: var(--accent); }
.upload-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); font-size: 22px; box-shadow: var(--shadow); flex: none; }
.upload-box b { display: block; }
.upload-box small { display: block; color: var(--muted); font-size: .8rem; }
.file-input { padding: 10px; background: var(--surface-2); }
.preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preview:empty { display: none; }
.preview img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.lightbox { position: fixed; inset: 0; background: rgba(5,8,15,.94); z-index: 100; display: grid; place-items: center; overflow: auto; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; cursor: zoom-in; }
.lightbox img.zoom { max-width: none; max-height: none; width: 200vw; cursor: zoom-out; }
.lb-close { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 22px; cursor: pointer; }

/* Form buttons: a normal row at the end of the form, after the last field. */
.sticky-actions {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--border);
}
.sticky-actions .btn.primary { flex: 1 1 200px; min-height: 52px; font-size: 1rem; }
@media (min-width: 700px) { .sticky-actions { justify-content: flex-end; } .sticky-actions .btn.primary { flex: 0 1 280px; } }
.danger-zone { margin: 24px 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.history { list-style: none; padding: 0; margin: 10px 0 0; font-size: .84rem; display: grid; gap: 8px; }
summary { cursor: pointer; }

/* ---------- order form: items ---------- */
.items-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 22px 0 10px; }
.items-head h2 { margin: 0; }
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.item-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-num { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 8px; background: var(--brand); color: #fff; font-size: .85rem; font-weight: 700; }
.item-tools { display: flex; gap: 6px; }
.remove-toggle { position: relative; }
.remove-toggle input { position: absolute; opacity: 0; }
.remove-toggle:has(input:checked) { background: var(--err-bg); border-color: var(--err); }
.item-card { position: relative; }
.item-card::before { content: ""; position: absolute; left: -1px; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.item-card.removing { opacity: .45; }
.item-card.removing .grid, .item-card.removing .design-only, .item-card.removing .seg-toggle, .item-card.removing .neck-row { pointer-events: none; }
.item-card.is-plain .design-only { display: none; }
.item-card .mockup-field { margin-top: 16px; }
.item-view { display: grid; gap: 12px; }
.item-view .item-head { margin-bottom: 0; }
.item-view.is-printed { box-shadow: inset 3px 0 0 var(--st-shipped), var(--shadow); }
.item-view.is-plain { box-shadow: inset 3px 0 0 var(--muted), var(--shadow); }
.item-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.qty-pill { font-weight: 800; font-size: 1.05rem; padding: 4px 12px; border-radius: 10px; background: var(--surface-3); white-space: nowrap; }
.printed-note { color: var(--st-shipped); margin: -4px 0 10px; font-weight: 600; }
.add-item { width: 100%; border-style: dashed; border-width: 1.5px; margin-bottom: 14px; min-height: 56px; color: var(--text-2); background: transparent; }
.add-item:hover { background: var(--surface); color: var(--text); }
.total-pcs { font-weight: 700; color: var(--text-2); font-size: .9rem; flex: 1 1 100%; }
@media (min-width: 600px) { .total-pcs { flex: 0 0 auto; margin-right: auto; } }

/* Printed / Plain segmented toggle */
.seg-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; margin-bottom: 16px; }
.seg-toggle label { position: relative; }
.seg-toggle input { position: absolute; opacity: 0; }
.seg-toggle span { display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.2; padding: 4px 8px; min-height: 42px; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.seg-toggle input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(23,32,51,.12); }
.seg-toggle input:focus-visible + span { outline: 2px solid var(--accent); }

/* Chip pickers (GSM / product / color / size) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  font: inherit; font-size: .9rem; font-weight: 500; color: var(--text); cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.chip:hover { border-color: var(--muted); }
.chip.on { border-color: var(--brand); background: var(--brand); color: #fff; font-weight: 600; }
.chip.size { min-width: 50px; justify-content: center; padding: 0 10px; font-weight: 600; }
.chip .dot { width: 18px; height: 18px; }
.chip.on .dot { box-shadow: 0 0 0 2px #fff; }
.chip.other { border-style: dashed; color: var(--text-2); }
.chips-empty { color: var(--muted); font-size: .85rem; padding: 8px 0; }
select.has-chips { position: absolute; opacity: 0; pointer-events: none; height: 1px; width: 1px; min-height: 0; padding: 0; }

/* Quantity stepper */
.stepper { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; max-width: 200px; background: var(--surface); }
.stepper input { border: 0; border-radius: 0; text-align: center; font-weight: 700; font-size: 1.1rem; min-width: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; }
.stepper button { width: 52px; flex: none; border: 0; background: var(--surface-2); font-size: 1.4rem; color: var(--text); cursor: pointer; }
.stepper button:active { background: var(--surface-3); }

/* Neck label switch */
.neck-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.neck-row .neck-text { flex: 1 1 220px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 46px; height: 28px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .18s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s; }
.switch input:checked + .switch-ui { background: var(--st-shipped); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.print-details { margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; background: var(--surface); }
.print-details > summary { font-weight: 600; min-height: 50px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; list-style: none; }
.print-details > summary::-webkit-details-marker { display: none; }
.print-details > summary::after { content: "›"; margin-left: auto; font-size: 1.3rem; color: var(--muted); transition: transform .15s; }
.print-details[open] > summary::after { transform: rotate(90deg); }
.print-details[open] { padding-bottom: 14px; }
.print-details[open] > summary { margin-bottom: 6px; }

.item-lines { list-style: none; margin: 8px 0 0; padding: 0; font-size: .84rem; color: var(--text-2); display: grid; gap: 3px; }
.item-lines li { display: flex; gap: 7px; align-items: baseline; }
.item-lines .pdot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; transform: translateY(-1px); }
.item-lines .pdot.on { background: var(--st-shipped); border-color: var(--st-shipped); }
.item-lines .pdot.plain { border-style: dashed; }
.item-lines .more { color: var(--muted); }

/* ---------- dashboard ---------- */
.section-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 22px 0 10px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } .stats.pipeline { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .stats.pipeline { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 2px; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s; }
a.stat:hover { border-color: var(--border-strong); }
.stat-label { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.stat-num { font-size: clamp(1.35rem, 6.2vw, 2rem); overflow-wrap: anywhere; font-weight: 800; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat-sub { font-size: .8rem; color: var(--muted); }
.stat-alert { border-color: color-mix(in srgb, var(--st-delayed-bg) 45%, transparent); background: var(--err-bg); }
.stat-alert .stat-label, .stat-alert .stat-num { color: var(--err); }
.stat-warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.day-pick { display: flex; gap: 6px; align-items: center; }
.day-pick input { width: auto; }
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; -webkit-overflow-scrolling: touch;
  /* soft edge shadows show there is more to scroll */
  background: linear-gradient(to right, var(--surface) 30%, transparent) left / 30px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 30px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(23,32,51,.12), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(23,32,51,.12), transparent) right / 12px 100% no-repeat scroll; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; font-weight: 700; }
.table tbody tr[onclick] { cursor: pointer; }
.table tbody tr[onclick]:hover { background: var(--surface-2); }
.table.compact td, .table.compact th { padding: 8px; }
.table td.wrap-cell { white-space: normal; min-width: 220px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 16px; font-size: .84rem; color: var(--text-2); margin-bottom: 10px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.key.k1, .bar.b1 { background: var(--series-1); }
.key.k2, .bar.b2 { background: var(--series-2); }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; height: 180px; align-items: end; border-bottom: 1px solid var(--border); margin-bottom: 36px; }
.bar-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; outline: none; border-radius: 6px; }
.bar-pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; padding: 0 1px; }
.bar { flex: 1; min-height: 0; border-radius: 4px 4px 0 0; }
.bar-col.sel .bar-x { color: var(--text); font-weight: 700; }
.bar-x { position: absolute; top: 100%; left: 0; right: 0; text-align: center; font-size: .7rem; color: var(--muted); padding-top: 4px; line-height: 1.1; }
.bar-col:hover, .bar-col:focus { background: rgba(127,127,127,.08); }
.bar-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: .78rem; white-space: nowrap; z-index: 5; box-shadow: var(--shadow-lg); }
.bar-col:hover .bar-tip, .bar-col:focus .bar-tip { display: block; }
.bar-col:nth-child(-n+3) .bar-tip { left: 0; transform: none; }
.bar-col:nth-last-child(-n+3) .bar-tip { left: auto; right: 0; transform: none; }

/* ---------- admin ---------- */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.perm-group { border-top: 1px solid var(--border); padding-top: 14px; color: var(--text-2); }
.perm-table { display: grid; gap: 4px; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; }
.perm-name { font-weight: 500; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; flex: none; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 9px 12px; font-size: .84rem; cursor: pointer; min-width: 58px; text-align: center; }
.seg label + label span { border-left: 1px solid var(--border); }
.seg-none input:checked + span { background: var(--surface-3); color: var(--text-2); font-weight: 700; }
.seg-view input:checked + span { background: var(--st-printed-bg); color: var(--st-printed); font-weight: 700; }
.seg-edit input:checked + span { background: var(--st-shipped-bg); color: var(--st-shipped); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.chip-list { display: grid; gap: 6px; margin-bottom: 10px; }
.chip-form, .color-row, .inline-add { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.color-row input[name=name] { flex: 1 1 140px; width: auto; }
.inline-add { margin-top: 10px; }
.inline-add input[name=name] { flex: 1 1 180px; width: auto; }
.color-rows { display: grid; gap: 6px; }
details.product { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; background: var(--surface-2); }
details.product[open] { background: var(--surface); }
details.product summary { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.swatches { display: inline-flex; gap: 3px; }
.swatches i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); display: inline-block; }
.field-row { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }

/* ---------- login ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% 0%, #e3ecfd 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px 26px; box-shadow: var(--shadow-lg); }
.auth-card .brand-mark { width: 48px; height: 48px; font-size: 1.4rem; background: var(--brand); color: #fff; border-radius: 13px; margin-bottom: 16px; }
.brand-lg { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: 1.3rem; }

/* ---------- saved designs ---------- */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.design-tile { display: flex; flex-direction: column; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); padding: 0; font: inherit; cursor: pointer; transition: border-color .15s, transform .1s; }
.design-tile:hover { border-color: var(--border-strong); }
.design-tile:active { transform: scale(.98); }
.design-tile img, .design-noimg { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 40px; }
.design-info { padding: 10px 12px 12px; display: grid; gap: 2px; }
.design-info b { font-size: .92rem; line-height: 1.3; }
.design-info small { font-size: .78rem; color: var(--text-2); }
.design-pick { margin-bottom: 14px; }
.design-btn { width: 100%; justify-content: flex-start; min-height: 50px; background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)); border-color: transparent; color: var(--text); }
.design-btn:hover { border-color: var(--accent); }
.design-chosen { margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--accent); background: var(--surface); display: grid; gap: 4px; }
.design-chosen-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.design-chosen-head .linkbtn { color: var(--err); font-weight: 600; font-size: .85rem; }
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(8,12,22,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal-card { width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 12px; align-content: start; box-shadow: var(--shadow-lg); }
@media (min-width: 700px) { .modal { align-items: center; } .modal-card { border-radius: 20px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; }
.design-grid.in-modal { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* ---------- customer suggestions ---------- */
.field { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 25; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; max-height: 320px; overflow: auto; }
.suggest-row { display: grid; width: 100%; text-align: left; gap: 1px; padding: 10px 12px; border: 0; background: none; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; }
.suggest-row:hover, .suggest-row:focus, .suggest-row.on { background: var(--surface-2); }
.suggest-row span { font-size: .82rem; color: var(--text-2); }

/* Safety: previews and thumbnails can never blow up the layout. */
.upload-box img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
img { max-width: 100%; height: auto; }
.preview img, .thumb, .gal-item img, .design-tile img { height: revert-layer; }
.preview img { height: 76px; }
.thumb { height: 72px; }
/* Grid children must be allowed to shrink so wide tables scroll inside them instead of stretching the page. */
.two-col > *, .grid > *, .stats > *, .cards > *, .card-main, .page-head > * { min-width: 0; }
/* Chip pickers get a full row; long text boxes go after the short fields so short fields pair up nicely. */
.grid > .field:has(.chips) { grid-column: 1 / -1; }
.grid > .field.full { order: 5; }
.chips + .suggest { display: none; }
/* Catalog rows (colors, couriers): keep name, tick and buttons on one line on phones. */
.color-row { flex-wrap: nowrap; }
.color-row input[name=name] { flex: 1 1 auto; width: 0; min-width: 70px; }
.color-row .check { min-height: 36px; gap: 6px; font-size: .82rem; white-space: nowrap; flex: none; }
.color-row .btn.small { flex: none; padding: 0 10px; }
.chip-form input[name=name] { flex: 1 1 auto; width: 0; min-width: 90px; }
@media (max-width: 420px) { .color-row .check { font-size: 0; gap: 0; } .color-row .check input { margin: 0; } }

/* ---------- WhatsApp, dropdown menus, packing slips ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: 260px; }
@media (max-width: 600px) { .dropdown .menu { left: 0; right: auto; } }
.menu a.muted { color: var(--muted); }
.wa-ico { width: 18px; height: 18px; flex: none; }
.wa-btn { color: #128c4b; border-color: color-mix(in srgb, #25d366 55%, var(--border)); }
.wa-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius);
  background: #e8f9ef; color: #0b5e33; border: 1px solid #b7ebcb; font-weight: 500; }
.wa-banner .wa-ico { width: 28px; height: 28px; color: #25d366; }
.wa-banner span:nth-child(2) { flex: 1; display: grid; }
.wa-banner small { color: #2f7a52; font-weight: 400; }
.wa-banner > span:last-child { font-size: 1.4rem; }

/* ---------- print list ---------- */
.blank-name { display: inline-flex; align-items: center; gap: 8px; }
.size-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.size-pill { padding: 3px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); font-size: .84rem; white-space: nowrap; }
.table tfoot td { border-bottom: 0; padding-top: 12px; }
.table.blanks tbody tr { cursor: default; }
.print-items { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .print-items { grid-template-columns: repeat(2, 1fr); } }
.print-item { margin: 0; display: grid; gap: 12px; align-content: start; }
.print-item.is-late { box-shadow: inset 3px 0 0 var(--st-delayed-bg), var(--shadow); }
.print-item.done-now { opacity: .55; }
.pi-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pi-hold { margin-left: auto; }
.pi-hold .btn { min-height: 32px; border-color: var(--border); }
.held-list { margin-top: 14px; }
.pi-search { margin-bottom: 12px; }
form.filters.busy { opacity: .6; pointer-events: none; }
.print-item[hidden] { display: none; }
.held-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.held-main { flex: 1; min-width: 0; }
.held-row form { flex: none; }
.pi-body { display: flex; gap: 12px; }
.pi-imgs { display: grid; grid-template-columns: repeat(2, 84px); gap: 6px; flex: none; align-content: start; }
.pi-imgs .gal-item img { width: 84px; height: 84px; }
.pi-imgs:has(> :only-child) { grid-template-columns: 120px; }
.pi-imgs:has(> :only-child) .gal-item img { width: 120px; height: 120px; }
.pi-info { flex: 1; min-width: 0; display: grid; gap: 6px; align-content: start; }
.pi-blank { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 1.02rem; }
.pi-print { font-size: .9rem; word-break: break-word; }
.pi-print .lbl { margin-right: 4px; }
@media (max-width: 420px) { .pi-imgs { grid-template-columns: repeat(2, 64px); } .pi-imgs .gal-item img { width: 64px; height: 64px; } }

@media print {
  .topbar, .tabbar, .tabs, .page-head .actions, .tick, .lightbox, .wa-banner, .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .panel { box-shadow: none; break-inside: avoid; }
  .print-items { grid-template-columns: repeat(2, 1fr); }
}
.blank-list { display: grid; }
.blank-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.blank-row > .dot { width: 22px; height: 22px; }
.blank-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.blank-total { font-size: 1.4rem; font-weight: 800; text-align: right; line-height: 1; font-variant-numeric: tabular-nums; }
.blank-total small { display: block; font-size: .7rem; font-weight: 600; color: var(--muted); }
.blank-sum { border-bottom: 0; padding-left: 34px; }
/* Dark mode: selected tab needs its own colour (the brand navy disappears on a dark background). */

/* ---------- item types ---------- */
.type-toggle { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .type-toggle { grid-template-columns: repeat(4, 1fr); } }
.type-toggle span { font-size: .84rem; padding: 0 6px; text-align: center; line-height: 1.2; }
.item-card.type-plain .design-only { display: none; }
.item-card.type-print_only .blank-only, .item-card.type-dtf_roll .blank-only { display: none; }
.item-card.type-dtf_roll .qty-only, .item-card.type-dtf_roll .no-roll { display: none; }
.roll-only { display: none; }
.item-card.type-dtf_roll .roll-only { display: flex; }
.qty-lbl-print { display: none; }
.item-card.type-print_only .qty-lbl-shirt { display: none; }
.item-card.type-print_only .qty-lbl-print { display: inline; }
.qty-row { margin-top: 14px; }
.sub-order { margin-bottom: 14px; }
.unit-input { display: flex; align-items: stretch; max-width: 200px; }
.unit-input input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.unit-input span { display: grid; place-items: center; padding: 0 14px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); font-weight: 600; }
.edit-box > summary { list-style: none; display: inline-flex; } .edit-box > summary::-webkit-details-marker { display: none; } details.panel.edit-box > summary { display: flex; cursor: pointer; }
.row-btns { flex-direction: row; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* ---------- print places ---------- */
.print-place .pp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.print-place .pp-size { width: auto; min-width: 150px; max-width: 220px; min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: .9rem; }
.size-tag { margin-left: 6px; text-transform: none; letter-spacing: 0; font-size: .78rem; font-weight: 700; padding: 2px 8px; }
.neck-row .neck-text { flex: 1 1 240px; display: flex; flex-direction: column; gap: 4px; }
.neck-row .neck-text[hidden] { display: none; }

/* Quick date filters on the order list */
.date-chips { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; margin: -4px -16px 12px; padding: 2px 16px; }
.date-chips::-webkit-scrollbar { display: none; }
.date-chips > span.muted { flex: none; margin-right: 2px; }
.date-chips a, .date-chips .chip-custom { flex: none; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .84rem; font-weight: 600; white-space: nowrap; }
.date-chips a.on, .date-chips .chip-custom.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.cust-chip { display: inline-flex; align-items: center; font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); vertical-align: middle; letter-spacing: .02em; }
.cust-no { font-size: 1.05rem; min-height: 44px; display: flex; align-items: center; }
.design-tag { border-color: var(--accent); }
.design-current { margin: 8px 0 0; color: var(--text-2); }

/* ---------- production estimate ---------- */
.est-input { position: relative; display: flex; align-items: center; }
.est-input input { flex: 1; min-width: 0; padding-right: 58px; }
.est-suffix { position: absolute; right: 12px; font-size: .8rem; color: var(--muted); pointer-events: none; }
.est-seg { margin: 0; }
.est-presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.est-sizes td { vertical-align: middle; }
.est-sizes .est-cell { width: 72px; min-height: 38px; padding: 6px 8px; text-align: right; }
.est-sizes .est-cell.est-size { width: 64px; text-align: left; font-weight: 700; }
.est-sizes tbody tr { cursor: default; }
.est-sizes tbody tr:hover { background: none; }
.est-sizes tfoot th { border-bottom: 0; color: var(--text); font-size: .85rem; }
.est-allow { margin-top: 14px; }
.est-allow summary { cursor: pointer; margin-bottom: 10px; }
.est-h3 { margin: 18px 0 6px; font-size: 1rem; }
.est-breakdown { max-width: 520px; }
.est-breakdown tr { cursor: default; }
.est-breakdown tr.sub td { border-top: 2px solid var(--border); }
.est-breakdown tr.total td { font-size: 1.05rem; background: var(--surface-2); }
.est-saved tr.on td { background: var(--surface-2); }
.err-text { color: var(--err); font-weight: 600; }
.quote-sheet { display: none; }
@media print {
  body.printing-quote > *:not(main), body.printing-quote main > *:not(.quote-sheet) { display: none !important; }
  body.printing-quote .quote-sheet { display: block !important; color: #000; font-size: 11pt; }
  .quote-sheet h1 { margin: 0; font-size: 20pt; }
  .quote-sheet .q-sub { margin: 2px 0 14px; color: #444; }
  .quote-sheet table { width: 100%; border-collapse: collapse; margin: 12px 0; }
  .quote-sheet th, .quote-sheet td { border: 1px solid #999; padding: 6px 8px; text-align: right; }
  .quote-sheet th:first-child, .quote-sheet td:first-child { text-align: left; }
  .quote-sheet .q-note { color: #444; font-size: 9pt; }
}
.est-result .stat-num { font-size: 1.5rem; white-space: nowrap; }
.est-pieces tr { cursor: default; } .est-pieces tr.sub td { border-top: 2px solid var(--border); }
.est-sizes .est-cell.est-ov { width: 84px; }
.est-sizes .est-cell.est-ov::placeholder { color: var(--text); opacity: .75; }
.est-sizes .est-cell.est-ov.is-manual { border-color: var(--accent); background: var(--accent-soft, #eef3ff); font-weight: 700; }
.manual-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-left: 4px; }
.extra-costs { display: grid; gap: 8px; margin: 14px 0 10px; }
.extra-row { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; align-items: center; }
.pg-contents { display: contents; } .pg-contents[hidden] { display: none; }
.est-sizes.hide-fabric .col-fabric, .est-sizes.hide-cost .col-cost, .est-sizes.hide-price .col-price { display: none; }
.est-form .is-view input[readonly], .est-sizes .est-ov[readonly] { background: var(--surface-2); color: var(--text-2); }
.pi-head .tick.pi-pp { margin-left: auto; min-height: 34px; padding: 4px 10px; font-size: .82rem; }
.pi-head .tick.pi-pp + .pi-hold { margin-left: 0; }
.pi-head .tick.pi-pp { flex: none; }
@media (min-width: 600px) { .ticks-panel { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .ticks-panel { grid-template-columns: repeat(4, 1fr); } }
/* Order card ticks: 2 × 2 on normal cards, one row of 4 only when the card is wide enough. */
.order-card { container-type: inline-size; }
.ticks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ticks .tick { min-width: 0; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick .box { flex: none; }
@container (min-width: 620px) { .ticks { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Neck label / chest logo: own images and "done" tick */
.neck-row + .neck-row { margin-top: 10px; }
.neck-row .neck-text .upload-box { margin-top: 4px; }
.small-upload { padding: 10px 12px; }
.small-upload .upload-icon { font-size: 1.2rem; }
.small-gallery { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important; margin: 4px 0; }
.addon-box { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.addon-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.addon-title { font-weight: 600; }
.tick.addon-tick { flex: none; min-height: 38px; padding: 0 12px; }
.pi-addon { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); display: grid; gap: 6px; }
.pi-addon-imgs { display: flex; gap: 6px; flex-wrap: wrap; }
.pi-addon-imgs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.pi-addon .tick.addon-tick { justify-self: start; }
.alert { white-space: pre-line; }

/* ---------- stock, bills, salary ---------- */
form.inline { display: inline-flex; margin: 0; }
.month-nav { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.month-nav b { font-size: 1.05rem; min-width: 130px; text-align: center; }
a.stat { text-decoration: none; }
.stat.stat-warn { border-color: color-mix(in srgb, var(--err) 45%, var(--border)); }
.stat.stat-warn .stat-num { color: var(--err); }
.chips .chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); cursor: pointer; font-weight: 600; }
.chips .chip-check input { width: auto; min-height: 0; }
.quick-add { display: flex; gap: 6px; align-items: center; }
.quick-add input { width: 80px; min-height: 36px; padding: 6px 8px; }
.stock-table td { vertical-align: middle; }
.bill-lines { display: grid; gap: 10px; margin-bottom: 10px; }
.bill-line { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); position: relative; }
.bill-line .bl-desc { grid-column: 1 / -1; }
.bill-line [data-del-line] { position: absolute; top: 6px; right: 6px; }
.bill-line .bl-amt b { font-size: 1.05rem; padding-top: 10px; display: block; }
.bill-line input { min-height: 40px; padding: 8px 10px; }
@media (min-width: 860px) {
  .bill-line { grid-template-columns: minmax(220px, 3fr) 0.8fr 0.7fr 1fr 0.7fr 0.9fr 1fr 32px; align-items: end; padding: 10px 12px; }
  .bill-line .bl-desc { grid-column: auto; }
  .bill-line [data-del-line] { position: static; }
}
.totals-table { max-width: 420px; margin-left: auto; }
.totals-table td:not(.num) { white-space: normal; }
.totals-table td.num { white-space: nowrap; padding-left: 12px; }
.totals-table tr { cursor: default; }
.totals-table tr.total td { font-size: 1.1rem; border-top: 2px solid var(--border-strong); }
.sal-cards { display: grid; gap: 12px; }
.sal-card { margin: 0; }
.sal-card.is-paid { border-color: color-mix(in srgb, var(--st-shipped) 40%, var(--border)); }
.sal-card .net { color: var(--st-shipped); font-size: 1.3rem; }
.sal-card .check input[type=date] { width: auto; min-height: 36px; padding: 4px 8px; margin-left: 6px; }
.cat-bars { display: grid; gap: 8px; }
.cat-bar { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr auto; gap: 10px; align-items: center; color: var(--text); text-decoration: none; padding: 4px 6px; border-radius: 8px; }
.cat-bar.on, .cat-bar:hover { background: var(--surface-2); }
.cat-bar .cb-name { font-size: .88rem; }
.cb-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cb-track i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.acct-table { max-width: none; }
.acct-table tr.sub td { background: var(--surface-2); font-size: .85rem; }
.acct-table tr.profit td { color: var(--st-shipped); font-size: 1.15rem; }
.acct-table tr.loss td { color: var(--err); font-size: 1.15rem; }
.acct-table td:first-child { white-space: normal; }
.acct-table td.num { white-space: nowrap; }
.month-nav { flex-wrap: wrap; }

/* ---------- phone comfort ---------- */
@media (max-width: 600px) {
  .page-head { align-items: stretch; }
  .page-head > div:first-child { width: 100%; }
  .page-head .actions { width: 100%; }
  .page-head .actions > .btn, .page-head .actions > form, .page-head .actions > details { flex: 1 1 calc(50% - 8px); }
  .page-head .actions > form .btn, .page-head .actions > details > summary.btn { width: 100%; }
  .btn:not(.small) { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
  .danger-zone { display: flex; flex-wrap: wrap; gap: 8px; }
}

.seg-links { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; }
.seg-links a { padding: 6px 12px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.seg-links a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(23,32,51,.12); }
input[type=file] { font: inherit; font-size: .88rem; color: var(--text-2); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 10px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
@media (max-width: 600px) { .btn.small { white-space: normal; text-align: center; line-height: 1.2; padding-top: 6px; padding-bottom: 6px; } }
/* order form: price fields and bill panel */
.print-rate-only { display: none; }
.item-card.type-print .print-rate-only { display: flex; }
.seg-toggle.three { grid-template-columns: repeat(3, 1fr); }
.bill-panel .seg-toggle.three { max-width: 520px; }
.price-tag { margin-left: auto; font-size: .82rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.price-tag.unset { background: var(--warn-bg); color: var(--warn); }
.new-products { display: grid; gap: 10px; }
.new-product { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.new-product .np-fields { margin-top: 8px; }
@media (min-width: 700px) { .new-product .np-fields { grid-template-columns: 1fr 2fr 1fr; } }
/* simple "Add stock" form */
.add-stock { border: 2px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.add-stock form { display: grid; gap: 14px; }
.size-qty { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.size-qty .sq { display: grid; gap: 4px; text-align: center; padding: 8px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.size-qty .sq b { font-size: .95rem; }
.size-qty .sq input { text-align: center; font-size: 1.1rem; font-weight: 700; padding: 8px 4px; }
.size-qty .sq small { font-size: .72rem; }
.add-stock .seg-toggle { margin: 0; }
.as-save { justify-self: start; min-width: 200px; }
@media (max-width: 600px) { .as-save { justify-self: stretch; } }
.tier-line { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 12px; }
.tier-line span { padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.pp-table input { max-width: 140px; }
.pp-table td.num input { text-align: right; margin-left: auto; }
/* print method per place */
.print-place .pp-head select { width: auto; min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: .9rem; }
.print-place .pp-method { min-width: 130px; font-weight: 600; }
.pp-extra { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.pp-extra label { display: grid; gap: 3px; flex: 1 1 140px; font-size: .78rem; color: var(--text-2); font-weight: 600; }
.pp-extra label small { font-weight: 400; color: var(--muted); }
.print-place[data-method=dtf] .pp-st, .print-place[data-method=dtf] .pp-dg,
.print-place[data-method=dtf]:not(.custom-size) .pp-pr,
.print-place[data-method=emb] .pp-sizebox, .print-place[data-method=emb] .pp-pr,
.print-place[data-method=puff] .pp-st, .print-place[data-method=puff] .pp-dg,
.print-place[data-method=hd] .pp-st, .print-place[data-method=hd] .pp-dg,
.print-place[data-method=screen] .pp-st, .print-place[data-method=screen] .pp-dg { display: none; }
.pp-hint { display: block; margin-bottom: 6px; }
.pp-hint.warn { color: var(--warn); font-weight: 600; }
/* item quantity / price row: boxes line up, short labels, notes under the boxes */
.qty-row { align-items: start; }
.qty-row .field > .lbl { min-height: 1.4em; white-space: nowrap; }
.qty-row input[type=number] { min-height: 48px; }
.field-note { margin: 0; font-size: .78rem; line-height: 1.3; }
input.no-spin { -moz-appearance: textfield; appearance: textfield; }
input.no-spin::-webkit-outer-spin-button, input.no-spin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.warn-text { color: var(--warn); font-weight: 600; }
/* new order: steps */
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; position: sticky; top: 64px; z-index: 5; padding: 8px 0; background: var(--bg); }
.steps a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: .86rem; }
.steps a b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .78rem; }
.steps a:hover { border-color: var(--accent); color: var(--accent); }
.step-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 26px 0 12px; font-size: 1.15rem; scroll-margin-top: 120px; }
.step-title > span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .95rem; }
.step-title small { font-weight: 500; font-size: .82rem; }
.pp-extra label.pp-n { flex: 0 1 110px; }
.bill-preview td.num { white-space: nowrap; }
.bill-preview tr.total td { border-top: 2px solid var(--border-strong); font-size: 1.05rem; }
#billTotalBar { color: var(--accent); margin-left: 4px; }
@media (max-width: 899px) { .steps { top: 56px; } }
.steps { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps a { flex: none; }
@media (max-width: 600px) { .steps a { padding: 5px 10px 5px 6px; font-size: .8rem; } .steps { margin: 0 -16px 6px; padding: 8px 16px; } }
.bill-panel [data-stock-note] { margin: 0 0 14px; }

/* prints: toggles + one compact row per place */
.pp-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.pp-toggles .lbl { width: 100%; }
.pp-toggle { font: inherit; font-weight: 600; font-size: .9rem; padding: 9px 16px; border-radius: 999px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.pp-toggle::before { content: '＋ '; }
.pp-toggle.on { border-style: solid; border-color: var(--accent); background: var(--accent); color: #fff; }
.pp-toggle.on::before { content: '✓ '; }
.pp-empty { margin: 0 0 6px; }
.pp-list { gap: 10px; }
.print-place { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 12px; background: var(--surface-2); }
.print-place .pp-head { margin-bottom: 6px; }
.print-place .pp-head .lbl { font-size: .82rem; color: var(--text); }
.pp-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 4px; }
.pp-row label { display: grid; gap: 3px; font-size: .74rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; min-width: 0; }
.pp-row select, .pp-row input { width: 100%; min-height: 42px; padding-top: 6px; padding-bottom: 6px; font-size: .95rem; text-transform: none; letter-spacing: 0; }
.pp-row .pp-n { max-width: 120px; }
.print-place textarea { margin-top: 2px; }
.icon-btn.small { width: 30px; height: 30px; min-height: 0; font-size: .8rem; }
.pp-total { margin: 6px 0 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: .9rem; }
.pp-total span { color: var(--text-2); font-size: .82rem; }
.pp-total.warn-text { background: var(--warn-bg); }
/* payments */
.pay-sums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.pay-sums div { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.pay-sums span { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pay-sums b { font-size: 1.15rem; }
.ok-text { color: var(--ok); }
.pay-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pay-quick .chip { font-size: .8rem; padding: 5px 10px; }
.pay-form { margin-top: 12px; }
@media (max-width: 600px) { .dues-table .hide-sm { display: none; } }
.gst-switch { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.gst-switch input { margin-top: 3px; }
.gst-switch span { display: grid; gap: 2px; }
.gst-switch small { color: var(--muted); }
.gst-switch:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
/* upload progress */
.upload-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(23,32,51,.35); backdrop-filter: blur(2px); }
.uo-card { width: 100%; max-width: 360px; display: grid; gap: 10px; padding: 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.uo-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.uo-bar span { display: block; height: 100%; width: 3%; border-radius: inherit; background: var(--accent); transition: width .2s; }

/* Mock-ups uploading right away */
.up-tile { position: relative; width: 76px; }
.up-tile img { display: block; width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.up-tile.uploading img { opacity: .55; }
.up-tile.failed img { opacity: .4; border-color: #d33; }
.up-bar { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.8); overflow: hidden; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--accent, #2563eb); transition: width .2s; }
.up-tile.done .up-bar { display: none; }
.up-tile.failed .up-bar { display: none; }
.up-msg { display: none; }
.up-tile.failed .up-msg { display: block; position: absolute; inset: 0; padding: 6px; font-size: 11px; line-height: 1.2; color: #b00; cursor: pointer; text-align: center; display: flex; align-items: center; }
.up-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: #333; font-size: 12px; line-height: 1; padding: 0; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.up-tile.done::after { content: '✓'; position: absolute; left: 4px; bottom: 4px; width: 18px; height: 18px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; }

/* Photo / video the customer wants while the order is made — red so nobody misses it */
.proof-flag { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  color: #fff; background: #d92d20; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; vertical-align: middle; }
.proof-row { margin: 4px 0 2px; }
.order-card.has-proof { border-color: #d92d20; box-shadow: inset 4px 0 0 #d92d20, var(--shadow); }
.proof-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-toggle { position: relative; }
.chip-toggle input { position: absolute; opacity: 0; }
.chip-toggle span { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 6px 16px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface);
  font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip-toggle input:checked + span { background: #d92d20; border-color: #d92d20; color: #fff; }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--accent); }

/* COD / prepaid */
.badge.cod { color: #92400e; background: #fef3c7; box-shadow: inset 0 0 0 1px #f59e0b; }
.badge.prepaid { color: var(--st-shipped); background: var(--st-shipped-bg); }
.pay-type .seg-toggle { margin-bottom: 8px; }
.cod-amount .money-input { display: flex; align-items: center; gap: 6px; }
.cod-amount .money-input span { font-weight: 700; color: var(--text-2); }
.cod-amount .money-input input { flex: 1; font-weight: 700; font-size: 1.05rem; }

/* Duplicate an item */
.dup-btn { white-space: nowrap; }
.item-foot { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.dup-foot { width: 100%; justify-content: center; flex-wrap: wrap; gap: 4px 8px; border-style: dashed; }
.dup-foot small { color: var(--muted); font-weight: 500; }
.up-tile.copied img { opacity: 1; }

/* Add stock: production batch (fabric & rib weight) */
.as-batch { margin: 14px 0 6px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.as-batch-head { margin-bottom: 8px; }
.as-batch-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.as-pw { margin-top: 8px; }
.as-pw summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.as-batch-live { margin: 10px 0 0; padding: 8px 10px; background: var(--surface); border-radius: 8px; line-height: 1.5; }

/* Dashboard: production batches */
.batches { display: grid; gap: 12px; }
@media (min-width: 900px) { .batches { grid-template-columns: 1fr 1fr; } }
.batch { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface); min-width: 0; }
.batch-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.batch-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.batch-kpis > div { display: grid; gap: 1px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.batch-kpis span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.batch-kpis b { font-size: 1.15rem; }
.batch-kpis small { font-size: .74rem; }
.size-split td, .size-split th { white-space: nowrap; }

/* Estimator: figures from production batches */
.est-prod { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.est-prod h3 { margin: 0 0 6px; font-size: 1rem; }
.est-prod tr.row-hl td { background: var(--accent-soft); }
.est-prod .btn.small { margin: 2px 0; }
.batch-cost { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); display: grid; gap: 2px; }
.batch-cost > div { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.batch-cost span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.batch-cost b { font-size: 1.2rem; }

/* Tasks board & performance */
.task-board { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(220px, 1fr)); overflow-x: auto; padding-bottom: 6px; margin: 12px 0; }
@media (max-width: 900px) { .task-board { grid-template-columns: repeat(4, 80vw); scroll-snap-type: x mandatory; } .task-col { scroll-snap-align: start; } }
.task-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.task-col h3 { margin: 0 0 2px; font-size: .9rem; display: flex; gap: 6px; align-items: center; }
.task-col h3 .count { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: .78rem; }
.col-done h3 { color: #15803d; }
.task-list { display: grid; gap: 8px; }
.task-card { display: grid; gap: 3px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: 10px; color: var(--text); text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.task-card:hover { border-color: var(--accent); }
.task-card.prio-high { border-left-color: #f59e0b; }
.task-card.prio-urgent { border-left-color: #d92d20; }
.task-card.is-late { background: #fff5f4; }
.tc-kind { font-size: .72rem; color: var(--muted); }
.tc-kind .prio { color: #b45309; }
.tc-title { font-size: .95rem; line-height: 1.3; }
.tc-meta { font-size: .8rem; color: var(--text-2); }
.tc-foot { display: flex; justify-content: space-between; gap: 6px; font-size: .78rem; }
.tc-link { font-size: .76rem; color: var(--accent); }
.status-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.task-details { white-space: normal; line-height: 1.5; }
.task-result { padding: 8px 10px; background: #ecfdf3; border-radius: 8px; word-break: break-all; }
.perf-periods { margin: 6px 0 12px; display: inline-flex; }
.perf-chart { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; align-items: end; height: 150px; }
.pc-day { display: grid; grid-template-rows: 1fr auto; height: 100%; text-align: center; min-width: 0; }
.pc-day small { font-size: .62rem; color: var(--muted); }
.pc-day.today small { color: var(--accent); font-weight: 700; }
.pc-bars { display: flex; flex-direction: column-reverse; justify-content: flex-start; height: 100%; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.pc-p, .key.pc-p { background: var(--accent); }
.pc-t, .key.pc-t { background: #16a34a; }
.pc-bars span { display: block; width: 100%; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 8px; vertical-align: middle; }
.team-table tr.row-hl td { background: var(--accent-soft); }
.quick-tasks { margin-top: 10px; display: grid; gap: 6px; }
.quick-tasks .chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Top-right: my task completion */
.task-pct { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; font-size: .82rem; white-space: nowrap; }
.task-pct + .me { margin-left: 10px; }
.task-pct b { font-size: .9rem; }
.task-pct .tp-txt { color: var(--muted); }
.task-pct .tp-late { color: #d92d20; font-weight: 700; }
.task-pct.none { padding-left: 10px; }
.tp-ring { --c: var(--accent); width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3, #e5e7eb) 0);
  -webkit-mask: radial-gradient(circle 6px, transparent 98%, #000 100%); mask: radial-gradient(circle 6px, transparent 98%, #000 100%); }
.task-pct.good .tp-ring { --c: #16a34a; } .task-pct.good b { color: #15803d; }
.task-pct.mid .tp-ring { --c: #f59e0b; } .task-pct.mid b { color: #b45309; }
.task-pct.low .tp-ring { --c: #d92d20; } .task-pct.low b { color: #b42318; }
@media (max-width: 520px) { .task-pct .tp-txt { display: none; } }
@media print { .task-pct { display: none; } }
.bill-locked { padding: 10px 12px; background: var(--surface-2); border-radius: 8px; border: 1px dashed var(--border-strong); }
.proof-flag.sent { background: #16a34a; }
.proof-panel { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border-left: 4px solid #d92d20; }
.proof-panel.done { border-left-color: #16a34a; }
.proof-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.batch-tools { display: flex; gap: 6px; } .batch-tools form { margin: 0; }
.approve-note { padding: 8px 10px; background: #fff7e0; border-radius: 8px; margin: 6px 0; }
.stock-short { background: #fff1f0; padding: 6px 8px; border-radius: 8px; font-weight: 700; }
.print-sel { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.code-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-all; font-size: .8rem; }
.setup-steps li { margin: 4px 0; line-height: 1.45; }
.setup-steps code.copy { display: inline-block; padding: 2px 6px; background: var(--surface-2); border-radius: 4px; word-break: break-all; user-select: all; }
.restore-dlg { border: 0; border-radius: var(--radius); padding: 18px; max-width: 420px; box-shadow: var(--shadow-lg); }
.restore-dlg::backdrop { background: rgba(0,0,0,.4); }
.zero-stock { margin: 0 0 12px; }
.stack { display: grid; gap: 10px; }
.stack .field.check { display: flex; gap: 8px; align-items: center; }

/* ---------- Tasks workspace: Notion-style pages ---------- */
.np-views { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 10px 0 4px; }
.np-views .filters { margin: 0; }
.task-card .tc-icon { font-weight: 400; }
.task-card .tc-prog { font-size: .76rem; color: var(--muted); }
.task-card.dragging { opacity: .45; }
.task-col.drop-on { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft); }
.np-table tbody tr { cursor: pointer; }
.np-table tbody tr:hover td { background: var(--surface-2); }
.np-cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.np-cal-head b { min-width: 130px; text-align: center; }
.np-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.np-cal-dn { font-size: .74rem; font-weight: 700; color: var(--muted); padding: 4px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.np-cal-day { min-height: 92px; padding: 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.np-cal-day.other { background: var(--surface-2); color: var(--muted); }
.np-cal-day.today .np-cal-n { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; }
.np-cal-n { font-size: .78rem; font-weight: 700; align-self: flex-start; }
.np-cal-task { font-size: .76rem; padding: 2px 6px; border-radius: 6px; background: var(--st-pending-bg); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-cal-task.st-doing { background: var(--st-printed-bg); } .np-cal-task.st-review { background: var(--st-packed-bg); }
.np-cal-task.st-done { background: var(--st-shipped-bg); text-decoration: line-through; color: var(--muted); }
.np-cal-task.late { box-shadow: inset 3px 0 0 #d92d20; }
@media (max-width: 640px) { .np-cal-day { min-height: 64px; } .np-cal-task { font-size: 0; padding: 0; height: 8px; } .np-cal-task::first-letter { font-size: 0; } }

.np { max-width: 900px; margin: 0 auto; }
.np-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 2px 0 8px; }
.np-crumb { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.np-save { font-size: .8rem; color: var(--muted); min-width: 70px; }
.np-save.error { color: var(--err); font-weight: 600; }
.np-save.saving, .np-save.dirty { color: var(--text-2); }
.np-top-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.np-more { position: relative; }
.np-more summary { list-style: none; } .np-more summary::-webkit-details-marker { display: none; }
.np-more .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; display: grid; }
.np-more .menu button, .np-more .menu form { width: 100%; }
.np-more .menu button { background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--text); }
.np-more .menu button:hover { background: var(--surface-2); }
.danger-text { color: var(--err) !important; }
.np-page { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 44px 36px 60px; box-shadow: var(--shadow); }
@media (max-width: 700px) { .np-page { padding: 18px 12px 24px 30px; border-radius: 12px; } }
.np-icon { font-size: 2.6rem; line-height: 1; background: none; border: 0; padding: 4px; border-radius: 10px; cursor: pointer; margin-left: -6px; }
.np-icon:hover:not(:disabled) { background: var(--surface-2); }
.np-icon:disabled { cursor: default; }
.np-title { font-size: 2rem; line-height: 1.2; margin: 6px 0 14px; outline: none; display: block; word-break: break-word; }
.np-title[contenteditable]:hover { background: var(--surface-2); border-radius: 6px; }
@media (max-width: 700px) { .np-title { font-size: 1.5rem; } }
.np-props { display: grid; gap: 2px; margin-bottom: 14px; }
.np-prop { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: center; min-height: 34px; gap: 8px; }
@media (max-width: 560px) { .np-prop { grid-template-columns: 112px minmax(0, 1fr); font-size: .9rem; } }
.np-pk { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-pv { display: flex; gap: 8px; align-items: center; min-width: 0; flex-wrap: wrap; }
.np-pv input:not([type=checkbox]), .np-pv select { border: 1px solid transparent; background: transparent; font: inherit; color: var(--text); padding: 4px 6px; border-radius: 6px; min-width: 0; max-width: 100%; }
.np-pv input:not([type=checkbox]) { flex: 1 1 200px; }
.np-pv input:hover, .np-pv select:hover { background: var(--surface-2); }
.np-pv input:focus, .np-pv select:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.np-pv .saving { opacity: .6; } .np-pv .saved { box-shadow: 0 0 0 2px #86efac; }
.np-pv .check { display: flex; gap: 6px; align-items: center; margin: 0; }
.np-status { border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin: 4px 0 18px; }
.np-status .approve-note { margin: 0 0 8px; }
.np-status-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.np-status-row > input { flex: 1 1 220px; min-width: 0; }
.np-status .status-btns { margin: 0; }
.np-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); padding: 10px 0 6px; min-height: 12px; }
.np-prog { width: 90px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: inline-block; }
.np-prog i { display: block; height: 100%; background: #16a34a; }

/* blocks */
.np-editor { padding: 4px 0 6px; }
.nb { position: relative; display: grid; grid-template-columns: 0 minmax(0, 1fr) auto; gap: 0 6px; padding-left: calc(var(--ind, 0) * 26px); border-radius: 6px; }
.nb-gutter { position: absolute; left: calc(var(--ind, 0) * 26px - 48px); top: 3px; display: flex; gap: 0; opacity: 0; transition: opacity .12s; }
.nb:hover .nb-gutter, .nb:focus-within .nb-gutter { opacity: 1; }
@media (hover: none) { .nb-gutter { opacity: .55; } }
.nb-gutter button { width: 22px; height: 24px; border: 0; background: none; color: var(--muted); border-radius: 5px; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.nb-gutter .nb-handle { cursor: grab; letter-spacing: -3px; font-size: 13px; }
.nb-gutter button:hover { background: var(--surface-3); color: var(--text); }
.nb-main { grid-column: 2; min-width: 0; }
.nb-line { display: flex; align-items: flex-start; gap: 8px; }
.nb-text { flex: 1; min-width: 0; outline: none; padding: 3px 2px; min-height: 1.5em; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.nb-text:empty::before { content: attr(data-ph); color: transparent; pointer-events: none; }
.nb-text:focus:empty::before, .t-h1 .nb-text:empty::before, .t-h2 .nb-text:empty::before, .t-h3 .nb-text:empty::before, .t-todo .nb-text:empty::before, .t-callout .nb-text:empty::before { color: #b3b9c5; }
.nb-text a { text-decoration: underline; cursor: pointer; }
.nb-text mark { background: #fff1a8; padding: 0 2px; border-radius: 3px; }
.nb-text code { color: #c2410c; }
.t-h1 .nb-text { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; padding-top: 18px; }
.t-h2 .nb-text { font-size: 1.35rem; font-weight: 750; letter-spacing: -.01em; line-height: 1.3; padding-top: 14px; }
.t-h3 .nb-text { font-size: 1.1rem; font-weight: 700; padding-top: 10px; }
.t-h1 .nb-gutter { top: 22px; } .t-h2 .nb-gutter { top: 17px; } .t-h3 .nb-gutter { top: 12px; }
.nb-bullet, .nb-num { flex: none; min-width: 18px; padding-top: 3px; line-height: 1.6; text-align: right; color: var(--text-2); }
.nb-bullet { font-size: 1.2em; line-height: 1.35; text-align: center; }
.nb-check { flex: none; width: 17px; height: 17px; margin: 6px 0 0; accent-color: var(--accent); cursor: pointer; }
.nb.is-checked .nb-text { text-decoration: line-through; color: var(--muted); }
.nb-tog { flex: none; border: 0; background: none; cursor: pointer; padding: 3px 2px; width: 22px; color: var(--text-2); transition: transform .12s; line-height: 1.6; }
.nb-tog[aria-expanded=true] { transform: rotate(90deg); }
.t-quote .nb-line { border-left: 3px solid var(--text); padding-left: 12px; }
.t-quote .nb-text { font-size: 1.05rem; }
.t-callout .nb-line { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.nb-emoji { border: 0; background: none; font-size: 1.2rem; cursor: pointer; padding: 0; line-height: 1.4; }
.nb-hr { flex: 1; border: 0; border-top: 1px solid var(--border-strong); margin: 14px 0; }
.t-divider .nb-line { min-height: 28px; }
.nb-image { margin: 6px 0 2px; display: grid; gap: 6px; }
.nb-image img { max-width: 100%; max-height: 520px; border-radius: 8px; cursor: zoom-in; display: block; }
.nb-image + .nb-line .nb-text { font-size: .86rem; color: var(--muted); }
.nb.c-gray .nb-text { color: #6b7280; } .nb.c-brown .nb-text { color: #8b5a2b; } .nb.c-orange .nb-text { color: #c2410c; } .nb.c-yellow .nb-text { color: #a16207; }
.nb.c-green .nb-text { color: #15803d; } .nb.c-blue .nb-text { color: #1d4ed8; } .nb.c-purple .nb-text { color: #7e22ce; } .nb.c-pink .nb-text { color: #be185d; } .nb.c-red .nb-text { color: #b91c1c; }
.nb.c-yellow { background: #fef9c3; } .nb.c-green { background: #ecfdf3; } .nb.c-blue { background: #eef4ff; } .nb.c-red { background: #fef2f2; } .nb.c-purple { background: #f6f0ff; } .nb.c-pink { background: #fdf2f8; } .nb.c-orange { background: #fff4ea; }
.nb-extras { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nb-extras:empty { display: none; }
.nb-extras { padding: 0 0 4px 2px; }
.nb-bullet ~ .nb-text, .nb-num ~ .nb-text {}
.nb-chipw { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); max-width: 100%; }
.nb-chip { font-size: .78rem; padding: 2px 4px 2px 10px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.nb-chip.conn { color: var(--st-packed); }
.nb-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 8px 0 4px; font-size: 14px; line-height: 1; }
.nb-x:hover { color: var(--err); }
.nb-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.nb-thumb { position: relative; }
.nb-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; display: block; }
.nb-thumb .nb-x { position: absolute; top: -6px; right: -6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; width: 20px; height: 20px; padding: 0; opacity: 0; }
.nb-thumb:hover .nb-x, .nb-chipw:hover .nb-x { opacity: 1; }
@media (hover: none) { .nb-thumb .nb-x { opacity: 1; } }
.nb-shot { font-size: .8rem; color: #7e22ce; background: #f6f0ff; border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.nb-side { grid-column: 3; display: flex; gap: 2px; align-items: flex-start; padding-top: 3px; }
.nb-side button { border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 6px; padding: 2px 6px; font-size: .8rem; line-height: 1.6; opacity: 0; }
.nb:hover .nb-side button, .nb:focus-within .nb-side button, .nb-side button.has, .nb.is-done .nb-done { opacity: 1; }
@media (hover: none) { .nb-side button { opacity: .6; } }
.nb-side button:hover { background: var(--surface-3); color: var(--text); }
.nb-cmt.has { color: var(--accent); font-weight: 600; }
.nb-done { font-weight: 800; }
.nb.is-done .nb-done { color: #fff; background: #16a34a; }
.nb.is-done { box-shadow: inset 3px 0 0 #86efac; }
.nb-sec { font-size: .74rem; color: var(--muted); padding: 3px 4px; white-space: nowrap; cursor: pointer; line-height: 1.6; }
.nb-sec.set { color: #7e22ce; font-weight: 600; }
.t-h1 .nb-side, .t-h2 .nb-side, .t-h3 .nb-side { padding-top: 16px; }
.nb.drop-before { box-shadow: 0 -2px 0 var(--accent); } .nb.drop-after { box-shadow: 0 2px 0 var(--accent); }
.nb.drop-file { outline: 2px dashed var(--accent); }
.nb.dragging { opacity: .4; }
.nb.commenting { background: #fff8db; }
.nb.flash { animation: npflash 1.6s; }
@keyframes npflash { 0%, 60% { background: #fff1a8; } 100% { background: transparent; } }
.np-add-end { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--muted); padding: 10px 2px; cursor: text; font: inherit; font-size: .9rem; border-radius: 6px; }
.np-add-end:hover { background: var(--surface-2); }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .8em; background: var(--surface); }

/* menus, toolbar, dialogs, comments panel */
.np-menu { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); width: 290px; max-height: 360px; overflow: auto; padding: 6px; }
.np-menu-h { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 8px 4px; }
.np-mi { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 6px 8px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); }
.np-mi.sel, .np-mi:hover { background: var(--surface-2); }
.np-mi-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: .95rem; font-weight: 700; }
.np-mi b { display: block; font-weight: 600; font-size: .88rem; } .np-mi small { color: var(--muted); font-size: .75rem; }
.np-menu-types { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 0 4px; }
.np-menu-types button { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; height: 34px; cursor: pointer; font-weight: 700; }
.np-menu-types button.on, .np-menu-types button:hover { border-color: var(--accent); background: var(--accent-soft); }
.np-menu-colors { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 6px 4px; }
.np-menu-colors .sw { width: 22px; height: 22px; border-radius: 999px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.np-menu-colors .sw.on { box-shadow: 0 0 0 2px var(--accent); }
.sw.none { background: var(--surface); } .sw.c-gray { background: #9ca3af; } .sw.c-brown { background: #a16207; } .sw.c-orange { background: #f97316; } .sw.c-yellow { background: #facc15; }
.sw.c-green { background: #22c55e; } .sw.c-blue { background: #3b82f6; } .sw.c-purple { background: #a855f7; } .sw.c-pink { background: #ec4899; } .sw.c-red { background: #ef4444; }
.np-fmt { position: absolute; z-index: 61; display: flex; gap: 2px; background: #1f2937; border-radius: 9px; padding: 4px; box-shadow: var(--shadow-lg); }
.np-fmt button { border: 0; background: none; color: #fff; min-width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.np-fmt button:hover { background: rgba(255,255,255,.14); }
.np-fmt mark { background: #fde047; color: #111; padding: 0 3px; border-radius: 3px; }
.np-dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
.np-dialog.wide { width: min(980px, calc(100vw - 32px)); }
.np-dialog::backdrop { background: rgba(15,23,42,.35); }
.np-dialog-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.np-dialog-b { padding: 14px; display: grid; gap: 10px; }
.np-dialog .field input { width: 100%; }
.np-find { width: 100%; }
.np-found { display: grid; max-height: 50vh; overflow: auto; }
.np-big { max-width: 100%; max-height: 75vh; display: block; margin: 0 auto; border-radius: 8px; }
.np-emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.np-emojis button { font-size: 1.4rem; border: 0; background: none; border-radius: 8px; cursor: pointer; padding: 4px; }
.np-emojis button:hover { background: var(--surface-2); }
.np-side { position: fixed; z-index: 55; right: 0; top: 0; bottom: 0; width: min(380px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; padding: 14px; padding-top: max(14px, env(safe-area-inset-top)); gap: 10px; }
.np-side-h { display: flex; justify-content: space-between; align-items: center; }
.np-side-q { margin: 0; padding: 6px 10px; border-left: 3px solid var(--border-strong); color: var(--text-2); font-size: .88rem; max-height: 90px; overflow: auto; }
.np-side-list { flex: 1; overflow: auto; margin: 0; }
.np-side-form { display: grid; gap: 8px; }
.np-toast { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--tabbar-h) + 16px); transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .88rem; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.np-activity { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 16px; }
.np-comment-form { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.np-comment-form textarea { width: 100%; }
@media print {
  .np-top, .np-status, .np-add-end, .np-activity, .nb-gutter, .nb-side, .np-fmt, .np-menu, .np-side { display: none !important; }
  .np-page { border: 0; box-shadow: none; padding: 0; }
  .nb-text:empty::before { content: none; }
}

/* ---------- work score ---------- */
.task-pct.score { padding-left: 10px; }
.task-pct.score b { color: var(--text); }
.score-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.score-big { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.score-rank { font-size: .95rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.score-rules { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 10px 0; }
.lb-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.lb-bar i { display: block; height: 100%; background: var(--accent); }
@media (max-width: 700px) { .nb-gutter { left: calc(var(--ind, 0) * 26px - 28px); } .nb-gutter .nb-add { display: none; } }
@media (max-width: 560px) { .np-comment-form { grid-template-columns: 1fr; } }

/* ---------- Light / dark theme ----------
   Light by default. Dark when picked (html[data-theme=dark]), or in Automatic mode when the device is dark.
   The Task Manager is dark unless Light is picked. Chosen in the account menu (cookie looma_theme). */
@keyframes npflash-dark { 0%, 60% { background: rgba(250,204,21,.18); } 100% { background: transparent; } }
:root[data-theme="dark"], :root[data-theme="dark"] body {
  color-scheme: dark;
  --bg: #0b0c0f; --surface: #15171b; --surface-2: #1c1f24; --surface-3: #262a31;
  --border: #262a31; --border-strong: #363b44;
  --text: #ececef; --text-2: #b9bdc6; --muted: #868b96;
  --brand: #5b7cf6; --brand-2: #4a6cf0; --accent: #7b9bff; --accent-soft: rgba(123,155,255,.14);
  --ok-bg: rgba(34,197,94,.14); --ok: #6ee7a0; --err-bg: rgba(239,68,68,.15); --err: #ff8a80; --warn-bg: rgba(245,158,11,.15); --warn: #fbbf5a;
  --st-pending: #fbbf5a; --st-pending-bg: rgba(245,158,11,.15);
  --st-printed: #8fb0ff; --st-printed-bg: rgba(91,140,255,.16);
  --st-packed: #c4a8ff; --st-packed-bg: rgba(167,139,250,.16);
  --st-shipped: #6ee7a0; --st-shipped-bg: rgba(34,197,94,.14);
  --st-plain: #c9c6bd; --st-plain-bg: rgba(201,198,189,.12);
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 14px 44px rgba(0,0,0,.6);
  --scrim: rgba(0,0,0,.55);
  background: var(--bg);
}
:root[data-theme="dark"] .task-card.is-late { background: rgba(239,68,68,.08); }
:root[data-theme="dark"] .task-card.prio-normal, :root[data-theme="dark"] .task-card.prio-low { border-left-color: var(--border-strong); }
:root[data-theme="dark"] .nb-text mark, :root[data-theme="dark"] .np-fmt mark { background: rgba(250,204,21,.32); color: inherit; }
:root[data-theme="dark"] .nb-text code { color: #ffb38a; background: var(--surface-3); }
:root[data-theme="dark"] .t-h1 .nb-text:empty::before, :root[data-theme="dark"] .t-h2 .nb-text:empty::before, :root[data-theme="dark"] .t-h3 .nb-text:empty::before, :root[data-theme="dark"] .t-todo .nb-text:empty::before, :root[data-theme="dark"] .t-callout .nb-text:empty::before, :root[data-theme="dark"] .nb-text:focus:empty::before { color: #50555f; }
:root[data-theme="dark"] .nb.c-yellow { background: rgba(250,204,21,.1); } :root[data-theme="dark"] .nb.c-green { background: rgba(34,197,94,.1); } :root[data-theme="dark"] .nb.c-blue { background: rgba(91,140,255,.12); }
:root[data-theme="dark"] .nb.c-red { background: rgba(239,68,68,.11); } :root[data-theme="dark"] .nb.c-purple { background: rgba(167,139,250,.12); } :root[data-theme="dark"] .nb.c-pink { background: rgba(236,72,153,.11); } :root[data-theme="dark"] .nb.c-orange { background: rgba(249,115,22,.11); }
:root[data-theme="dark"] .nb.c-gray .nb-text { color: #9ca3af; } :root[data-theme="dark"] .nb.c-brown .nb-text { color: #d6a46b; } :root[data-theme="dark"] .nb.c-orange .nb-text { color: #fdba74; } :root[data-theme="dark"] .nb.c-yellow .nb-text { color: #fde047; }
:root[data-theme="dark"] .nb.c-green .nb-text { color: #86efac; } :root[data-theme="dark"] .nb.c-blue .nb-text { color: #a5c0ff; } :root[data-theme="dark"] .nb.c-purple .nb-text { color: #d8b4fe; } :root[data-theme="dark"] .nb.c-pink .nb-text { color: #f9a8d4; } :root[data-theme="dark"] .nb.c-red .nb-text { color: #fca5a5; }
:root[data-theme="dark"] .nb-shot { background: rgba(167,139,250,.14); color: #d8b4fe; }
:root[data-theme="dark"] .nb-sec.set { color: #d8b4fe; }
:root[data-theme="dark"] .nb-chip.conn { color: #c4a8ff; }
:root[data-theme="dark"] .nb.commenting { background: rgba(250,204,21,.08); }
:root[data-theme="dark"] .nb.is-done { box-shadow: inset 3px 0 0 #22c55e; }
:root[data-theme="dark"] .t-quote .nb-line { border-left-color: var(--text-2); }
:root[data-theme="dark"] .np-fmt { background: #2b2f37; border: 1px solid var(--border-strong); }
:root[data-theme="dark"] .np-toast { background: #2b2f37; }
:root[data-theme="dark"] .np-cal-task.late { box-shadow: inset 3px 0 0 #ef4444; }
:root[data-theme="dark"] .np-mi-ic { background: var(--surface-2); }
:root[data-theme="dark"] .nb.flash { animation-name: npflash-dark; }
:root[data-theme="dark"] .badge.cod { color: #fbbf5a; background: rgba(245,158,11,.15); }
:root[data-theme="dark"] .task-result { background: rgba(34,197,94,.12); }
:root[data-theme="dark"] .approve-note { background: rgba(245,158,11,.12); }
:root[data-theme="dark"] .stock-short { background: rgba(239,68,68,.12); }
:root[data-theme="dark"] .up-x { background: var(--surface); color: var(--text); }
:root[data-theme="dark"] .seg-toggle input:checked + span, :root[data-theme="dark"] .seg-links a.on { box-shadow: 0 1px 3px rgba(0,0,0,.5); }
:root[data-theme="dark"] .alert.ok { background: var(--ok-bg); color: var(--ok); } :root[data-theme="dark"] .alert.err { background: var(--err-bg); color: var(--err); }
:root[data-theme="dark"] .wa-banner { background: rgba(37,211,102,.12); color: #7ee2a8; border-color: rgba(37,211,102,.3); } :root[data-theme="dark"] .wa-banner small { color: #9fd8b6; }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]), :root:not([data-theme="light"]) body {
  color-scheme: dark;
  --bg: #0b0c0f; --surface: #15171b; --surface-2: #1c1f24; --surface-3: #262a31;
  --border: #262a31; --border-strong: #363b44;
  --text: #ececef; --text-2: #b9bdc6; --muted: #868b96;
  --brand: #5b7cf6; --brand-2: #4a6cf0; --accent: #7b9bff; --accent-soft: rgba(123,155,255,.14);
  --ok-bg: rgba(34,197,94,.14); --ok: #6ee7a0; --err-bg: rgba(239,68,68,.15); --err: #ff8a80; --warn-bg: rgba(245,158,11,.15); --warn: #fbbf5a;
  --st-pending: #fbbf5a; --st-pending-bg: rgba(245,158,11,.15);
  --st-printed: #8fb0ff; --st-printed-bg: rgba(91,140,255,.16);
  --st-packed: #c4a8ff; --st-packed-bg: rgba(167,139,250,.16);
  --st-shipped: #6ee7a0; --st-shipped-bg: rgba(34,197,94,.14);
  --st-plain: #c9c6bd; --st-plain-bg: rgba(201,198,189,.12);
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 14px 44px rgba(0,0,0,.6);
  --scrim: rgba(0,0,0,.55);
  background: var(--bg);
}
:root:not([data-theme="light"]) .task-card.is-late { background: rgba(239,68,68,.08); }
:root:not([data-theme="light"]) .task-card.prio-normal, :root:not([data-theme="light"]) .task-card.prio-low { border-left-color: var(--border-strong); }
:root:not([data-theme="light"]) .nb-text mark, :root:not([data-theme="light"]) .np-fmt mark { background: rgba(250,204,21,.32); color: inherit; }
:root:not([data-theme="light"]) .nb-text code { color: #ffb38a; background: var(--surface-3); }
:root:not([data-theme="light"]) .t-h1 .nb-text:empty::before, :root:not([data-theme="light"]) .t-h2 .nb-text:empty::before, :root:not([data-theme="light"]) .t-h3 .nb-text:empty::before, :root:not([data-theme="light"]) .t-todo .nb-text:empty::before, :root:not([data-theme="light"]) .t-callout .nb-text:empty::before, :root:not([data-theme="light"]) .nb-text:focus:empty::before { color: #50555f; }
:root:not([data-theme="light"]) .nb.c-yellow { background: rgba(250,204,21,.1); } :root:not([data-theme="light"]) .nb.c-green { background: rgba(34,197,94,.1); } :root:not([data-theme="light"]) .nb.c-blue { background: rgba(91,140,255,.12); }
:root:not([data-theme="light"]) .nb.c-red { background: rgba(239,68,68,.11); } :root:not([data-theme="light"]) .nb.c-purple { background: rgba(167,139,250,.12); } :root:not([data-theme="light"]) .nb.c-pink { background: rgba(236,72,153,.11); } :root:not([data-theme="light"]) .nb.c-orange { background: rgba(249,115,22,.11); }
:root:not([data-theme="light"]) .nb.c-gray .nb-text { color: #9ca3af; } :root:not([data-theme="light"]) .nb.c-brown .nb-text { color: #d6a46b; } :root:not([data-theme="light"]) .nb.c-orange .nb-text { color: #fdba74; } :root:not([data-theme="light"]) .nb.c-yellow .nb-text { color: #fde047; }
:root:not([data-theme="light"]) .nb.c-green .nb-text { color: #86efac; } :root:not([data-theme="light"]) .nb.c-blue .nb-text { color: #a5c0ff; } :root:not([data-theme="light"]) .nb.c-purple .nb-text { color: #d8b4fe; } :root:not([data-theme="light"]) .nb.c-pink .nb-text { color: #f9a8d4; } :root:not([data-theme="light"]) .nb.c-red .nb-text { color: #fca5a5; }
:root:not([data-theme="light"]) .nb-shot { background: rgba(167,139,250,.14); color: #d8b4fe; }
:root:not([data-theme="light"]) .nb-sec.set { color: #d8b4fe; }
:root:not([data-theme="light"]) .nb-chip.conn { color: #c4a8ff; }
:root:not([data-theme="light"]) .nb.commenting { background: rgba(250,204,21,.08); }
:root:not([data-theme="light"]) .nb.is-done { box-shadow: inset 3px 0 0 #22c55e; }
:root:not([data-theme="light"]) .t-quote .nb-line { border-left-color: var(--text-2); }
:root:not([data-theme="light"]) .np-fmt { background: #2b2f37; border: 1px solid var(--border-strong); }
:root:not([data-theme="light"]) .np-toast { background: #2b2f37; }
:root:not([data-theme="light"]) .np-cal-task.late { box-shadow: inset 3px 0 0 #ef4444; }
:root:not([data-theme="light"]) .np-mi-ic { background: var(--surface-2); }
:root:not([data-theme="light"]) .nb.flash { animation-name: npflash-dark; }
:root:not([data-theme="light"]) .badge.cod { color: #fbbf5a; background: rgba(245,158,11,.15); }
:root:not([data-theme="light"]) .task-result { background: rgba(34,197,94,.12); }
:root:not([data-theme="light"]) .approve-note { background: rgba(245,158,11,.12); }
:root:not([data-theme="light"]) .stock-short { background: rgba(239,68,68,.12); }
:root:not([data-theme="light"]) .up-x { background: var(--surface); color: var(--text); }
:root:not([data-theme="light"]) .seg-toggle input:checked + span, :root:not([data-theme="light"]) .seg-links a.on { box-shadow: 0 1px 3px rgba(0,0,0,.5); }
:root:not([data-theme="light"]) .alert.ok { background: var(--ok-bg); color: var(--ok); } :root:not([data-theme="light"]) .alert.err { background: var(--err-bg); color: var(--err); }
:root:not([data-theme="light"]) .wa-banner { background: rgba(37,211,102,.12); color: #7ee2a8; border-color: rgba(37,211,102,.3); } :root:not([data-theme="light"]) .wa-banner small { color: #9fd8b6; }
}
:root:not([data-theme="light"]) body.tm {
  color-scheme: dark;
  --bg: #0b0c0f; --surface: #15171b; --surface-2: #1c1f24; --surface-3: #262a31;
  --border: #262a31; --border-strong: #363b44;
  --text: #ececef; --text-2: #b9bdc6; --muted: #868b96;
  --brand: #5b7cf6; --brand-2: #4a6cf0; --accent: #7b9bff; --accent-soft: rgba(123,155,255,.14);
  --ok-bg: rgba(34,197,94,.14); --ok: #6ee7a0; --err-bg: rgba(239,68,68,.15); --err: #ff8a80; --warn-bg: rgba(245,158,11,.15); --warn: #fbbf5a;
  --st-pending: #fbbf5a; --st-pending-bg: rgba(245,158,11,.15);
  --st-printed: #8fb0ff; --st-printed-bg: rgba(91,140,255,.16);
  --st-packed: #c4a8ff; --st-packed-bg: rgba(167,139,250,.16);
  --st-shipped: #6ee7a0; --st-shipped-bg: rgba(34,197,94,.14);
  --st-plain: #c9c6bd; --st-plain-bg: rgba(201,198,189,.12);
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 14px 44px rgba(0,0,0,.6);
  --scrim: rgba(0,0,0,.55);
  background: var(--bg);
}
:root:not([data-theme="light"]) body.tm .task-card.is-late { background: rgba(239,68,68,.08); }
:root:not([data-theme="light"]) body.tm .task-card.prio-normal, :root:not([data-theme="light"]) body.tm .task-card.prio-low { border-left-color: var(--border-strong); }
:root:not([data-theme="light"]) body.tm .nb-text mark, :root:not([data-theme="light"]) body.tm .np-fmt mark { background: rgba(250,204,21,.32); color: inherit; }
:root:not([data-theme="light"]) body.tm .nb-text code { color: #ffb38a; background: var(--surface-3); }
:root:not([data-theme="light"]) body.tm .t-h1 .nb-text:empty::before, :root:not([data-theme="light"]) body.tm .t-h2 .nb-text:empty::before, :root:not([data-theme="light"]) body.tm .t-h3 .nb-text:empty::before, :root:not([data-theme="light"]) body.tm .t-todo .nb-text:empty::before, :root:not([data-theme="light"]) body.tm .t-callout .nb-text:empty::before, :root:not([data-theme="light"]) body.tm .nb-text:focus:empty::before { color: #50555f; }
:root:not([data-theme="light"]) body.tm .nb.c-yellow { background: rgba(250,204,21,.1); } :root:not([data-theme="light"]) body.tm .nb.c-green { background: rgba(34,197,94,.1); } :root:not([data-theme="light"]) body.tm .nb.c-blue { background: rgba(91,140,255,.12); }
:root:not([data-theme="light"]) body.tm .nb.c-red { background: rgba(239,68,68,.11); } :root:not([data-theme="light"]) body.tm .nb.c-purple { background: rgba(167,139,250,.12); } :root:not([data-theme="light"]) body.tm .nb.c-pink { background: rgba(236,72,153,.11); } :root:not([data-theme="light"]) body.tm .nb.c-orange { background: rgba(249,115,22,.11); }
:root:not([data-theme="light"]) body.tm .nb.c-gray .nb-text { color: #9ca3af; } :root:not([data-theme="light"]) body.tm .nb.c-brown .nb-text { color: #d6a46b; } :root:not([data-theme="light"]) body.tm .nb.c-orange .nb-text { color: #fdba74; } :root:not([data-theme="light"]) body.tm .nb.c-yellow .nb-text { color: #fde047; }
:root:not([data-theme="light"]) body.tm .nb.c-green .nb-text { color: #86efac; } :root:not([data-theme="light"]) body.tm .nb.c-blue .nb-text { color: #a5c0ff; } :root:not([data-theme="light"]) body.tm .nb.c-purple .nb-text { color: #d8b4fe; } :root:not([data-theme="light"]) body.tm .nb.c-pink .nb-text { color: #f9a8d4; } :root:not([data-theme="light"]) body.tm .nb.c-red .nb-text { color: #fca5a5; }
:root:not([data-theme="light"]) body.tm .nb-shot { background: rgba(167,139,250,.14); color: #d8b4fe; }
:root:not([data-theme="light"]) body.tm .nb-sec.set { color: #d8b4fe; }
:root:not([data-theme="light"]) body.tm .nb-chip.conn { color: #c4a8ff; }
:root:not([data-theme="light"]) body.tm .nb.commenting { background: rgba(250,204,21,.08); }
:root:not([data-theme="light"]) body.tm .nb.is-done { box-shadow: inset 3px 0 0 #22c55e; }
:root:not([data-theme="light"]) body.tm .t-quote .nb-line { border-left-color: var(--text-2); }
:root:not([data-theme="light"]) body.tm .np-fmt { background: #2b2f37; border: 1px solid var(--border-strong); }
:root:not([data-theme="light"]) body.tm .np-toast { background: #2b2f37; }
:root:not([data-theme="light"]) body.tm .np-cal-task.late { box-shadow: inset 3px 0 0 #ef4444; }
:root:not([data-theme="light"]) body.tm .np-mi-ic { background: var(--surface-2); }
:root:not([data-theme="light"]) body.tm .nb.flash { animation-name: npflash-dark; }
:root:not([data-theme="light"]) body.tm .badge.cod { color: #fbbf5a; background: rgba(245,158,11,.15); }
:root:not([data-theme="light"]) body.tm .task-result { background: rgba(34,197,94,.12); }
:root:not([data-theme="light"]) body.tm .approve-note { background: rgba(245,158,11,.12); }
:root:not([data-theme="light"]) body.tm .stock-short { background: rgba(239,68,68,.12); }
:root:not([data-theme="light"]) body.tm .up-x { background: var(--surface); color: var(--text); }
:root:not([data-theme="light"]) body.tm .seg-toggle input:checked + span, :root:not([data-theme="light"]) body.tm .seg-links a.on { box-shadow: 0 1px 3px rgba(0,0,0,.5); }
:root:not([data-theme="light"]) body.tm .alert.ok { background: var(--ok-bg); color: var(--ok); } :root:not([data-theme="light"]) body.tm .alert.err { background: var(--err-bg); color: var(--err); }
:root:not([data-theme="light"]) body.tm .wa-banner { background: rgba(37,211,102,.12); color: #7ee2a8; border-color: rgba(37,211,102,.3); } :root:not([data-theme="light"]) body.tm .wa-banner small { color: #9fd8b6; }

/* ---------- Task Manager: its own app ---------- */
body.tm { --tabbar-h: 0px; }
body.tm .wrap { padding-bottom: 48px; }
body.tm .page-head h1 { font-size: 1.7rem; }
.tm-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid transparent; color: var(--text); }
.tm-brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex: none; }
.tm-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; color: #0b0c0f; background: linear-gradient(135deg, #ffffff, #9fb4ff); }
.tm-brand-text { display: grid; line-height: 1.1; }
.tm-brand-text b { font-size: 1rem; letter-spacing: -.01em; }
.tm-brand-text small { color: var(--muted); font-size: .7rem; }
.tm-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tm-nav::-webkit-scrollbar { display: none; }
.tm-nav a { color: var(--text-2); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: .88rem; white-space: nowrap; }
.tm-nav a:hover { background: var(--surface-2); color: var(--text); }
.tm-nav a.on { background: var(--surface-3); color: var(--text); }
.tm-bar .task-pct { margin-left: auto; border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.tm-switch { font-size: .82rem; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 11px; white-space: nowrap; }
.tm-switch:hover { color: var(--text); background: var(--surface-2); }
.tm-bar .me { margin-left: 0; }
@media (max-width: 760px) {
  .tm-bar { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
  .tm-brand-text small, .tm-bar .me-name, .tm-switch { display: none; }
  .tm-nav { order: 5; flex: 1 0 100%; }
}
@media print { :root, body, body.tm { --bg: #fff; --surface: #fff; --text: #111; --text-2: #333; --muted: #666; --border: #ddd; color-scheme: light; } .tm-bar { display: none; } }
.task-pct-gap { margin-left: auto; }
.also-to summary { cursor: pointer; padding: 2px 0; }
.also-to .chips { margin-top: 8px; }
.also-to .chip { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.also-to .chip input { width: 16px; height: 16px; }
.pt-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pt-row.is-late { box-shadow: inset 3px 0 0 #ef4444; padding-left: 10px; }
.pt-main { flex: 1 1 260px; min-width: 0; display: grid; gap: 4px; color: var(--text); }
.pt-act { display: flex; gap: 6px; align-items: center; }
.pt-done { list-style: none; margin: 0; padding: 0; display: grid; }
.pt-done li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.brand-logo { width: 36px; height: 36px; border-radius: 50%; display: block; flex: none; }
.tm-logo { width: 34px; height: 34px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.auth-logo { width: 72px; height: 72px; margin: 0 auto 14px; }

/* ---------- Fluid feel (Apple-style): instant press feedback, springy release, materials, anchored menus ----------
   Press = 90ms in; release = a critically damped spring-like curve back. Only transform / opacity move. */
:root { --spring: cubic-bezier(.22, 1, .36, 1); --spring-bounce: cubic-bezier(.34, 1.36, .64, 1); --scrim: rgba(17, 22, 33, .32); }
html { font-optical-sizing: auto; text-rendering: optimizeLegibility; }
a, button, summary, label, .btn, .chip, [role=button] { touch-action: manipulation; }
h1 { letter-spacing: -.025em; line-height: 1.12; }
h2 { letter-spacing: -.012em; line-height: 1.25; }
small, .small { letter-spacing: .005em; }
.btn, .icon-btn, .chip, .nav a, .nav-more > summary, .tabbar > a, .tab-more > summary, .seg-links a, .task-card, .card, .stat,
.design-tile, .menu a, .menu button, .sheet a, .sheet button, .np-mi, .door, .tm-nav a, .role-btn, .pt-row .btn {
  transition: transform 420ms var(--spring-bounce), background-color .18s, border-color .18s, color .18s, box-shadow .18s, opacity .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active, .icon-btn:active, .chip:active, .nav a:active, .nav-more > summary:active, .seg-links a:active, .tm-nav a:active,
.menu a:active, .menu button:active, .sheet a:active, .sheet button:active, .np-mi:active { transform: scale(.96); transition-duration: 90ms; transition-timing-function: ease-out; }
.task-card:active, .card:active, .stat:active, .design-tile:active, .door:active { transform: scale(.985); transition-duration: 90ms; transition-timing-function: ease-out; }
.tabbar > a:active .ico, .tab-more > summary:active .ico { transform: scale(.86); }
.tabbar .ico { transition: transform 420ms var(--spring-bounce); }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Translucent chrome: content scrolls under the bars; a hairline appears only once something is under them. */
.topbar, .tm-bar { background: color-mix(in srgb, var(--surface) 72%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: transparent; transition: border-color .2s, box-shadow .2s; }
.tm-bar { background: color-mix(in srgb, var(--bg) 72%, transparent); }
.topbar.scrolled, .tm-bar.scrolled { border-bottom-color: var(--border); box-shadow: 0 6px 24px -18px rgba(0, 0, 0, .35); }
.tabbar { background: color-mix(in srgb, var(--surface) 72%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }

/* Menus and sheets come out of the button that opened them, as a material (scale + blur + fade together). */
@keyframes materialize { from { opacity: 0; transform: scale(.94); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes sheet-up { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
details[open] > .menu { animation: materialize 260ms var(--spring) both; transform-origin: top right; }
.nav-more[open] > .menu { transform-origin: top left; }
.np-more[open] > .menu { transform-origin: top right; }
.menu, .sheet { background: color-mix(in srgb, var(--surface) 95%, transparent); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); }
.tab-more[open] > .sheet { animation: sheet-up 340ms var(--spring) both; transform-origin: bottom center; touch-action: none; will-change: transform; }
body.sheet-open::after { content: ""; position: fixed; inset: 0; z-index: 35; background: var(--scrim); animation: fade-in .25s ease both; }
.sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 2px auto 8px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Dialogs: dim to focus, the panel arrives as a material. */
dialog[open] { animation: materialize 300ms var(--spring) both; }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in .25s ease both; }

/* Messages slide in from where they live (top of the page). */
.alert { animation: alert-in 420ms var(--spring) both; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Comments panel (Task Manager) slides in from the right and leaves to the right. */
.np-side { transform: translateX(104%); transition: transform 380ms var(--spring); }
.np-side.in { transform: none; }

/* Theme switch: ease the change instead of a brightness jump. */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .32s ease, color .32s ease, border-color .32s ease, box-shadow .32s ease !important; }

/* Appearance picker (account menu / More sheet). */
.theme-pick { display: grid; gap: 6px; padding: 8px 10px 10px; }
.theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.theme-seg button { justify-content: center; white-space: nowrap; padding: 7px 2px !important; border-radius: 8px !important; font-size: .76rem !important; font-weight: 600; color: var(--text-2) !important; gap: 4px !important; }
.theme-seg button[aria-pressed="true"] { background: var(--surface) !important; color: var(--text) !important; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }

/* Accessibility: gentler motion, solid materials, stronger edges. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .btn:active, .icon-btn:active, .chip:active, .task-card:active, .card:active, .stat:active, .door:active, .nav a:active, .menu a:active, .sheet a:active { transform: none; }
  .np-side { transition: opacity .2s ease; transform: none; opacity: 0; } .np-side.in { opacity: 1; }
  details[open] > .menu, .tab-more[open] > .sheet, dialog[open], .alert { animation: fade-in .15s ease both !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tm-bar, .tabbar, .menu, .sheet { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .topbar, .tm-bar, .tabbar, .menu, .sheet { background: var(--surface); border-color: var(--border-strong); }
  .btn, .card, .stat, .task-card, input, select, textarea { border-color: var(--text-2); }
}
/* Segmented tabs never widen the page on a phone: they scroll within themselves. */
.seg-links { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-links::-webkit-scrollbar { display: none; }
.att-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 10px; background: var(--surface-2); }
.att-fields { margin-top: 4px; }
