/* =====================================================
   Tailor Shop PWA — Light theme, mobile-first
   ===================================================== */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --ink: #15172e;
  --ink-2: #474c69;
  --muted: #8b90aa;
  --line: #e8e9f2;
  --line-2: #f0f1f7;

  --primary: #4338ca;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --primary-ink: #3730a3;

  --accent: #f59e0b;
  --success: #059669;  --success-soft: #e6f7f0;
  --warn: #c2700a;     --warn-soft: #fff3df;
  --danger: #e11d48;   --danger-soft: #ffe8ed;
  --info: #0277b6;     --info-soft: #e5f3fc;

  --r-lg: 20px;
  --r: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(21, 23, 46, .04), 0 8px 24px -12px rgba(21, 23, 46, .14);
  --shadow-lg: 0 12px 40px -12px rgba(67, 56, 202, .35);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-1 { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.hide { display: none !important; }
.t-success { color: var(--success); } .t-danger { color: var(--danger); } .t-warn { color: var(--warn); } .t-primary { color: var(--primary); }

/* ---------- App frame ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}
@media (min-width: 600px) {
  body { background: #e9ebf5; }
  .app { box-shadow: 0 0 0 1px var(--line), 0 30px 80px -40px rgba(21,23,46,.35); }
}

.content {
  padding: 8px 16px calc(var(--nav-h) + var(--safe-bottom) + 28px);
}
body.no-nav .content { padding-bottom: calc(110px + var(--safe-bottom)); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-top)) 12px 10px 16px;
  background: rgba(244, 245, 251, .86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.topbar .icon-btn[data-back] { margin-left: -6px; }
.tb-title { flex: 1; min-width: 0; }
.tb-title h1 { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.tb-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); cursor: pointer; flex: none;
}
.icon-btn:active { transform: scale(.96); }
.icon-btn.plain { background: transparent; border-color: transparent; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; z-index: 40;
  left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 560px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 6px 10px var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 6px 0;
}
.nav-item .ic { width: 23px; height: 23px; }
.nav-item.active { color: var(--primary); }
.nav-item.active .ic { stroke-width: 2.2; }
.nav-fab {
  justify-self: center;
  width: 56px; height: 56px; margin-top: -26px;
  border-radius: 18px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--primary-2), var(--primary));
  box-shadow: var(--shadow-lg), 0 0 0 5px var(--bg);
}
.nav-fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }
.nav-fab:active { transform: scale(.95); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .ic { color: var(--primary); }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 2px 10px;
}
.section-head h2 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.section-head h2 .count {
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); padding: 2px 8px; border-radius: 99px;
}
.section-head a { font-size: 13px; font-weight: 700; color: var(--primary); }

/* ---------- Hero (dashboard) ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 20px;
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.18) 0%, transparent 45%),
    linear-gradient(150deg, #5b5ff2 0%, #4338ca 55%, #3a2fb0 100%);
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ''; position: absolute; right: -40px; bottom: -60px;
  width: 190px; height: 190px; border-radius: 50%;
  border: 26px solid rgba(255,255,255,.07);
}
.hero .h-label { font-size: 13px; opacity: .85; font-weight: 600; }
.hero .h-amount { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.hero .h-row { display: flex; gap: 10px; margin-top: 16px; position: relative; z-index: 1; }
.hero .h-pill {
  flex: 1; background: rgba(255,255,255,.14); border-radius: 14px; padding: 10px 12px;
  backdrop-filter: blur(4px);
}
.hero .h-pill small { display: block; font-size: 11.5px; opacity: .85; }
.hero .h-pill b { font-size: 16px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--surface); border-radius: var(--r); padding: 14px;
  box-shadow: var(--shadow); display: block;
}
.stat .s-ic {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 10px;
}
.stat .s-ic .ic { width: 19px; height: 19px; }
.stat .s-val { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.stat .s-lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tone-primary .s-ic { background: var(--primary-soft); color: var(--primary); }
.tone-success .s-ic { background: var(--success-soft); color: var(--success); }
.tone-warn .s-ic { background: var(--warn-soft); color: var(--warn); }
.tone-danger .s-ic { background: var(--danger-soft); color: var(--danger); }
.tone-info .s-ic { background: var(--info-soft); color: var(--info); }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700; color: var(--ink-2); text-align: center;
}
.quick .q-ic {
  width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); color: var(--primary);
}
.quick .q-ic .ic { width: 23px; height: 23px; }

/* ---------- List items ---------- */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.li {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-bottom: 1px solid var(--line-2);
  position: relative;
}
.li:last-child { border-bottom: 0; }
a.li:active, .li.tap:active { background: var(--surface-2); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-end { text-align: right; flex: none; }
.li-end .amt { font-weight: 800; font-size: 15px; }
.li .chev { color: #c3c6d8; width: 18px; height: 18px; }

/* Order card */
.ocard {
  display: block; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px;
}
.ocard:active { transform: scale(.995); }
.ocard .o-top { display: flex; align-items: center; gap: 10px; }
.ocard .o-no { font-size: 12px; font-weight: 700; color: var(--muted); }
.ocard .o-items { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--line); }
.ocard .o-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.ocard .o-amt small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.ocard .o-amt b { font-size: 15px; }
.ocard.danger { box-shadow: inset 3px 0 0 var(--danger), var(--shadow); }
.ocard.warn { box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }

/* ---------- Avatar ---------- */
.avatar {
  --h: 240;
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14.5px;
  color: hsl(var(--h), 55%, 34%);
  background: hsl(var(--h), 80%, 94%);
}
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 12.5px; }
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  white-space: nowrap;
}
.b-muted { background: #eef0f5; color: #5f6480; }
.b-success { background: var(--success-soft); color: var(--success); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-primary { background: var(--primary-soft); color: var(--primary); }

.day-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 9px;
  white-space: nowrap;
}
.day-chip .ic { width: 14px; height: 14px; }
.c-muted { background: #eef0f5; color: #5f6480; }
.c-info { background: var(--info-soft); color: var(--info); }
.c-warn { background: var(--warn-soft); color: var(--warn); }
.c-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tabs / segmented ---------- */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 4px -16px 12px; padding: 2px 16px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 8px 14px; border-radius: 99px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .n { opacity: .7; margin-left: 3px; }

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: #e9ebf4; padding: 4px; border-radius: 14px; margin-bottom: 14px;
}
.seg a, .seg button, .seg label {
  text-align: center; padding: 9px 6px; border-radius: 10px; border: 0; background: transparent;
  font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.seg .active, .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(21,23,46,.1); }

/* ---------- Search ---------- */
.search {
  position: relative; margin-bottom: 12px;
}
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; height: 48px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 0 14px 0 44px; font-size: 15px; outline: none;
  box-shadow: var(--shadow);
}
.search input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(99,102,241,.14); }

