:root {
  color-scheme: light;
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
  color: #1b2f2c;
  background: #f3f6f5;
  --teal: #13524b;
  --border: #dbe5e1;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem clamp(1rem, 3vw, 3rem); background: var(--teal); color: white; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.35rem; font-weight: 750; letter-spacing: -.04em; white-space: nowrap; }
.brand img { object-fit: contain; background: white; border-radius: 4px; }
.brand-name span { color: #a0ded0; }
.identity { display: flex; align-items: center; gap: 1rem; text-align: right; }
.identity .outline { color: white; border-color: #9bbfba; background: transparent; }
main { margin: 0 auto; padding: 1.25rem clamp(.8rem, 2.5vw, 2rem) 2rem; }
.auth-layout { max-width: 490px; margin-top: clamp(1rem, 10vh, 5rem); }
.settings { max-width: 980px; margin-top: 2rem; }
.pos { width: 100%; padding-inline: clamp(.65rem, 1.25vw, 1.25rem); }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: clamp(.85rem, 2vw, 1.35rem); min-width: 0; }
.sidebar { background: #f9fbfa; }
.stack { display: grid; gap: .85rem; align-content: start; min-width: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(17rem, 1fr); gap: 1rem; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.page-title, .subtotal, .total { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.page-title { margin-bottom: 1rem; }
.page-title h1 { margin: 0; }
h1, h2 { color: var(--teal); margin: 0 0 .8rem; }
h1 { font-size: 1.65rem; line-height: 1.15; }
h2 { font-size: 1.1rem; border-bottom: 1px solid var(--border); padding-bottom: .55rem; }
form { margin: 0; }
label { display: grid; gap: .3rem; font-weight: 600; min-width: 0; }
input, select, button { font: inherit; }
input, select { min-width: 0; width: 100%; padding: .48rem .55rem; color: inherit; background: #fff; border: 1px solid #a9beb7; border-radius: 3px; }
button { border: 1px solid var(--teal); border-radius: 3px; padding: .47rem .75rem; background: var(--teal); color: white; font-weight: 650; cursor: pointer; }
button.outline { background: white; color: var(--teal); }
button:hover:not(:disabled) { filter: brightness(.94); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #318a7f; outline-offset: 2px; }
fieldset { margin: 0; min-width: 0; border: 1px solid var(--border); border-radius: 3px; padding: .75rem; }
legend { padding: 0 .3rem; color: var(--teal); font-weight: 700; overflow-wrap: anywhere; }
summary { cursor: pointer; color: var(--teal); font-weight: 600; }
details[open] > :nth-child(2) { margin-top: .6rem; }
.admin-access { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1.1rem; }
.search { display: flex; gap: .45rem; align-items: end; }
#product-dialog {
  width: min(1200px, calc(100% - 1rem));
  max-height: 85dvh;
  padding: clamp(.283rem, .667vw, .45rem);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: inherit;
  background: white;
  box-shadow: 0 16px 48px #142d3050;
}
#product-dialog::backdrop {
  background: rgb(17 45 43 / 35%);
  backdrop-filter: blur(5px);
}
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.dialog-heading h2 { border: 0; padding: 0; margin: 0; }
.pos .product-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.6rem;
  gap: 0;
  align-items: stretch;
  margin-bottom: .65rem;
}
.pos .product-lookup-inline .product-search {
  grid-template-columns: 2.25rem minmax(0, 1fr) 2.6rem;
  margin-bottom: 0;
}
.pos .product-search input {
  height: 100%;
  min-height: 42px;
  padding-inline: .65rem;
  border-color: var(--teal-accent);
  border-radius: 3px 0 0 3px;
}
.pos .product-lookup-inline input[type="search"] { border-radius: 0; border-inline-start: 0; }
.pos .product-search :is(button, input):focus-visible { position: relative; z-index: 1; }
.pos .product-search button {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0;
}
.pos .product-search-barcode {
  color: var(--teal);
  background: #f2f2f2;
  border-color: var(--teal-accent);
  border-radius: 3px 0 0 3px;
}
.pos .product-search-submit { border-radius: 0 3px 3px 0; }
#product-dialog .product-search { grid-template-columns: minmax(0, 1fr) 2.6rem 2.6rem; }
#product-dialog .product-search-submit { border-radius: 0; }
#product-dialog .product-search-close { border-inline-start: 0; border-radius: 0 3px 3px 0; font-size: 1.4rem; line-height: 1; }
.barcode-icon {
  width: 15px;
  height: 13px;
  background: linear-gradient(90deg, currentColor 2px, transparent 2px 4px,
    currentColor 4px 5px, transparent 5px 7px, currentColor 7px 9px,
    transparent 9px 10px, currentColor 10px 11px, transparent 11px 13px, currentColor 13px);
}
.search-icon { width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 50%; position: relative; }
.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 2px;
  transform: rotate(45deg);
  background: currentColor;
  content: "";
}
.product-status:empty { display: none; }
.product-status { font-size: .85rem; margin: .45rem 0; }
.pos .product-results { max-height: min(21rem, 45vh); overflow: auto; margin-bottom: .75rem; }
#product-dialog .product-results { margin-bottom: 0; }
.pos .product-results th { position: sticky; top: 0; z-index: 1; }
.pos .product-results .placeholder { padding: .9rem .75rem; }
.product-results td:first-child { min-width: 6rem; }
.pos .product-results .stock-cell { text-align: right; }
.product-results .stock-cell .stock { margin-right: 0; }
.pos .product-results .stock-selectable { position: relative; padding: 0; }
.pos .product-results .stock-selectable:focus-within {
  background: var(--teal-soft);
  box-shadow: inset 0 0 0 2px var(--teal-accent);
}
.pos .product-results .stock-target {
  display: block;
  width: 100%;
  padding: .55rem .5rem;
  border: 0;
  background: transparent;
  color: var(--teal);
  text-align: right;
}
.stock-target::after { content: ""; position: absolute; inset: 0; }
.pos .product-results .stock-target:focus-visible { outline: none; }
.product-lookup-inline { position: relative; margin-bottom: .65rem; }
.pos .product-lookup-inline .product-results {
  position: absolute;
  inset: calc(100% + 4px) 0 auto;
  z-index: 5;
  background: white;
  border-color: var(--teal-accent);
  box-shadow: 0 6px 18px rgb(19 82 75 / 18%);
}
.product-results .product-status { padding-inline: .5rem; }
.product-price-dialog {
  width: min(620px, calc(100% - 2rem));
  max-height: 85dvh;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: inherit;
  box-shadow: 0 16px 48px #142d3050;
}
.product-price-dialog::backdrop { background: rgb(13 61 55 / 35%); backdrop-filter: blur(5px); }
.product-price-picker .dialog-heading { margin: 0; }
.product-price-picker .price-product { color: var(--teal); }
.product-price-picker label { display: flex; align-items: center; gap: .5rem; }
.product-price-picker input[type="radio"] { width: auto; accent-color: var(--teal); }
.price-actions { display: flex; justify-content: flex-end; }
.grow { flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; border-bottom: 1px solid var(--border); padding: .55rem .5rem; }
th { color: var(--teal); background: #edf4f1; font-size: .84rem; }
td select { min-width: 8rem; }
.stock { font-variant-numeric: tabular-nums; font-weight: 650; margin-right: .55rem; white-space: nowrap; }
.small { font-size: .8rem; padding: .25rem .4rem; }
.quantity { width: 5.5rem; }
.placeholder { text-align: center; color: #4d655f; padding: 1rem .4rem; }
.code { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.block { display: block; }
.muted { color: #4d655f; }
.fine, .subtotal { font-size: .84rem; }
.fine { margin: 0; }
.error, .success { padding: .65rem .8rem; border-radius: 3px; }
.message-dialog {
  width: min(25rem, calc(100% - 2rem));
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: inherit;
  box-shadow: 0 16px 40px rgb(13 61 55 / 25%);
}
.message-dialog::backdrop { background: rgb(13 61 55 / 35%); backdrop-filter: blur(5px); }
.message-dialog p { overflow-wrap: anywhere; white-space: pre-wrap; }
.message-dialog-actions { display: flex; justify-content: flex-end; gap: .45rem; }
.error { background: #fceeed; color: #8d231b; }
.success { background: #e5f4ec; color: #13533d; }
.total { border-top: 1px solid var(--border); padding-top: .7rem; color: var(--teal); font-weight: 700; }
.total strong { font-size: 1.2rem; }
.customer-results { display: grid; gap: .4rem; max-height: 17rem; overflow: auto; }
.customer-option { text-align: left; display: grid; }
.sale-result { border: 1px solid var(--border); padding: .65rem; overflow-wrap: anywhere; }
.sale-result-table { margin-top: .5rem; }
.receipt-print {
  padding: .2rem .45rem;
  border: 1px solid var(--teal-accent);
  border-radius: 3px;
  color: var(--teal);
  font-size: .82rem;
  font-weight: 650;
  text-decoration: none;
}
.receipt-print:hover { background: var(--teal-soft); }
.print-sale-actions { gap: .5rem; flex-wrap: wrap; }
.primary-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: .47rem .75rem;
  border-radius: 3px;
  background: var(--teal);
  color: white;
  font-weight: 650;
  text-decoration: none;
}
#refresh-results { margin-top: .8rem; }
#product-status:empty, #customer-status:empty { display: none; }
#product-status, #customer-status { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.pos {
  --teal-accent: #108575;
  --teal-soft: #e7efed;
  --border: #dfe6e3;
  color: #333;
}
.pos .page-title {
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.pos .page-title h1 { font-size: 1.45rem; }
.sale-tabs, .sale-tab-list { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.sale-tabs { flex-wrap: wrap; margin-bottom: .75rem; }
.sale-tab-list { flex-wrap: wrap; }
.sale-tab {
  display: flex;
  border: 1px solid var(--teal-accent);
  border-radius: 3px;
  background: white;
}
.pos .sale-tab button { border: 0; border-radius: 0; color: var(--teal); background: transparent; }
.pos .sale-tab [aria-current="true"] { color: white; background: var(--teal); }
.pos .sale-tab .close-draft { padding-inline: .55rem; }
.pos .add-draft { font-size: 1.2rem; line-height: 1; }
.pos button { min-height: 36px; }
.pos button.outline { border-color: var(--teal-accent); }
.pos button.small { min-height: 30px; }
.pos :is(input, select):focus {
  border-color: var(--teal-accent);
  box-shadow: 0 0 0 3px var(--teal-soft);
}
.pos .panel { border-radius: 3px; }
.pos .panel { box-shadow: 0 2px 8px rgb(19 82 75 / 5%); }
.pos .sale-sidebar {
  align-self: start;
  gap: .55rem;
}
.pos .sale-sidebar .panel { background: #f2f2f2; }
.receipt-banner {
  padding: .72rem;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 3px;
}
.receipt-choice {
  padding: .45rem .6rem;
  color: white;
  background: var(--teal);
  border-radius: 3px;
}
.receipt-choice select { color: var(--teal); border-color: var(--teal-accent); }
.order-fields, .customer-identifiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: .55rem;
  margin: 0;
}
.order-fields > div,
.customer-field { display: flex; align-items: stretch; gap: 0; }
.order-fields dt, .order-fields dd {
  margin: 0;
  padding: .42rem .5rem;
  border: 1px solid var(--border);
  background: #fff;
  font-size: .86rem;
}
.order-fields dt { color: var(--teal); font-weight: 650; }
.order-fields dd { flex: 1; border-left: 0; }
.customer-panel h2 { margin: 0; }
.customer-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.customer-panel details { padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 3px; }
.customer-panel details > :last-child { margin-top: .4rem; }
.customer-panel details select { font-size: .85rem; }
#customer-action-status:empty { display: none; }
#customer-info-content h3 { margin: 0; color: var(--teal); font-size: .95rem; }
.customer-field span {
  display: flex;
  align-items: center;
  padding: .35rem .55rem;
  color: white;
  background: var(--teal);
  border-radius: 3px 0 0 3px;
}
.customer-field input { flex: 1; border-color: var(--teal-accent); border-radius: 0 3px 3px 0; }
.pos table th {
  color: #fff;
  background: var(--teal);
  padding-block: .7rem;
}
.pos table tbody tr:hover { background: #f7faf8; }
.pos table .placeholder { padding: 2.5rem .75rem; }
.pos .table-wrap { border: 1px solid var(--border); border-radius: 3px; }
.pos .table-wrap tbody tr:last-child td { border-bottom: 0; }
.pos .payment { background: #fff; }
.sale-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: .65rem;
  margin-top: .75rem;
}
.sale-footer .total { flex: 0 1 19rem; }
.sale-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.pos .cancel-sale { background: #c4452d; border-color: #c4452d; }
.pos .total {
  padding: .75rem;
  background: var(--teal-soft);
  border: 1px solid #cbded8;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
.pos #product-dialog::backdrop {
  background: rgb(13 61 55 / 38%);
  backdrop-filter: blur(5px);
}

@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .settings-grid { grid-template-columns: 1fr; }
  .identity { font-size: .85rem; gap: .45rem; }
}
