/* SMART POS — catalog view + editor dialog */

/* ---------- editor dialog ---------- */
dialog.editor {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; color: var(--text);
  background: linear-gradient(180deg, rgba(10, 22, 40, .98), rgba(6, 12, 24, .98));
  border: 1px solid var(--line-hi); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), var(--glow);
  overflow: visible;
}
dialog.editor::backdrop { background: rgba(2, 6, 12, .7); backdrop-filter: blur(3px); }
dialog.editor form { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.ed-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.ed-head h2 { margin: 4px 0 0; font: 700 24px/1 var(--f-head); letter-spacing: .06em; text-transform: uppercase; }
.ed-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.ed-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.ed-actions { display: flex; gap: 8px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fl { font: 600 10px var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); }
.fh { font: 500 11px var(--f-mono); color: var(--dim); }
select.field, textarea.field { appearance: none; -webkit-appearance: none; }
select.field {
  padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--cyan) 50%), linear-gradient(135deg, var(--cyan) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
select.field option { background: var(--panel-solid); color: var(--text); }
textarea.field { resize: vertical; min-height: 70px; }
.field:user-invalid { border-color: rgba(255, 79, 109, .6); }
.sub { margin: 4px 0 -4px; font: 700 13px var(--f-head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.parts-used { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.parts-used legend { padding: 0 6px; font: 600 10px var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); }
.parts-used legend .fh { letter-spacing: 0; text-transform: none; }
.parts-used p { margin: 0; }
.prow { display: grid; grid-template-columns: 1fr 70px 32px; gap: 8px; }
.parts-used .btn { align-self: flex-start; }
.x {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(16, 32, 54, .7); font-size: 18px; line-height: 1;
}
.x:hover { border-color: var(--red); color: var(--red); }

.margin { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 8px; background: rgba(59, 227, 255, .06); border: 1px solid var(--line); font: 500 12px var(--f-mono); color: var(--muted); }
.margin b { color: var(--text); }
.margin b.neg { color: var(--red); }
.margin em { color: var(--amber); font-style: normal; }
.err { margin: 0 20px; padding: 9px 12px; border-radius: 8px; border: 1px solid rgba(255, 79, 109, .5); background: rgba(255, 79, 109, .1); color: #ffc2cd; font-size: 13px; }

.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.danger { color: var(--red); border-color: rgba(255, 79, 109, .4); }
.btn.danger:hover { background: rgba(255, 79, 109, .12); }

/* ---------- catalog view ---------- */
.cat-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.cat-bar .tabs { margin: 0; }
.cat-bar .search { max-width: 320px; margin-left: auto; }
.row-act { display: flex; gap: 6px; justify-content: flex-end; }
table.hud td.price { font: 600 15px var(--f-mono); color: var(--cyan); }
table.hud td .neg { color: var(--red); }
table.hud a { color: var(--cyan); }
.add-row td { padding: 0; }
.add-row button {
  width: 100%; padding: 12px; border: 0; border-top: 1px dashed var(--line); background: none; color: var(--dim);
  font: 600 13px var(--f-head); letter-spacing: .08em; text-transform: uppercase;
}
.add-row button:hover { color: var(--cyan); background: rgba(59, 227, 255, .04); }
.backup { display: flex; gap: 8px; }

/* service card edit button on the register */
.svc-wrap { position: relative; display: flex; }
.svc-wrap .svc { flex: 1; }
.svc-wrap .edit {
  position: absolute; right: 12px; bottom: 34px; padding: 3px 8px; border-radius: 5px;
  border: 1px solid var(--line); background: rgba(4, 10, 18, .8); color: var(--muted);
  font: 600 10px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; opacity: 0; transition: opacity .15s;
}
.svc-wrap:hover .edit, .svc-wrap .edit:focus-visible { opacity: 1; }
.svc-wrap .edit:hover { color: var(--cyan); border-color: var(--line-hi); }
button.svc.placeholder { cursor: pointer; font: inherit; }
button.svc.placeholder:hover { border-color: var(--line-hi); color: var(--cyan); }

@media (hover: none) { .svc-wrap .edit { opacity: 1; } }
@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .cat-bar .search { max-width: none; margin-left: 0; width: 100%; }
}
