:root {
  --bg: #f8fafc;
  --fg: #0f172a;
  --muted: #f1f5f9;
  --muted-fg: #64748b;
  --card: #ffffff;
  --border: #e2e8f0;
  --primary: #1248c7;
  --primary-fg: #ffffff;
  --primary-soft: rgba(18, 72, 199, 0.1);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #ca8a04;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sidebar: 224px;
  --topbar: 56px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.auth-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #f8fafc, #e2e8f0);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  padding: 32px 28px;
}
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.auth-logo img {
  display: block;
  width: 168px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.auth-logo h1 { margin: 0; font-size: 22px; }
.auth-logo p { margin: 0; color: var(--muted-fg); font-size: 13px; }

.app {
  min-height: 100%;
  height: 100%;
  display: flex;
}
.sidebar {
  width: var(--sidebar);
  background: #fcfdff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 84px;
  object-fit: contain;
}
.sidebar nav {
  padding: 10px;
  overflow: auto;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted-fg);
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link .nav-label { flex: 1; min-width: 0; }
.nav-count {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.nav-count.is-zero {
  background: var(--muted);
  color: var(--muted-fg);
}
.nav-group { margin-bottom: 2px; }
.nav-group > summary {
  list-style: none;
  cursor: pointer;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group .nav-caret {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--muted-fg);
  transition: transform 0.15s ease;
}
.nav-group[open] > summary .nav-caret { transform: rotate(180deg); }
.nav-sublink {
  padding-left: 36px;
  font-size: 13px;
}
.nav-link:hover { background: var(--muted); color: var(--fg); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link.active .nav-count { background: var(--primary); color: var(--primary-fg); }
.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted-fg);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.topbar {
  height: var(--topbar);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.search-box {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  height: 36px;
}
.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font: inherit;
}
.branch-select, select, input, textarea {
  font: inherit;
  color: inherit;
}
.branch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 36px;
  padding: 0 8px;
  background: #fff;
}
.branch-wrap select { border: 0; outline: 0; background: transparent; min-width: 160px; }
.user-menu {
  position: relative;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 36px;
  padding: 0 8px 0 6px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.user-chip:hover,
.user-menu.is-open .user-chip {
  background: var(--muted);
  text-decoration: none;
}
.user-chip-caret {
  width: 14px;
  height: 14px;
  color: var(--muted-fg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.user-menu.is-open .user-chip-caret {
  transform: rotate(180deg);
}
.user-menu-panel {
  display: none;
  position: fixed;
  z-index: 90;
  min-width: 220px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
.user-menu.is-open .user-menu-panel { display: block; }
.user-menu-panel a {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.user-menu-panel a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted-fg);
}
.user-menu-panel a:hover {
  background: var(--muted);
  text-decoration: none;
}
.user-menu-panel a.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.user-menu-panel a.active svg { color: var(--primary); }
.user-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.user-chip .meta { line-height: 1.15; }
.user-chip .meta small { color: var(--muted-fg); font-size: 11px; }
.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted-fg);
}
.icon-btn:hover { background: var(--muted); color: var(--fg); }

.content { padding: 24px; flex: 1; }
.content-flush {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.content-flush .alert { margin: 12px 16px 0; }
.page-head { margin-bottom: 18px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.page-head p { margin: 4px 0 0; color: var(--muted-fg); }
.page-head .inline { flex-wrap: wrap; justify-content: flex-end; }
.page-head .inline .btn { white-space: nowrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-h { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 650; }
.card-b { padding: 16px; }

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat .label { color: var(--muted-fg); font-size: 12px; }
.stat .value { font-size: 18px; font-weight: 700; }
a.stat-link { color: inherit; text-decoration: none; }
a.stat-link:hover { text-decoration: none; border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-outline { background: #fff; color: var(--fg); border-color: var(--border); }
.btn-danger { background: var(--danger); }
.btn-whatsapp { background: #16a34a; color: #fff; }
.btn-sm { height: 30px; font-size: 13px; padding: 0 10px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.help { color: var(--muted-fg); font-size: 12px; }
.error { color: var(--danger); font-size: 12px; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: end;
}
.filters .field { margin: 0; min-width: 160px; }
.filters .multi-select { width: 190px; }
.multi-select { position: relative; }
.multi-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-height: 38px;
}
.multi-select-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.multi-select-caret {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted-fg);
}
.multi-select.is-open .multi-select-btn {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.multi-select.is-open .multi-select-caret { transform: rotate(180deg); }
.multi-select-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(280px, 80vw);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  padding: 6px;
}
.multi-select-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.multi-select-opt:hover { background: var(--muted); }
.multi-select .multi-select-opt input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.multi-select-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.filters .field-grow { flex: 1 1 240px; min-width: 220px; }
.filters.repair-filters {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.repair-search {
  width: 100%;
  min-width: 0;
  margin: 0;
}
.repair-search input {
  height: 52px;
  padding: 0 16px 0 46px;
  font-size: 16px;
  border-radius: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%231248c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='M14 14l4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px 50%;
  background-size: 18px;
}
.repair-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.repair-filter-row .field { margin: 0; min-width: 160px; }
.repair-filter-row .btn { height: 40px; }
.repair-filter-row [hidden] { display: none !important; }
.repair-results {
  position: relative;
  min-height: 220px;
}
.repair-results.is-loading [data-repair-fragment="repairs"],
.repair-results.is-loading [data-warranty-fragment="warranty"],
.repair-results.is-loading [data-technician-fragment="jobs"],
.repair-results.is-loading [data-sales-fragment="sales"] {
  opacity: 0.38;
  pointer-events: none;
  filter: blur(0.4px);
  transition: opacity 0.15s ease;
}
.repair-results.is-loading::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 3px;
  z-index: 6;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--primary), #7aa2ff, transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: repair-load 0.9s ease-in-out infinite;
}
.repair-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 72px;
  pointer-events: none;
}
.repair-loader[hidden] { display: none; }
.repair-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 14px;
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.repair-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: inv-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes repair-load {
  0% { background-position: -40% 0; }
  100% { background-position: 140% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .repair-spinner,
  .repair-results.is-loading::before { animation: none; }
}
.tech-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 10px;
}
.tech-export-bar .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}
table.data th.tech-check,
table.data td.tech-check {
  width: 36px;
  padding-left: 10px;
  padding-right: 4px;
  text-align: center;
}
.tech-check input,
.tech-mobile-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  box-shadow: none;
}
.tech-mobile-check {
  display: flex;
  align-items: center;
  padding-top: 2px;
}
.tech-mobile-main { flex: 1; min-width: 0; }
.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th { background: var(--muted); font-weight: 650; font-size: 12px; }
table.data td.is-overdue { color: var(--danger); font-weight: 650; }
table.data a.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
  font-weight: 650;
}
table.data a.th-sort:hover,
table.data a.th-sort.is-active { color: var(--primary); text-decoration: none; }
table.data .th-sort-ico {
  position: relative;
  width: 8px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.32;
}
table.data .th-sort-ico::before,
table.data .th-sort-ico::after {
  content: "";
  position: absolute;
  left: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
table.data .th-sort-ico::before {
  top: 0;
  border-bottom: 4px solid currentColor;
}
table.data .th-sort-ico::after {
  bottom: 0;
  border-top: 4px solid currentColor;
}
table.data a.th-sort:hover .th-sort-ico { opacity: 0.7; }
table.data a.th-sort.is-active .th-sort-ico { opacity: 1; }
table.data a.th-sort.is-asc .th-sort-ico::after { opacity: 0.22; }
table.data a.th-sort.is-desc .th-sort-ico::before { opacity: 0.22; }
table.data th.num a.th-sort { justify-content: flex-end; }
table.data:not(.inv-table) tr:hover td { background: #f8fafc; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 650;
  background: var(--muted);
  color: var(--muted-fg);
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #e2e8f0; color: #334155; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-rose { background: #ffe4e6; color: #9f1239; }

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.alert-success { background: var(--success-soft); border-color: #bbf7d0; color: #166534; }
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-info a { color: #1e40af; font-weight: 600; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.row-actions form { display: inline-flex; margin: 0; }
.row-actions a,
.row-actions .btn,
.row-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
  cursor: pointer;
  font-family: inherit;
}
.row-actions a:hover,
.row-actions .btn:hover,
.row-actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  text-decoration: none;
  filter: none;
}
.row-actions a.btn-whatsapp,
.row-actions .btn-whatsapp {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.row-actions a.btn-whatsapp:hover,
.row-actions .btn-whatsapp:hover {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}
.row-actions .btn-danger,
.row-actions .btn-danger-outline {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff;
}
.row-actions .btn-danger:hover,
.row-actions .btn-danger-outline:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
table.data th.col-actions,
table.data td.col-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 52px;
  min-width: 52px;
  padding-right: 10px;
  text-align: right;
  white-space: nowrap;
  background: #fff;
  box-shadow: -8px 0 12px -10px rgba(15, 23, 42, 0.28);
}
table.data thead th.col-actions {
  background: var(--muted);
  z-index: 3;
}
table.data:not(.inv-table) tr:hover td.col-actions { background: #f8fafc; }
table.data td.cell-stack {
  line-height: 1.35;
}
table.data td.cell-stack > span {
  display: block;
}
table.data td.cell-stack .muted {
  font-size: 12px;
}
table.data td.cell-product {
  white-space: normal;
  max-width: 240px;
  line-height: 1.35;
}
table.data td.cell-problem {
  width: 240px;
  max-width: 240px;
  white-space: normal;
  vertical-align: top;
}
table.data td.cell-problem .cell-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  width: 240px;
  max-width: 100%;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}
table.data td.row-actions {
  width: 1%;
  white-space: nowrap;
}
table.data td.cell-dates {
  white-space: nowrap;
}
table.data td.cell-payment {
  max-width: 118px;
  white-space: normal;
  line-height: 1.35;
}
.row-menu {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
}
.row-menu-toggle {
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted-fg);
  cursor: pointer;
}
.row-menu-toggle:hover,
.row-menu.is-open .row-menu-toggle {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.row-menu-panel {
  display: none;
  position: fixed;
  z-index: 80;
  min-width: 200px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
.row-menu.is-open .row-menu-panel { display: block; }
.row-actions .row-menu-panel form,
.row-menu-panel form {
  display: block;
  width: 100%;
  margin: 0;
}
.row-actions .row-menu-panel a,
.row-actions .row-menu-panel button,
.row-menu-panel a,
.row-menu-panel button {
  display: flex;
  width: 100%;
  height: auto;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.row-menu-panel a:hover,
.row-menu-panel button:hover {
  background: var(--muted);
  text-decoration: none;
}
.row-menu-panel a.is-whatsapp { color: #15803d; }
.row-menu-panel .is-danger { color: var(--danger); }
.row-menu-panel .is-danger:hover { background: var(--danger-soft); }
.row-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.muted { color: var(--muted-fg); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 16px; color: var(--muted-fg); font-size: 13px; }
.pager-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; color: var(--muted-fg); font-size: 13px; }
.pager-size select {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  background: #fff;
  color: var(--fg);
  font-size: 13px;
}
.pager .links { display: flex; gap: 6px; }
.pager a, .pager span {
  display: inline-flex;
  min-width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--fg);
  text-decoration: none;
  background: #fff;
}
.pager .active span, .pager [aria-current="page"] span { background: var(--primary); color: #fff; border-color: var(--primary); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } }

.pos-layout { display: grid; grid-template-columns: 1.4fr 0.9fr; gap: 16px; }
@media (max-width: 1000px) { .pos-layout { grid-template-columns: 1fr; } }
.scan-row { display: flex; flex-wrap: wrap; gap: 8px; }
.scan-row input { flex: 1; min-width: 180px; }
.cart-empty { padding: 28px; text-align: center; color: var(--muted-fg); }
.totals { display: grid; gap: 6px; font-size: 13px; }
.totals .grand { font-size: 18px; font-weight: 700; display: flex; justify-content: space-between; }

/* POS workstation */
.pos-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.pos-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.pos-head-title { display: flex; align-items: flex-start; gap: 10px; }
.pos-head-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.pos-head-mark .pos-ico { width: 18px; height: 18px; }
.pos-head h1 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.pos-sprites { position: absolute; width: 0; height: 0; overflow: hidden; }
.pos-head p {
  margin: 4px 0 0;
  color: var(--muted-fg);
  font-size: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.pos-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pos-screen .btn .pos-ico { width: 15px; height: 15px; }
.pos-serial .pos-ico,
.pos-line-warn .pos-ico { width: 12px; height: 12px; }
.pos-head p .pos-ico { width: 13px; height: 13px; }
.pos-head-actions { flex-wrap: wrap; justify-content: flex-end; }
.pos-mode {
  display: inline-flex;
  align-items: stretch;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.pos-mode button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-fg);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pos-mode button .pos-ico { width: 14px; height: 14px; }
.pos-mode button.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.pos-screen.is-proforma .pos-head-mark {
  background: #fff7ed;
  color: #c2410c;
}
.pos-quote-only { display: none; }
.pos-screen.is-proforma .pos-quote-only { display: block; }
.pos-screen.is-proforma .pos-sale-only { display: none; }
.pos-shopee-only { display: none; }
.pos-screen.is-shopee .pos-shopee-only { display: block; }
.pos-screen.is-shopee .pos-customer-only { display: none !important; }
.pos-screen.is-shopee .pos-amount-field,
.pos-screen.is-shopee .pos-line-warn { display: none; }
.pos-screen.is-proforma .pos-panel-tab[data-checkout-panel="shopee"] { display: none; }
.pos-panel-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  text-transform: none;
  letter-spacing: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}
.pos-panel-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted-fg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.pos-panel-tab.is-active {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}
.pos-checkout-btn.is-shopee {
  background: #ee4d2d;
}
.pos-checkout-btn.is-shopee:hover { filter: brightness(1.05); }
.pos-screen.is-shopee #pos-checkout-total { display: none; }
.pos-product-search {
  margin-top: 0;
  position: relative;
  z-index: 8;
}
.pos-product-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 9;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
}
.pos-checkout-btn.is-quote {
  background: #c2410c;
}
.pos-checkout-btn.is-quote:hover { filter: brightness(1.05); }
.pos-screen.is-proforma .pos-done {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}
.pos-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
}
.pos-screen > .alert { margin: 10px 16px 0; }
.pos-scan {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
  position: relative;
  z-index: 7;
  overflow: visible;
}
@media (min-width: 960px) {
  .pos-scan {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
  }
}
.pos-scan-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}
.pos-scan-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.pos-scan-icon { width: 22px; height: 22px; color: var(--primary); flex-shrink: 0; }
.pos-scan-box input {
  flex: 1;
  min-width: 0;
  width: auto;
  border: 0;
  outline: 0;
  box-shadow: none;
  height: 46px;
  padding: 0;
  font-size: 16px;
  background: transparent;
}
.pos-scan-box input:focus { box-shadow: none; }
.pos-scan-box kbd {
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted-fg);
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
}
.pos-scan-box .btn { height: 36px; flex-shrink: 0; }
.pos-scan.is-busy .pos-scan-box { opacity: 0.7; }
.pos-pay-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.pos-pay-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-fg);
  white-space: nowrap;
}
.pos-pay-bar .pos-pay-methods {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.pos-pay-bar .pos-pay-chip {
  height: 40px;
  justify-content: center;
  font-size: 13px;
}
.pos-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  overflow: hidden;
}
.pos-cart-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.pos-cart-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.pos-cart-h strong { font-size: 13px; }
.pos-cart-title { display: flex; align-items: center; gap: 8px; color: var(--fg); }
.pos-cart-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 20px;
}
.pos-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  text-align: center;
  color: var(--muted-fg);
}
.pos-empty svg { width: 40px; height: 40px; color: var(--primary); opacity: 0.7; }
.pos-empty strong { color: var(--fg); font-size: 15px; }
.pos-empty p { margin: 0; font-size: 13px; max-width: 280px; }
.pos-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: pos-line-in 0.18s ease;
}
@keyframes pos-line-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.pos-line-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.pos-line-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.pos-line-name { font-weight: 650; }
.pos-line-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 4px; font-size: 12px; }
.pos-serial {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--muted);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
}
.pos-line-warn { display: inline-flex; align-items: center; gap: 4px; color: #9a3412; font-size: 11px; font-weight: 650; margin-top: 4px; }
.pos-line-money {
  display: grid;
  grid-template-columns: 110px 90px auto;
  gap: 8px;
  align-items: end;
}
.pos-line-money.is-qty {
  grid-template-columns: 72px 110px 90px auto;
}
.pos-line-money label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted-fg);
}
.pos-line-money input { height: 34px; padding: 4px 8px; }
.pos-line-sum {
  min-width: 92px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pos-line-remove {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted-fg);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.pos-line-remove:hover { background: var(--danger-soft); color: var(--danger); }
.pos-pay-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--border);
}
.pos-pay-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 8px;
}
.pos-section { margin-bottom: 16px; }
.pos-section-h {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-fg);
  margin-bottom: 10px;
}
.pos-input-ico {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  height: 38px;
}
.pos-input-ico:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.pos-input-ico .pos-ico { color: var(--muted-fg); }
.pos-input-ico input {
  border: 0 !important;
  box-shadow: none !important;
  padding: 0;
  height: 36px;
}
.pos-fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.pos-disc-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.pos-disc-wrap input { min-width: 0; flex: 1; }
.pos-disc-mode {
  display: inline-flex;
  flex-shrink: 0;
  align-self: stretch;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.pos-disc-mode button {
  min-width: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-fg);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.pos-disc-mode button.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.pos-method-select { display: none !important; }
.pos-pay-methods { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-customer-list:empty { display: none; margin: 0; }
.pos-pay-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.pos-pay-chip.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.pos-pay-chip.can-add {
  border-style: dashed;
  color: var(--primary);
}
.pos-pay-balance {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted-fg);
}
.pos-pay-balance.is-due { color: #9a3412; }
.pos-pay-balance.is-ok { color: #166534; }
.pos-pay-balance.is-over { color: #9a3412; }
.pos-tender-block { margin: 0 0 12px; }
.pos-tender-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
}
.pos-tender-hint { margin: 0 0 8px; font-size: 12px; }
.pos-tender-rows { display: grid; gap: 8px; }
.pos-tender {
  display: grid;
  grid-template-columns: minmax(72px, 92px) minmax(0, 1fr) minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
}
.pos-tender.is-cash {
  grid-template-columns: minmax(72px, 92px) minmax(0, 1fr) 32px;
}
.pos-tender-method {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
}
.pos-tender input[data-pay-amount] { height: 34px; padding: 4px 8px; }
.pos-tender input[data-pay-ref] { height: 34px; padding: 4px 8px; font-size: 12px; }
.pos-tender .pos-line-remove { justify-self: end; }
.pos-tender .pos-line-remove:disabled {
  opacity: 0;
  pointer-events: none;
}
.pos-customer-list { display: grid; gap: 6px; margin: 0 0 10px; }
.pos-customer-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  height: auto;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font: inherit;
  cursor: pointer;
}
.pos-customer-btn-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pos-customer-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.pos-picked {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--success-soft);
  border: 1px solid #bbf7d0;
}
.pos-picked-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pos-picked strong { display: block; }
.pos-picked small { color: #166534; }
.pos-done {
  padding: 12px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--success-soft);
  border: 1px solid #bbf7d0;
  color: #166534;
}
.pos-done-h { display: flex; align-items: flex-start; gap: 8px; }
.pos-done-h .pos-ico { margin-top: 2px; }
.pos-total-row .pos-ico { width: 14px; height: 14px; color: var(--muted-fg); }
.pos-total-label { display: inline-flex; align-items: center; gap: 6px; }
.pos-pay-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: #fbfdff;
}
.pos-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}
.pos-checkout-btn {
  width: 100%;
  height: 46px;
  margin-top: 12px;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 15px;
}
.btn.pos-checkout-btn.is-quote {
  background: #c2410c;
  color: #fff;
}
@media (max-width: 1000px) {
  .pos-body { grid-template-columns: 1fr; overflow: auto; }
  .pos-cart-panel { min-height: 280px; }
  .pos-pay-panel { border-left: 0; border-top: 1px solid var(--border); }
  .pos-line { grid-template-columns: minmax(0, 1fr) auto; }
  .pos-line-money { grid-column: 1 / -1; grid-template-columns: 1fr 1fr auto; }
  .pos-line-money.is-qty { grid-template-columns: 1fr 1fr 1fr auto; }
  .pos-scan-box kbd { display: none; }
  .pos-pay-bar { flex-wrap: wrap; }
  .pos-pay-bar .pos-pay-methods { min-width: 0; width: 100%; }
  .pos-pay-balance { width: 100%; }
  .pos-tender, .pos-tender.is-cash {
    grid-template-columns: minmax(72px, 92px) minmax(0, 1fr) 32px;
  }
  .pos-tender input[data-pay-ref] { grid-column: 1 / -1; }
  .pos-head { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .pos-pay-bar .pos-pay-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.list-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row > span:first-child { flex: none; }
.list-row > span:last-child { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: right; }

.action-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.action-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  text-decoration: none;
}
.action-card strong { display: block; font-size: 16px; }
.action-card p { margin: 4px 0 8px; color: var(--muted-fg); }
.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.action-icon svg { width: 22px; height: 22px; }

.label-preview { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.label-preview img, .label-preview svg { max-height: 80px; }

.lot-line {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfdff;
}
.lot-serial-help { margin: 6px 0 0; }
.import-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.import-row input[type="file"] { max-width: 360px; }
.import-status { margin-top: 12px; font-size: 13px; }
.import-status.ok { color: #166534; }
.import-status.err { color: var(--danger); }
.import-status.warn { color: #854d0e; }
.field-with-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-with-action select,
.field-with-action input {
  flex: 1;
  min-width: 0;
  width: auto;
}
.field-with-action .btn {
  flex: 0 0 auto;
  height: auto;
}
.quick-panel {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fbfdff;
  margin-top: 4px;
}
.quick-panel .field { margin-bottom: 8px; }
.quick-panel .form-grid { margin-bottom: 4px; }
.inline { display: flex; gap: 8px; align-items: center; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none; }

/* Inventory grid — model-grouped display */
.inv-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.inv-head {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.inv-head-copy { min-width: 0; }
.inv-head h1 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.inv-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}
.inv-head-actions .btn {
  white-space: nowrap;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  line-height: 1;
}
.inv-head-actions .inv-head-add { margin-left: 4px; }
.inv-add-kind { margin: 0 0 8px; }
.inv-add-kind button { height: 32px; padding: 0 14px; }
#inv-add-help { margin: 0 0 12px; }
.inv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
  position: relative;
  z-index: 12;
}
.inv-toolbar input,
.inv-toolbar select {
  width: auto;
  min-width: 140px;
  height: 36px;
  margin: 0;
}
.inv-toolbar input[type="search"] {
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}
.inv-ms {
  position: relative;
  z-index: 13;
  min-width: 160px;
  max-width: 220px;
}
.inv-ms-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.inv-ms-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-ms-btn svg { flex-shrink: 0; color: #64748b; }
.inv-ms-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 280px;
  max-height: 320px;
  overflow: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.inv-ms-menu[hidden] { display: none; }
.inv-ms-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.inv-ms-opt:hover { background: #f1f5f9; }
.inv-ms-opt.is-on,
.inv-ms-opt.is-on:hover {
  background: var(--primary);
  color: #fff;
}
.inv-toolbar .inv-ms-opt input {
  width: 14px;
  min-width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}
.inv-ms-opt.is-on input { accent-color: #fff; }
.inv-filter-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-fg);
  white-space: nowrap;
}
.inv-filter-loader[hidden] { display: none; }
.inv-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: inv-spin 0.55s linear infinite;
  flex-shrink: 0;
}
@keyframes inv-spin {
  to { transform: rotate(360deg); }
}
.inv-screen [data-inv-results],
.inv-screen [data-inv-fragment="inventory"] {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.inv-screen.is-filtering [data-inv-results] {
  pointer-events: none;
  opacity: 0.55;
}
.inv-screen.is-filtering .inv-grid {
  pointer-events: none;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  background: #fff;
}
.seg button {
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted-fg);
}
.seg button.is-active {
  background: var(--primary);
  color: #fff;
}
.inv-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  font-size: 12px;
}
.inv-stat-green { color: #166534; }
.inv-stat-red { color: #991b1b; }
.inv-stat-yellow { color: #854d0e; }
.inv-stat-blue { color: #1e40af; }
.inv-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.inv-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.inv-bulk-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.inv-bulk-fields select,
.inv-bulk-fields input {
  width: auto;
  min-width: 140px;
  height: 30px;
  margin: 0;
  padding: 4px 8px;
}
.inv-sold-fields {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inv-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--card);
}
.inv-table {
  min-width: 1780px;
  font-size: 12px;
}
.inv-table th, .inv-table td {
  padding: 5px 8px;
  height: 36px;
  vertical-align: middle;
}
.inv-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}
.inv-table .inv-col-check {
  width: 36px;
  position: sticky;
  left: 0;
  z-index: 2;
}
.inv-table .inv-col-model {
  min-width: 260px;
  max-width: 320px;
  position: sticky;
  left: 36px;
  z-index: 2;
}
.inv-table thead th.inv-col-check,
.inv-table thead th.inv-col-model,
.inv-table thead th.inv-col-actions {
  z-index: 5;
  background: var(--muted);
}
.inv-table .inv-col-qty { min-width: 72px; }
.inv-table .inv-col-sold {
  min-width: 64px;
  color: #991b1b;
}
.inv-table .inv-col-sold .muted { color: var(--muted-fg); font-weight: 500; }
.inv-table .inv-col-actions,
.inv-table td.inv-col-actions {
  position: sticky;
  right: 0;
  z-index: 3;
  min-width: 168px;
  width: 168px;
  box-shadow: -8px 0 12px -10px rgba(15, 23, 42, 0.35);
}
.inv-table .row-actions {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.inv-row-parent td {
  background: #e2e8f0;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding-top: 8px;
  padding-bottom: 8px;
}
.inv-row-group { background: #f1f5f9; font-weight: 600; }
.inv-row-group td { background: #f1f5f9; }
.inv-row-group:hover td { background: #e8eef5; }
.inv-row-boxed td { background: #eef2ff; }
.inv-row-boxed:hover td { background: #e0e7ff; }
.inv-box-badge {
  display: inline-block;
  margin: 4px 0 0 22px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #e0e7ff;
  color: #3730a3;
}
.inv-row-unit td { background: #fff; }
.inv-row-status-green td { background: rgba(34, 197, 94, 0.08); }
.inv-row-status-red td { background: rgba(239, 68, 68, 0.08); }
.inv-row-status-yellow td { background: rgba(234, 179, 8, 0.10); }
.inv-row-status-gray td { background: rgba(107, 114, 128, 0.10); }
.inv-row-status-blue td { background: rgba(59, 130, 246, 0.08); }
.inv-row-status-purple td { background: rgba(168, 85, 247, 0.08); }
.inv-row-status-orange td { background: rgba(249, 115, 22, 0.08); }
.inv-row-status-rose td { background: rgba(244, 63, 94, 0.10); }
.inv-row-status-green:hover td { background: rgba(34, 197, 94, 0.14); }
.inv-row-status-red:hover td { background: rgba(239, 68, 68, 0.14); }
.inv-row-status-yellow:hover td { background: rgba(234, 179, 8, 0.16); }
.inv-row-status-gray:hover td { background: rgba(107, 114, 128, 0.16); }
.inv-row-status-blue:hover td { background: rgba(59, 130, 246, 0.14); }
.inv-row-status-purple:hover td { background: rgba(168, 85, 247, 0.14); }
.inv-row-status-orange:hover td { background: rgba(249, 115, 22, 0.14); }
.inv-row-status-rose:hover td { background: rgba(244, 63, 94, 0.16); }
.inv-expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.inv-expand svg { flex-shrink: 0; transition: transform 0.12s ease; }
.inv-expand.is-open svg { transform: rotate(90deg); }
.inv-expand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-qty-hint { font-weight: 400; font-size: 10px; }
.inv-notes {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-warranty-expired { color: #e11d48; font-weight: 700; }
.inv-warranty-soon { color: #d97706; }
.inv-foot { border-top: 1px solid var(--border); background: var(--card); }
.inv-foot .pager { margin: 0; padding: 8px 16px; }
.inv-screen[data-view="grouped"] .inv-row-unit { display: none; }
.inv-screen[data-view="grouped"] .inv-row-unit.is-open { display: table-row; }
.inv-screen[data-view="grouped"] .inv-serial { padding-left: 22px; }
.inv-screen[data-view="flat"] .inv-row-group { display: none; }
.inv-screen[data-view="flat"] .inv-row-unit { display: table-row; }
.inv-screen[data-view="flat"] .inv-grouped-only { display: none; }
.inv-screen[data-view="grouped"] .inv-flat-only { display: none !important; }
.inv-sold-fields.hidden { display: none; }

.check input[type="checkbox"] { width: auto; height: auto; box-shadow: none; }
.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.list-row .wrap { text-align: right; max-width: 72%; }

.qr-box { text-align: center; }
.qr-box .inline { flex-wrap: wrap; justify-content: center; }
.qr-code { display: inline-flex; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.qr-code svg { width: 160px; height: 160px; }
.track-url { font-size: 11px; word-break: break-all; margin: 8px 0 0; color: var(--muted-fg); }
.intake-photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.intake-photo { width: 96px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.intake-photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; background: #fff; }
.intake-photo-row { align-items: flex-start; }
.intake-photo-row .intake-photos { margin-top: 0; justify-content: flex-end; }

.note-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.note-item:last-child { border-bottom: 0; }
.note-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted-fg); margin-bottom: 4px; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }

.track-page {
  min-height: 100%;
  padding: 32px 16px;
  background: linear-gradient(160deg, #f8fafc, #e2e8f0);
}
.track-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  padding: 24px;
}
.track-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.track-brand p { margin: 2px 0 0; font-size: 13px; }
.track-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.track-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.track-notes-h { font-size: 14px; margin: 20px 0 8px; }

.steps { margin: 16px 0 4px; display: grid; gap: 0; }
.step { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--muted-fg); font-weight: 600; font-size: 13px; }
.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  flex-shrink: 0;
}
.step.is-done { color: #166534; }
.step.is-done .step-dot { background: #16a34a; border-color: #16a34a; }
.step.is-current { color: var(--primary); }
.step.is-current .step-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

.cash-lines { display: grid; gap: 0; }
.cash-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.cash-line:last-child { border-bottom: 0; }
.cash-line strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cash-line.is-out strong { color: var(--danger); }
.cash-line.is-ok strong { color: var(--success); }
.cash-line.is-total {
  border-bottom: 0;
  border-top: 1px solid var(--fg);
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 650;
}
.cash-sheet .field { margin-bottom: 10px; }
.cash-sheet .help { margin-top: 4px; }

.pos-product-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #fff;
}
.pos-product-empty span { color: var(--muted-fg); font-size: 13px; }
.app-modal,
.pos-modal {
  width: min(520px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}
#pos-quick-modal,
#warranty-add-modal,
#inv-add-modal {
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.pos-kind-tabs { margin: 2px 0 14px; }
.pos-kind-tabs .pos-panel-tab {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  height: auto;
  min-height: 38px;
  padding: 8px 10px;
  white-space: normal;
  line-height: 1.25;
}
.app-modal::backdrop,
.pos-modal::backdrop { background: rgba(15, 23, 42, 0.45); }
.app-modal form,
.pos-modal form { margin: 0; }
.app-modal-h,
.pos-modal-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}
.app-modal-h h2,
.pos-modal-h h2 { margin: 0; font-size: 16px; letter-spacing: -0.03em; }
.app-modal-h p,
.pos-modal-h p { margin: 6px 0 0; color: var(--muted-fg); font-size: 13px; }
.app-modal-b,
.pos-modal-b { padding: 14px 16px 4px; }
.app-modal-b .field:last-child,
.pos-modal-b .field:last-child { margin-bottom: 0; }
.app-modal-f,
.pos-modal-f {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
}
.pos-modal .icon-btn .pos-ico { width: 16px; height: 16px; }
.inv-issue-product {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--muted);
}
.inv-issue-product strong { font-size: 14px; }
.inv-issue-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 13px;
  font-weight: 600;
}
.inv-issue-picked {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--success-soft);
  color: #166534;
  font-size: 13px;
}
.inv-issue-suggest {
  position: relative;
  z-index: 6;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow: auto;
}
.inv-issue-suggest button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.inv-issue-suggest button:hover { background: var(--muted); }
.inv-issue-suggest .muted { display: block; font-size: 12px; }

.takeout-screen { max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; }
.takeout-cam {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #0f172a;
  min-height: 220px;
  display: grid;
  place-items: center;
}
.takeout-cam video {
  display: none;
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: #0f172a;
}
.takeout-cam.is-live video { display: block; }
.takeout-cam-frame {
  display: none;
  position: absolute;
  inset: 18% 12%;
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 12px;
  box-shadow: 0 0 0 200vmax rgba(15, 23, 42, 0.28);
  pointer-events: none;
}
.takeout-cam.is-live .takeout-cam-frame { display: block; }
.takeout-cam-hint {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  margin: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  pointer-events: none;
}
.takeout-cam:not(.is-live) .takeout-cam-hint {
  position: static;
  padding: 16px 16px 8px;
  color: #e2e8f0;
  text-shadow: none;
}
.takeout-cam-btn { margin: 0 16px 16px; }
.card .takeout-cam { min-height: 180px; margin-bottom: 10px; border-radius: 12px; }
.card .takeout-cam video { height: 200px; }
.takeout-cam.is-live .takeout-cam-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0;
  height: 32px;
  padding: 0 10px;
  background: rgba(255,255,255,0.92);
  color: var(--fg);
}
.takeout-scan { margin-bottom: 14px; }
.takeout-scan .pos-scan-box { margin: 0; }
.takeout-scan-status { margin: 8px 2px 0; min-height: 1.2em; }
.takeout-scan-status.is-error { color: var(--danger); }
.takeout-suggest { margin-top: 8px; }
.takeout-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.takeout-submit,
.takeout-reset { width: 100%; height: 44px; }
.takeout-reset { margin-top: 8px; }

.transfer-branches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.transfer-cart { margin-top: 4px; }
.transfer-cart-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.transfer-cart-list { display: grid; gap: 8px; margin-bottom: 12px; }
.transfer-empty { margin: 0; padding: 8px 2px; }
.transfer-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 36px;
  gap: 8px;
  align-items: center;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.transfer-line-main { min-width: 0; display: grid; gap: 2px; }
.transfer-line-main strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.transfer-line-main .muted { font-size: 12px; }
.transfer-line-qty { text-align: center; }
.transfer-line-qty input {
  width: 100%;
  height: 36px;
  text-align: center;
}
.transfer-line-remove {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.transfer-line-remove:hover { background: var(--danger-soft); color: var(--danger); }
.tech-send-items,
.tech-return-items { display: grid; gap: 10px; }
.tech-return-items { margin-top: 4px; }
.tech-send-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow-wrap: anywhere;
}
.tech-send-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.tech-send-item-main { min-width: 0; }
.tech-send-item-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tech-send-item-fields {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.tech-send-item-fields .field { margin: 0; }
.tech-send-item-fields textarea { min-height: 58px; resize: vertical; }
.transfer-notes { margin-bottom: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cat-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.cat-chart-totals {
  display: flex;
  gap: 12px;
  color: var(--muted-fg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.cat-chart-totals strong { color: var(--fg); }
.cat-chart {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}
.cat-donut-wrap { display: grid; place-items: center; }
.cat-donut {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.cat-donut-hole {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--card);
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1.15;
}
.cat-donut-hole strong { font-size: 20px; letter-spacing: -0.03em; }
.cat-donut-hole span { color: var(--muted-fg); font-size: 11px; }
.cat-bars { display: grid; gap: 12px; }
.cat-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.cat-bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cat-bar-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.cat-bar-track {
  height: 10px;
  background: var(--muted);
  border-radius: 999px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
}
.cat-bar-meta {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.2;
}
.cat-bar-meta span {
  display: block;
  color: var(--muted-fg);
  font-size: 12px;
}
@media (max-width: 900px) {
  .cat-chart { grid-template-columns: 1fr; }
  .cat-bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cat-bar-track { grid-column: 1 / -1; order: 3; }
}

.amt-in { color: var(--success); }
.amt-out { color: var(--danger); }
.cash-in-hand {
  font-size: 32px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.method-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.method-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
}
.method-pill:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.method-pill.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.cash-report-table td.wrap {
  white-space: normal;
  min-width: 180px;
  max-width: 360px;
}
.cash-report-table tr.day-row td,
table.data tr.day-row td {
  background: #f1f5f9;
  font-weight: 650;
}
.cash-report-table tr.day-row:hover td,
table.data tr.day-row:hover td {
  background: #e8eef6;
}
.cash-report.is-filtering [data-report-results] {
  pointer-events: none;
  opacity: 0.55;
}

.prod-count {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: space-between;
  align-items: center;
}
.prod-count-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.prod-table .prod-check {
  width: 40px;
  text-align: center;
}
.prod-table .prod-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}
.prod-table { width: 100%; }
.prod-table th,
.prod-table td { vertical-align: middle; }
.prod-table .prod-sku {
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prod-table .prod-name {
  white-space: normal;
  min-width: 220px;
  max-width: 420px;
  line-height: 1.35;
}
.prod-table .prod-name a,
.prod-table .prod-name-text {
  font-weight: 600;
  color: inherit;
}
.prod-table .prod-name a:hover { color: var(--primary); text-decoration: none; }
.prod-table .prod-specs {
  display: block;
  margin-top: 3px;
  color: var(--muted-fg);
  font-size: 12px;
  font-weight: 500;
}
.prod-table .prod-sort {
  color: inherit;
  text-decoration: none;
  font-weight: 650;
}
.prod-table .prod-sort:hover,
.prod-table .prod-sort.is-active { color: var(--primary); text-decoration: none; }
.prod-table .prod-qty-warn { color: #b45309; }
.prod-table .prod-qty-warn strong { font-weight: 700; }
.prod-table tr.is-inactive td { color: var(--muted-fg); }
.prod-table .prod-actions {
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 2;
  min-width: 1%;
  white-space: nowrap;
  box-shadow: -8px 0 12px -10px rgba(15, 23, 42, 0.28);
}
.prod-table thead th.prod-actions {
  background: var(--muted);
  z-index: 3;
}
table.data.prod-table tr:hover td.prod-actions { background: #f8fafc; }
.repair-pay .help { margin: 4px 0 8px; }
.repair-pay-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.repair-pay-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 160px) 36px;
  gap: 8px;
  align-items: center;
}
.repair-pay-row .pos-line-remove:disabled {
  opacity: 0;
  pointer-events: none;
}
.repair-pay-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.repair-pay-total {
  font-size: 13px;
  color: var(--muted-fg);
  text-align: right;
}
.repair-pay-due {
  display: block;
  margin-top: 2px;
  font-weight: 650;
}
.repair-pay-due.is-due { color: #9a3412; }
.repair-pay-due.is-ok { color: #166534; }
.repair-pay-total strong {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 800px) {
  .repair-pay-row { grid-template-columns: minmax(0, 1fr) 36px; }
  .repair-pay-row input[type="number"] { grid-column: 1; }
}
.proforma-convert { display: grid; gap: 14px; justify-items: start; }
.proforma-pay { width: 100%; }
.proforma-pay > label { font-weight: 600; font-size: 13px; }
.proforma-pay-rows { display: grid; gap: 8px; margin: 8px 0; }
.proforma-pay-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(110px, 140px) minmax(160px, 1fr) 36px;
  gap: 8px;
  align-items: center;
}
.proforma-pay-row .pos-line-remove:disabled { opacity: 0; pointer-events: none; }
.proforma-pay-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.proforma-pay-total { font-size: 13px; color: var(--muted-fg); text-align: right; }
.proforma-pay-total strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.proforma-pay-due { display: block; margin-top: 2px; font-weight: 650; }
.proforma-pay-due.is-due { color: #9a3412; }
.proforma-pay-due.is-ok { color: #166534; }
@media (max-width: 800px) {
  .proforma-pay-row { grid-template-columns: minmax(0, 1fr) 36px; }
  .proforma-pay-row input { grid-column: 1; }
}
.prod-table .prod-empty {
  white-space: normal;
  text-align: center;
  padding: 36px 16px;
}
.prod-table .prod-empty strong { display: block; margin-bottom: 4px; color: var(--fg); }
@media (max-width: 900px) {
  .prod-table .prod-name { max-width: 280px; }
}

.mobile-title,
.mobile-tabbar,
.mobile-cards,
.mobile-fab,
.mobile-app-home { display: none; }
.expense-summary {
  margin: 0 0 12px;
  font-weight: 650;
  color: var(--muted-fg);
}

@media (max-width: 720px) {
  html { -webkit-text-size-adjust: 100%; }
  body {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .app { min-height: 100dvh; height: auto; }
  .sidebar { display: none; }
  .hide-on-mobile { display: none !important; }
  .app.has-mobile-nav .desktop-dashboard { display: none; }

  .mobile-title {
    display: block;
    flex: 1;
    min-width: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .search-box { display: none; }
  .topbar {
    gap: 8px;
    padding: 0 12px;
  }
  .branch-wrap {
    min-width: 0;
    padding: 0 6px;
    height: 34px;
  }
  .branch-wrap select {
    min-width: 0;
    max-width: 118px;
    font-size: 12px;
  }
  .user-chip {
    padding: 0;
    border: 0;
    background: transparent;
    height: 34px;
  }
  .user-chip .meta,
  .user-chip-caret { display: none; }
  .avatar { width: 30px; height: 30px; font-size: 11px; }
  .user-menu-panel { min-width: 200px; }

  .content { padding: 14px 14px 24px; }
  .app.has-mobile-nav .content { padding-bottom: 96px; }
  .app.has-mobile-nav .mobile-fab { bottom: calc(76px + env(safe-area-inset-bottom)); }

  .field input, .field select, .field textarea, .field .multi-select-btn, .btn {
    font-size: 16px;
  }
  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: end;
  }
  .filters .field {
    min-width: 0;
    margin: 0;
  }
  .filters .multi-select { width: 100%; }
  .filters .field-span { grid-column: 1 / -1; }
  .filters .btn,
  .filters a.btn {
    height: 42px;
    width: 100%;
  }
  .filters.repair-filters {
    display: flex;
    flex-direction: column;
  }
  .repair-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }
  .repair-filter-row .field { min-width: 0; }
  .repair-filter-row .btn,
  .repair-filter-row a.btn {
    width: 100%;
    height: 42px;
  }

  .expense-summary {
    display: block;
    margin: 0 0 12px;
    font-weight: 650;
    color: var(--muted-fg);
  }
  .mobile-cards {
    display: grid;
    gap: 10px;
  }
  .mobile-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px;
  }
  .mobile-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
  }
  .mobile-card-top strong {
    font-size: 15px;
    line-height: 1.3;
  }
  .mobile-card-amt {
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .mobile-card-meta {
    margin-top: 4px;
    color: var(--muted-fg);
    font-size: 12px;
  }
  .mobile-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
  }
  .mobile-card-actions .btn { min-width: 88px; }

  .mobile-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: fixed;
    right: 16px;
    bottom: 24px;
    z-index: 30;
    height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(18, 72, 199, 0.35);
    text-decoration: none;
  }
  .mobile-fab:hover { color: #fff; text-decoration: none; }
  .mobile-fab svg { width: 18px; height: 18px; }

  .mobile-app-home { display: block; padding-top: 8px; }
  .mobile-app-hello {
    margin: 0;
    font-size: 26px;
    font-weight: 750;
    letter-spacing: -0.04em;
  }
  .mobile-app-sub {
    margin: 4px 0 18px;
    color: var(--muted-fg);
  }
  .app-tiles {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .app-tiles:has(> :nth-child(4)) {
    grid-template-columns: 1fr 1fr;
  }
  .app-tile {
    display: grid;
    gap: 6px;
    padding: 20px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
  }
  .app-tiles:has(> :nth-child(4)) .app-tile {
    padding: 16px 14px;
  }
  .app-tiles:has(> :nth-child(4)) .app-tile-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .app-tiles:has(> :nth-child(4)) .app-tile-icon svg { width: 20px; height: 20px; }
  .app-tiles:has(> :nth-child(4)) .app-tile strong { font-size: 15px; }
  .app-tiles:has(> :nth-child(4)) .app-tile span:last-child { font-size: 12px; }
  .app-tile:hover { text-decoration: none; border-color: var(--primary); }
  .app-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    margin-bottom: 4px;
  }
  .app-tile-icon svg { width: 24px; height: 24px; }
  .app-tile strong { font-size: 18px; letter-spacing: -0.03em; }
  .app-tile span:last-child { color: var(--muted-fg); font-size: 13px; }

  .mobile-tabbar {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .mobile-tabbar::-webkit-scrollbar { display: none; }
  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1 0 auto;
    min-width: 64px;
    min-height: 52px;
    padding: 0 6px;
    border-radius: 12px;
    color: var(--muted-fg);
    font-size: 10px;
    font-weight: 650;
    text-decoration: none;
  }
  .mobile-tab svg { width: 20px; height: 20px; }
  .mobile-tab:hover { text-decoration: none; color: var(--fg); }
  .mobile-tab.active {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .inv-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .inv-head-actions {
    margin-left: 0;
    justify-content: flex-start;
  }
  .inv-head-actions .btn {
    height: 40px;
    font-size: 14px;
  }
  .inv-head-actions .inv-head-add { margin-left: 0; }

  .page-head-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .page-head-actions h1 { font-size: 20px; }
  .page-head-actions .inline {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .page-head-actions .inline .btn,
  .page-head-actions .inline form {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
  }
  .page-head-actions .inline .btn {
    height: 42px;
    justify-content: center;
  }
  .page-head-actions .inline form .btn { width: 100%; }

  .tech-subnav {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .tech-subnav .btn {
    flex: 1;
    min-width: 0;
    height: 40px;
    justify-content: center;
  }

  .pagination { margin-top: 12px; }
  .takeout-screen { max-width: none; padding: 10px 12px 8px; }
  .takeout-cam { min-height: 260px; border-radius: 14px; }
  .takeout-cam video { height: 280px; }
  .takeout-form { padding: 14px 12px 16px; }
  .takeout-submit, .takeout-reset { height: 48px; font-size: 16px; }
  .transfer-branches { grid-template-columns: 1fr; gap: 8px; }
  .transfer-line { grid-template-columns: minmax(0, 1fr) 56px 36px; }

  .branch-wrap svg { display: none; }
  .cash-sheet .card-h { padding: 12px 14px; }
  .cash-sheet .inline { width: 100%; flex-wrap: wrap; }
  .cash-sheet .inline .btn { flex: 1; min-height: 42px; height: 42px; }
  .cash-in-hand { font-size: 36px; }
  .form-grid + .btn { width: 100%; height: 44px; }
}

.issue-sheet-banner {
  background: #fef3c7;
  color: #b91c1c;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 12px;
  text-align: right;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
table.issue-sheet th {
  white-space: nowrap;
}
table.issue-sheet td.issue-problem {
  max-width: 280px;
  white-space: normal;
  line-height: 1.35;
}
@media (max-width: 720px) {
  .issue-sheet-banner { display: none; }
}

.filters .inv-filter-loader {
  margin-bottom: 10px;
}
.shopee-orders-screen.is-filtering [data-shopee-results] {
  pointer-events: none;
  opacity: 0.55;
}
.filters .shopee-status-tabs {
  flex: 1 0 100%;
  margin: 4px 0 0;
}
.shopee-status-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}
.shopee-status-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #334155;
  font: inherit;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
  padding: 10px 12px 12px;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.shopee-status-tabs button:hover { color: #0f172a; }
.shopee-status-tabs button.is-active { color: #16a34a; }
.shopee-status-tabs button.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: #16a34a;
}
.shopee-tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}
.shopee-status-tabs button.is-active .shopee-tab-count {
  background: #dcfce7;
  color: #166534;
}
table.shopee-orders {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}
table.shopee-orders th,
table.shopee-orders td {
  vertical-align: top;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
table.shopee-orders th {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted-fg);
  background: #fff;
  white-space: nowrap;
}
table.shopee-orders tbody tr:hover td { background: #fbfdff; }
.shopee-col-date { width: 150px; min-width: 132px; }
.shopee-col-total { width: 140px; min-width: 120px; }
.shopee-col-status { width: 120px; min-width: 100px; }
.shopee-col-fulfill { width: 170px; min-width: 140px; }
.shopee-order-time { color: var(--muted-fg); font-size: 13px; white-space: nowrap; }
.shopee-order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}
.shopee-coid { font-weight: 650; color: #334155; }
.shopee-buyer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-fg);
}
.shopee-shop {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c2410c;
  font-weight: 650;
}
.shopee-shop-mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #ee4d2d;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}
.shopee-item-list { display: grid; gap: 12px; }
.shopee-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.shopee-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--muted);
  border: 1px solid var(--border);
}
.shopee-thumb-empty { display: block; }
.shopee-item-name {
  font-weight: 650;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shopee-item-var { margin-top: 2px; color: var(--muted-fg); font-size: 12px; }
.shopee-item-qty { color: var(--muted-fg); white-space: nowrap; font-weight: 600; }
.shopee-more-btn {
  margin-top: 10px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
}
.shopee-more-btn:hover { text-decoration: underline; }
.shopee-amount { font-weight: 700; }
.shopee-amount-paid { margin-top: 4px; color: #16a34a; font-weight: 700; }
.shopee-amount-pct { color: #16a34a; font-size: 12px; font-weight: 650; }
.shopee-status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.shopee-text-open { color: #16a34a; font-weight: 700; }
.shopee-text-closed { color: #64748b; font-weight: 700; }
.shopee-text-cancel { color: #dc2626; font-weight: 700; }
.shopee-remark { margin-top: 8px; color: var(--muted-fg); font-size: 12px; word-break: break-word; }
.shopee-ship { margin-top: 6px; font-size: 12px; }
.shopee-ship.is-overdue { color: var(--danger); font-weight: 650; }
@media (max-width: 900px) {
  table.shopee-orders thead { display: none; }
  table.shopee-orders,
  table.shopee-orders tbody,
  table.shopee-orders tr,
  table.shopee-orders td { display: block; width: 100%; }
  table.shopee-orders tr {
    padding: 4px 0 12px;
    border-bottom: 8px solid var(--bg);
  }
  table.shopee-orders td {
    padding: 8px 14px;
    border-bottom: 0;
  }
  .shopee-order-time { margin-top: 0; }
  .shopee-shop { margin-left: 0; }
}