/* ---------- Forms ---------- */
.form-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.form-card > h3 { font-size: 14px; font-weight: 800; color: var(--ink-2); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.form-card > h3 .ic { color: var(--primary); width: 18px; height: 18px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .lbl { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .field input[type=text], .field input[type=tel], .field input[type=number], .field input[type=date],
.field input[type=password], .field input[type=search], .field select, .field textarea {
  width: 100%; height: 48px; border-radius: 13px;
  border: 1.5px solid var(--line); background: var(--surface-2);
  padding: 0 14px; font-size: 15.5px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.field textarea { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b90aa' stroke-width='2.2' stroke-linecap='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;
  padding-right: 38px;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary-2); background: #fff; box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.field input[type=date] { min-width: 0; display: block; max-width: 100%; font-size: 15px; }
.field input[type=date]::-webkit-date-and-time-value { text-align: left; }
.row2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.row3 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.mb-12 { margin-bottom: 12px; }
.input-pre { position: relative; }
.input-pre > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.input-pre input { padding-left: 30px !important; }

/* Chip radios */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 700;
  background: var(--surface-2); border: 1.5px solid var(--line); color: var(--ink-2); cursor: pointer;
}
.chip input:checked + span { background: var(--primary-soft); border-color: var(--primary-2); color: var(--primary-ink); }

/* Toggle switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch input { display: none; }
.switch .track { width: 46px; height: 28px; border-radius: 99px; background: #d9dbe7; position: relative; transition: background .2s; flex: none; }
.switch .track::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,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--primary-2); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border-radius: 14px; border: 0;
  font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line);
  transition: transform .08s;
}
.btn:active { transform: scale(.98); }
.btn .ic { width: 19px; height: 19px; }
.btn-primary { background: linear-gradient(140deg, var(--primary-2), var(--primary)); color: #fff; border: 0; box-shadow: 0 8px 20px -8px rgba(67,56,202,.55); }
.btn-soft { background: var(--primary-soft); color: var(--primary-ink); border: 0; }
.btn-success { background: var(--success); color: #fff; border: 0; }
.btn-wa { background: #1faa59; color: #fff; border: 0; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }

/* Sticky footer for forms */
.form-footer {
  position: fixed; z-index: 35; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(255,255,255,.95); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center;
}
.form-footer .ff-sum { flex: 1; min-width: 0; }
.form-footer .ff-sum small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.form-footer .ff-sum b { font-size: 19px; font-weight: 800; }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 100; top: calc(10px + var(--safe-top)); left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 528px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.35); margin-bottom: 8px;
  animation: toastIn .35s cubic-bezier(.2,.9,.3,1.2), toastOut .4s ease 3.2s forwards;
}
.toast .ic { color: #6ee7b7; }
.toast-error .ic { color: #fda4af; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 40px 20px; }
.empty-ic { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-ic .ic { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; font-weight: 800; }
.empty p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.empty .btn { margin-top: 16px; }

/* ---------- Profile header ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.profile h2 { font-size: 19px; font-weight: 800; }
.profile .p-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.contact-row { display: flex; gap: 8px; margin-top: 14px; }
.contact-row .btn { flex: 1; height: 42px; font-size: 13.5px; }

.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.money-row > div { background: var(--surface-2); border-radius: 12px; padding: 10px; text-align: center; }
.money-row small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.money-row b { font-size: 15px; }

/* ---------- Measurements ---------- */
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mcell { background: var(--surface-2); border-radius: 12px; padding: 9px 10px; border: 1px solid var(--line-2); }
.mcell small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcell b { font-size: 16px; font-weight: 800; }
.mcell b i { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.mform { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mform .mf { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 13px; padding: 7px 12px 6px; transition: border-color .15s, background .15s; }
.mform .mf:focus-within { border-color: var(--primary-2); background: #fff; box-shadow: 0 0 0 4px rgba(99,102,241,.12); }
.mform .mf label { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.mform .mf input { width: 100%; border: 0; background: transparent; outline: none; font-size: 19px; font-weight: 800; padding: 2px 0 0; }
.mform .mf .prev { font-size: 11px; color: var(--muted); }

.gt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gt-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }

details.history { margin-top: 10px; }
details.history summary { list-style: none; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 6px; }
details.history summary::-webkit-details-marker { display: none; }
details.history summary .ic { width: 16px; height: 16px; }
.hist-item { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }

/* ---------- Status stepper ---------- */
.stepper { display: flex; align-items: flex-start; margin: 4px 0 2px; }
.step { flex: 1; text-align: center; position: relative; font-size: 11px; font-weight: 700; color: var(--muted); }
.step::before { content: ''; position: absolute; top: 13px; left: -50%; right: 50%; height: 3px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; background: var(--surface); border: 2.5px solid var(--line); position: relative; z-index: 1; }
.step .dot .ic { width: 14px; height: 14px; stroke-width: 3; }
.step.done { color: var(--ink); }
.step.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.done::before { background: var(--primary); }
.step.current .dot { border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.step.current { color: var(--primary); }

/* ---------- Key-value / bill ---------- */
.kv { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--line-2); }
.kv span { color: var(--ink-2); }
.kv b { font-weight: 700; }
.kv.total { font-size: 16px; }
.kv.total b { font-size: 18px; font-weight: 800; }

/* Item rows (order form) */
.item-row { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 10px; position: relative; }
.item-row .ir-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.item-row .ir-head b { font-size: 13px; color: var(--muted); }
.item-row .field { margin-bottom: 10px; }
.item-row .field input, .item-row .field select { background: #fff; height: 44px; }
.item-row .kar-box { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; }
.item-row .ir-amt { font-weight: 800; }

/* ---------- Autocomplete ---------- */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
  background: #fff; border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(21,23,46,.3); border: 1px solid var(--line);
  max-height: 300px; overflow-y: auto;
}
.ac-list .li { cursor: pointer; }
.picked { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--primary-soft); }
.picked .li-title { color: var(--primary-ink); }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(21,23,46,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 61; left: 50%; bottom: 0;
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  transform: translate(-50%, 105%); transition: transform .3s cubic-bezier(.2,.9,.3,1), visibility 0s linear .3s;
  background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(18px + var(--safe-bottom));
  visibility: hidden;
}
.sheet.show { transform: translate(-50%, 0); visibility: visible; transition: transform .3s cubic-bezier(.2,.9,.3,1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: #d9dbe7; margin: 0 auto 12px; }
.sheet h3 { font-size: 18px; font-weight: 800; margin-bottom: 14px; }

/* ---------- Banners ---------- */
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: 16px; margin-bottom: 12px;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.banner .b-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.banner .b-txt { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.banner .b-txt b { display: block; color: var(--ink); font-size: 14px; }
.banner.primary .b-ic { background: var(--primary-soft); color: var(--primary); }
.banner.warn { background: #fffaf0; border-color: #fde7b8; }
.banner.warn .b-ic { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: #fff6f8; border-color: #ffd0da; }
.banner.danger .b-ic { background: var(--danger-soft); color: var(--danger); }

/* iOS install guide */
.ios-steps { counter-reset: s; margin: 0; padding: 0; list-style: none; }
.ios-steps li { counter-increment: s; display: flex; gap: 12px; align-items: center; padding: 10px 0; font-size: 14px; }
.ios-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; flex: none; }

/* ---------- Menu (more page) ---------- */
.menu .li .m-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }

/* ---------- Table (finance) ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 6px; border-bottom: 1px solid var(--line-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }

.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.filter-bar .search { flex: 1; margin: 0; }
.date-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px; }
.date-strip::-webkit-scrollbar { display: none; }

.progress { height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--success), #34d399); border-radius: 9px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(24px + var(--safe-bottom)); max-width: 440px; margin: 0 auto; }
.login-logo { width: 76px; height: 76px; border-radius: 24px; margin-bottom: 18px; box-shadow: var(--shadow-lg); }
.login-wrap h1 { font-size: 26px; font-weight: 800; }
.login-wrap .sub { color: var(--muted); margin: 6px 0 26px; }

.load-more { display: block; text-align: center; padding: 14px; font-weight: 700; color: var(--primary); }

/* ---------- Print (receipt) ---------- */
@media print {
  body { background: #fff; }
  .topbar, .bottom-nav, .no-print, .form-footer { display: none !important; }
  .app { box-shadow: none; max-width: none; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

@media (max-width: 360px) {
  .mgrid { grid-template-columns: repeat(2, 1fr); }
  .hero .h-amount { font-size: 28px; }
  .quick .q-ic { width: 46px; height: 46px; }
}

/* =====================================================
   v1.1 — Photos, lightbox, rent
   ===================================================== */
.avatar.has-img { padding: 0; overflow: hidden; background: #eef0f5; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photos { margin-top: 4px; }
.ph-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ph-head span { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink-2); }
.ph-head span .ic { width: 18px; height: 18px; color: var(--primary); }
.ph-head small { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 99px; }
.ph-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.photos.compact .ph-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ph, .ph-add {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  border: 0; padding: 0; margin: 0; cursor: pointer; background: var(--surface-2);
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph:active { transform: scale(.97); }
.ph.uploading::after {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.55)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234338ca' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E") center / 28px no-repeat;
}
.ph.failed { outline: 2px solid var(--danger); }
.ph-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1.5px dashed #c9cce0; color: var(--primary); font-size: 11.5px; font-weight: 700;
  background: var(--primary-soft);
}
.ph-add .ic { width: 22px; height: 22px; }
.ph-add:active { transform: scale(.97); }

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 11, 24, .96);
  display: flex; align-items: center; justify-content: center;
  padding: calc(60px + var(--safe-top)) 0 calc(30px + var(--safe-bottom));
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: calc(12px + var(--safe-top)) 14px 12px; color: #fff; }
.lb-top span { flex: 1; font-weight: 700; font-size: 14px; opacity: .8; }
.lb-btn, .lb-nav { width: 42px; height: 42px; border-radius: 13px; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.lb-btn.danger { color: #fda4af; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.lb-nav[disabled] { opacity: .25; }

/* Rent */
.rcard { display: block; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
.rcard .r-top { display: flex; gap: 12px; align-items: center; }
.rcard .r-thumb { width: 54px; height: 54px; border-radius: 14px; overflow: hidden; flex: none; background: #f1edff; color: #6d28d9; display: grid; place-items: center; }
.rcard .r-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rcard .r-thumb .ic { width: 24px; height: 24px; }
.rcard .r-dates { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.rcard .r-dates .arrow { color: var(--muted); font-weight: 700; }
.rcard.danger { box-shadow: inset 3px 0 0 var(--danger), var(--shadow); }
.rcard.warn { box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.stock-pill { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.settle { background: var(--surface-2); border-radius: 14px; padding: 4px 12px; margin: 10px 0; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 14px; font-weight: 600; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.warn-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; margin-top: 8px; }
.warn-box .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stats.three .stat .s-val { font-size: 17px; }
.contact-row.three .btn { font-size: 13px; padding: 0 8px; }

/* v1.2 — item extras */
.extras-box { background: #fff; border: 1px dashed var(--line); border-radius: 13px; padding: 10px; margin-bottom: 10px; }
.extras-box .lbl { margin-bottom: 8px; }
.extra-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 30px; gap: 6px; align-items: center; margin-bottom: 8px; }
.extra-row input { width: 100%; height: 42px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface-2); padding: 0 12px; font-size: 15px; outline: none; }
.extra-row .input-pre input { padding-left: 28px; }
.extra-row input:focus { border-color: var(--primary-2); background: #fff; }
.extra-row .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.add-extra { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border-radius: 11px; border: 0; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.add-extra .ic { width: 17px; height: 17px; }
.add-extra span { font-weight: 600; color: var(--muted); font-size: 12px; }
.ex-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); padding: 3px 0 3px 48px; }
.ex-line b { font-weight: 700; }
