:root {
  color-scheme: light;
  --text: #182e26;
  --muted: #4f655b;
  --body: #f3f6f4;
  --line: #dce6df;
  --accent: #175a45;
  --surface: #fff;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--body);
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; line-height: 1.5 }
.wrap { width: min(100% - 2rem, 58rem); margin-inline: auto }
.top { background: #e9f0eb; border-bottom: 1px solid var(--line) }
.brand { display: flex; align-items: center; gap: .65rem; min-height: 3.8rem; font-weight: 700 }
.mark { width: 1.75rem; height: 1.75rem; border-radius: .4rem; background: var(--accent); position: relative }
.mark::after { content: ""; position: absolute; inset: .45rem .37rem; background: repeating-linear-gradient(90deg, #fff 0 1px, transparent 1px 3px, #fff 3px 5px, transparent 5px 7px) }
main { padding: 2.3rem 0 3rem }
h1, h2, p { margin: 0 }
h1 { font-size: clamp(2rem, 6vw, 3.05rem); line-height: 1.13; letter-spacing: -.045em }
h2 { font-size: 1.25rem; line-height: 1.25; letter-spacing: -.018em }
p { color: var(--muted) }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem }
.page-head p { margin-top: .4rem }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1.55rem 0 .85rem }
.stats div, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem }
.stats div { padding: .85rem 1.15rem }
.stats span { color: var(--muted); display: block; font-size: .875rem }
.stats strong { font-size: 1.65rem; font-variant-numeric: tabular-nums }
.panel { margin-bottom: .85rem; padding: 1.2rem }
.scan p { margin-top: .35rem }
#scan-form { display: flex; align-items: stretch; gap: .55rem; margin-top: .9rem }
input, textarea, button { font: inherit }
input, textarea { border: 1px solid #b9cbc0; border-radius: .5rem; color: inherit; padding: .62rem .75rem; background: #fff }
input { flex: 1; min-width: 0 }
textarea { display: block; width: 100%; resize: vertical; margin-top: .45rem }
button { border: 1px solid var(--accent); border-radius: .5rem; background: var(--accent); color: #fff; cursor: pointer; padding: .6rem .85rem; font-weight: 650; min-height: 2.75rem }
button:hover { filter: brightness(.92) }
button:disabled { opacity: .49; cursor: default; filter: none }
.owner-login { display: grid; gap: .6rem; max-width: 25rem; margin-top: 1rem }
.owner-login button { justify-self: start }
.link-button { border: 0; background: transparent; color: var(--accent); text-decoration: underline; padding-inline: 0 }
.secondary { background: #f2f7f4; border-color: #c8d9cf; color: #234b3d }
:focus-visible { outline: 3px solid #3b9073; outline-offset: 2px }
.status:not(:empty) { border-radius: .45rem; padding: .55rem .7rem; background: #eef4f0; margin: .7rem 0 0 }
.status[data-kind="error"]:not(:empty) { color: #802f20; background: #fbeee9 }
.status[data-kind="success"]:not(:empty) { color: #175740; background: #e5f4eb }
.empty { padding: 1.4rem 0 .2rem }
table { width: 100%; border-collapse: collapse; margin-top: .8rem }
td, th { text-align: left; padding: .6rem .35rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums }
th { color: var(--muted); font-size: .875rem }
.undo { margin-top: .9rem }
dialog { width: min(100% - 1.5rem, 32rem); border: 1px solid var(--line); border-radius: .85rem; padding: 1rem; color: var(--text) }
dialog::backdrop { background: #142b2577 }
dialog label { display: block; margin-top: .85rem }
dialog button[type="submit"] { margin-top: .75rem }
.viewfinder { margin-top: .8rem; position: relative; background: #13221c; border-radius: .55rem; overflow: hidden }
video { display: block; width: 100%; height: min(46vh, 23rem); object-fit: contain }
.viewfinder span { position: absolute; width: 70%; height: 2px; top: 50%; left: 15%; background: #55e4b5; box-shadow: 0 0 12px #31e9a6 }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap }
@media (max-width: 40rem) {
  main { padding-top: 1.4rem }
  .page-head { align-items: flex-start; flex-direction: column }
  .stats { gap: .4rem }
  .stats div, .panel { padding: .75rem }
  .stats span { min-height: 2.6em }
  #scan-form { display: grid; grid-template-columns: 1fr 1fr }
  #barcode { width: 100% }
  #scan-form { grid-template-columns: minmax(0, 1fr) minmax(5.75rem, auto) }
  td, th { font-size: .875rem }
}

#excel-file { display: block; width: 100%; margin-top: .45rem }
#excel-file::file-selector-button { font: inherit; color: var(--accent); background: #eef5f0; border: 1px solid var(--line); border-radius: .3rem; padding: .25rem .5rem; margin-right: .5rem; cursor: pointer }
.file-help { margin-top: .45rem; font-size: .875rem }
#manual-list { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .65rem }
#manual-list summary { color: var(--accent); cursor: pointer }

.record-actions, .camera-actions { display: flex; flex-wrap: wrap; gap: .5rem }
.camera-actions { margin-top: .75rem }
.table-scroll { overflow-x: auto }
#returns td:first-child { white-space: nowrap }
#returns td:nth-child(2) { overflow-wrap: anywhere; min-width: 6rem }
@media (max-width: 32rem) {
  .records .section-head { flex-wrap: wrap }
}

.scan-quantity { display: flex; align-items: center; gap: .4rem; font-weight: 650 }
.scan-quantity input { width: 5.3rem; font-weight: 400 }
@media (max-width: 40rem) {
  .scan-quantity { gap: .3rem }
  .scan-quantity input { width: 4.5rem }
}

.camera-actions .scan-quantity { display: flex; margin: 0 }
.camera-actions button { max-width: 100% }

.reset-help, .reset-actions { margin-top: .75rem }
.reset-actions button[type="submit"] { margin-top: 0 }

#list-dialog { width: min(100% - 1.5rem, 42rem) }
.excel-source { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap }
.excel-source > div { flex: 1 1 16rem; min-width: 0 }
.template-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  color: var(--accent);
  font-weight: 650;
}
.excel-preview { margin-top: 1rem; border: 1px solid var(--line); border-radius: .55rem; overflow: hidden }
.excel-preview .section-head { padding: .6rem .75rem; gap: .5rem; flex-wrap: wrap }
.excel-preview h3 { margin: 0; font-size: .95rem }
.excel-preview .file-help { margin: 0 }
.excel-preview table { margin: 0; table-layout: fixed }
.excel-preview thead { background: #eef5f0 }
.excel-preview th, .excel-preview td { padding: .48rem .75rem; overflow-wrap: anywhere }
.excel-preview th:first-child { width: 9.75rem }
.excel-preview tbody tr:nth-child(even) { background: #f8faf9 }
.excel-preview tbody tr:last-child td { border-bottom: 0 }
@media (max-width: 30rem) {
  .excel-preview th:first-child { width: 8rem }
}

.camera-tools { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; margin-top: .65rem }
.camera-tools label { margin: 0; flex: 1 1 12rem; min-width: 0 }
.camera-tools select {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .5rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: white;
  color: inherit;
  font: inherit;
}
.camera-tools button[aria-pressed="true"] { color: #fff; background: var(--accent) }
.camera-browser { display: inline-block; margin-top: .65rem; color: var(--accent); font-weight: 650 }

#scan-form { align-items: center }
#open-camera {
  background: #1749ad;
  border-color: #1749ad;
  color: #fff;
  min-height: 3.5rem;
  min-width: 11rem;
  padding-inline: .95rem;
  font-size: 1.05rem;
}
@media (max-width: 40rem) {
  #add, #open-camera { grid-column: 1 / -1 }
  #open-camera { min-height: 3.75rem }
}

#products-dialog { width: min(100% - 1.5rem, 50rem) }
#product-search-form { display: flex; gap: .55rem; margin-top: .8rem }
#product-search-form button { margin-top: 0 }
.catalog-scroll { max-height: min(50vh, 30rem); overflow: auto; margin-top: .65rem }
.catalog-scroll table { margin: 0 }
.catalog-scroll th { position: sticky; top: 0; background: #eef5f0 }
.catalog-scroll th, .catalog-scroll td { padding-inline: .6rem }
.catalog-scroll td:first-child { white-space: nowrap }
.catalog-scroll td:nth-child(2) { overflow-wrap: anywhere }
.catalog-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .75rem }
.catalog-nav p { font-size: .875rem; font-variant-numeric: tabular-nums }

.connection-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .85rem }
.connection-tools .status:not(:empty) { margin: 0 }

.workspace-entry { margin-top: 1rem }
.welcome-panel { max-width: 34rem; margin: 2.5rem auto; padding: clamp(1rem, 4vw, 2rem) }
.welcome-panel p { margin: .75rem 0 1rem }
.workspace-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: .65rem }
.workspace-toolbar label { display: grid; gap: .3rem; flex: 1 1 13rem; max-width: 26rem }
.workspace-toolbar select {
  width: 100%; min-height: 2.75rem; font: inherit; color: var(--text); background: white;
  border: 1px solid #b9cbc0; border-radius: .5rem; padding: .45rem .65rem;
}
.workspace-toolbar a { color: var(--accent); align-self: center; padding: .35rem }
.action-link {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: .6rem .85rem;
  background: var(--accent); color: white; border-radius: .5rem; font-weight: 650; text-decoration: none;
}
#count-name { width: 100%; margin-top: .4rem }
#application { padding-top: 1.3rem }

#share-url { width: 100%; margin: .3rem 0 .65rem }
#enable-share { margin-top: .75rem }
#shared-count-name { margin-right: auto }

#share-dialog { width: min(100% - 1.5rem, 50rem) }
.staff-section { border-block: 1px solid var(--line); margin-top: 1rem; padding: .9rem 0 }
.staff-section h3, .general-share-title { margin: 0 }
.general-share-title { margin-top: 1rem }
#staff-form { display: flex; gap: .55rem; margin: .65rem 0 }
#staff-form button { margin: 0 }
.staff-actions button { margin: .12rem .2rem .12rem 0 }
#staff-copy-url { width: 100% }

#organize-dialog { width: min(100% - 1.5rem, 42rem) }
.organize-sections { display: grid; gap: .85rem; margin-top: 1rem }
.organize-sections section { border: 1px solid var(--line); border-radius: .55rem; padding: .65rem .8rem }
.organize-sections h3 { margin: 0; font-size: 1rem }
.organize-sections ul { list-style: none; padding: 0; margin: .35rem 0 0 }
.organize-sections li { display: flex; gap: .6rem; justify-content: space-between; flex-wrap: wrap; align-items: center; padding: .45rem 0 }
.organize-sections li + li { border-top: 1px solid var(--line) }
.organize-sections li > span { overflow-wrap: anywhere }

#empty-trash { margin-top: .8rem; color: #8e2224; border-color: #e4b9b9 }
