:root {
  --bg: #f5f5f1;
  --paper: #fff;
  --ink: #232923;
  --muted: #596358;
  --line: #d6dcd1;
  --accent: #a4422c;
  --dark: #2e3930;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
[hidden],
.sprite {
  display: none !important;
}
.header {
  min-height: 72px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(24px, calc((100vw - 1120px) / 2));
}
.wordmark {
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -1.1px;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark span {
  font-size: 16px;
  letter-spacing: 0;
  font-weight: 400;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  margin-left: 18px;
}
.account-area {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}
.text-button {
  border: 0;
  background: none;
  min-height: 44px;
  padding: 8px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-button:hover {
  text-decoration-thickness: 2px;
}
main {
  width: min(1120px, 100% - 48px);
  margin: 0 auto 36px;
}
.navigation {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.navigation button {
  min-height: 56px;
  padding: 12px 22px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  font-weight: 600;
}
.navigation .active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
#nav-count {
  font-size: 13px;
  font-weight: 400;
  margin-left: 7px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
h1 {
  font-size: 27px;
  letter-spacing: -0.7px;
  line-height: 1.2;
  margin: 0;
  font-weight: 500;
}
h2 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 24px;
}
#connection {
  font-size: 13px;
  color: var(--muted);
}
.shelf-card {
  background: var(--dark);
  color: #fff;
  padding: 17px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: 20px;
}
.shelf-card > div {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}
.shelf-label {
  font-size: 16px;
  color: #dce4d8;
}
.shelf-card strong {
  font-size: 36px;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
  min-width: 0;
}
.shelf-card button {
  color: #fff;
  border: 1px solid #92a08d;
  background: transparent;
  min-height: 44px;
  padding: 8px 14px;
  white-space: nowrap;
  font-size: 14px;
}
.shelf-card button:hover {
  background: #ffffff12;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.entry-card,
.recent-card,
.user-form {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 26px;
}
.entry-card label:not(.sound-setting),
dialog label {
  display: block;
  font-weight: 600;
  margin: 0 0 9px;
}
input:not([type='checkbox']),
select {
  height: 52px;
  min-width: 0;
  width: 100%;
  border: 1px solid #aab4a4;
  background: #fff;
  border-radius: 3px;
  padding: 10px 13px;
  font-size: 17px;
  color: var(--ink);
}
input::placeholder {
  color: #6b7667;
  opacity: 1;
}
.article-input {
  display: flex;
  gap: 9px;
  align-items: stretch;
}
.article-input input {
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 0;
  flex: 1;
  width: 0;
}
.article-input button {
  background: #f0f2ea;
  border: 1px solid #aab4a4;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 13px;
  font-size: 15px;
  color: var(--ink);
}
.hint {
  font-size: 14px;
  color: var(--muted);
  margin: 10px 0 22px;
  line-height: 1.6;
}
.quantity-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.stepper {
  display: flex;
  border: 1px solid #aab4a4;
  border-radius: 3px;
  overflow: hidden;
}
.stepper button {
  border: 0;
  width: 49px;
  background: #f0f2ea;
  font-size: 27px;
  min-height: 54px;
}
.stepper input {
  border: 0 !important;
  border-left: 1px solid var(--line) !important;
  border-right: 1px solid var(--line) !important;
  border-radius: 0 !important;
  text-align: center;
  width: 88px;
  font-size: 24px;
  height: 54px;
  appearance: textfield;
  -moz-appearance: textfield;
  padding: 5px;
}
.stepper input::-webkit-inner-spin-button {
  appearance: none;
}
.add-ten {
  background: none;
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 3px;
  margin-left: auto;
}
.primary,
.secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  min-height: 52px;
  padding: 12px 18px;
  width: 100%;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
}
.primary {
  background: var(--accent);
  color: #fff;
}
.primary:hover {
  background: #873722;
}
.secondary {
  background: #fff;
  border-color: #aab4a4;
  color: var(--ink);
}
.secondary:hover {
  background: #f0f2ea;
}
.sound-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  margin-top: 17px;
  min-height: 36px;
  cursor: pointer;
}
.sound-setting input {
  width: 19px;
  height: 19px;
  accent-color: var(--accent);
  margin: 0;
}
.article-total {
  padding: 10px 13px;
  background: #edf3e8;
  color: #3e5938;
  font-size: 15px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-heading h2 {
  margin: 0;
}
.recent-entry {
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.recent-details {
  min-width: 0;
}
.recent-details strong {
  font-weight: 600;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.recent-details p {
  font-size: 14px;
  color: var(--muted);
  margin: 5px 0 0;
}
.recent-quantity {
  font-size: 23px;
  white-space: nowrap;
}
.recent-quantity span {
  font-size: 14px;
}
.empty-state {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.stats {
  display: flex;
  gap: 10px 20px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
  font-size: 14px;
  color: var(--muted);
}
.stats strong {
  font-weight: 600;
  color: var(--ink);
}
.overview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.search-label {
  flex: 1;
  min-width: 230px;
  font-size: 15px;
  font-weight: 600;
}
.search-label input {
  margin-top: 7px;
}
.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  background: #fff;
}
.segmented button {
  border: 0;
  background: none;
  min-height: 44px;
  padding: 9px 18px;
}
.segmented .selected {
  background: var(--dark);
  color: white;
}
.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 15px;
  white-space: nowrap;
}
th {
  font-size: 14px;
  padding: 14px 16px;
  background: #ecefe7;
  font-weight: 600;
}
td {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
td.article-cell {
  font-weight: 600;
}
.delete-button,
.row-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  padding: 8px 12px;
  font-size: 14px;
}
.delete-button {
  color: var(--accent);
}
.delete-button svg {
  width: 19px;
  height: 19px;
}
.own-tag,
.status {
  display: inline-block;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 3px;
  background: #e9f0e2;
  color: #365a2d;
  margin-left: 8px;
}
.status {
  margin: 0;
}
.status.inactive {
  background: #f1e8e3;
  color: #7d3d29;
}
.login-panel {
  background: #fff;
  border: 1px solid var(--line);
  max-width: 470px;
  margin: 72px auto;
  padding: 32px;
}
.login-panel h1 {
  margin-bottom: 20px;
}
.login-panel > p {
  color: var(--muted);
  margin-bottom: 24px;
}
.login-panel .error {
  color: #9e3023;
}
.intro {
  margin: 0 0 20px;
  color: var(--muted);
}
.user-form {
  margin-bottom: 25px;
}
.user-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}
.user-fields label {
  font-weight: 600;
  font-size: 15px;
}
.user-fields input,
.user-fields select {
  display: block;
  margin-top: 7px;
}
.optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 23px;
}
.form-actions > button {
  width: auto;
}
.form-actions .primary {
  min-width: 210px;
}
.error {
  color: #a02f24;
  font-size: 15px;
}
.error:empty {
  display: none;
}
.user-email {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 8px;
}
.row-button.danger {
  color: var(--accent);
}
dialog {
  width: calc(100% - 32px);
  max-width: 460px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 20px 90px #0002;
}
dialog::backdrop {
  background: #18251dd0;
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
}
.dialog-top h2 {
  margin: 0;
}
dialog input {
  margin-bottom: 22px;
}
.icon-button {
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
}
.dialog-actions {
  display: flex;
  gap: 12px;
}
.dialog-actions > * {
  flex: 1;
}
.video-wrap {
  position: relative;
  aspect-ratio: 1;
  background: #222e23;
  overflow: hidden;
}
.video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-frame {
  position: absolute;
  border: 2px solid #fff9;
  inset: 20%;
  pointer-events: none;
}
.scan-frame:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 2px solid #f39473;
}
#scanner-status {
  font-size: 15px;
}
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #304c2d;
  color: white;
  padding: 16px 22px;
  z-index: 20;
  box-shadow: 0 5px 25px #0002;
  max-width: calc(100% - 28px);
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 3px;
}
.toast.error {
  background: #912f23;
}
.saved-flash {
  animation: flash 0.6s;
}
@keyframes flash {
  50% {
    box-shadow: inset 0 0 0 3px #6b8c54;
  }
}
@media (max-width: 850px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  .article-input button span {
    display: none;
  }
  .entry-card,
  .recent-card {
    padding: 20px;
  }
  .recent-details strong {
    font-size: 16px;
  }
  .stats {
    gap: 8px 14px;
  }
  .account-area {
    gap: 9px;
  }
  .wordmark {
    font-size: 24px;
  }
  .wordmark span {
    margin-left: 10px;
    padding-left: 12px;
  }
  .stepper input {
    width: 72px;
  }
}
@media (max-width: 650px) {
  .header {
    padding: 10px 16px;
    min-height: 64px;
    gap: 10px;
  }
  .wordmark {
    font-size: 23px;
  }
  .wordmark span {
    display: none;
  }
  .account-area {
    font-size: 13px;
    gap: 7px;
  }
  #user-name {
    max-width: 105px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .account-area button {
    font-size: 13px;
    padding: 6px;
  }
  main {
    width: calc(100% - 32px);
    margin-bottom: 25px;
  }
  .navigation {
    margin-bottom: 17px;
  }
  .navigation button {
    min-height: 52px;
    padding: 11px 17px;
    font-size: 16px;
  }
  .page-heading {
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
  }
  h1 {
    font-size: 25px;
  }
  #connection {
    font-size: 12px;
  }
  .workspace {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .shelf-card {
    padding: 14px 17px;
    margin-bottom: 16px;
  }
  .shelf-card > div {
    gap: 12px;
  }
  .shelf-card strong {
    font-size: 33px;
  }
  .shelf-card button {
    padding: 8px 11px;
    font-size: 13px;
  }
  .entry-card,
  .recent-card,
  .user-form {
    padding: 20px;
  }
  .entry-card h2 {
    display: none;
  }
  .entry-card label:not(.sound-setting) {
    font-size: 17px;
  }
  .article-input input {
    font-size: 22px;
  }
  .article-input button {
    min-width: 54px;
    padding: 10px;
  }
  .hint {
    font-size: 14px;
    margin-bottom: 20px;
  }
  .quantity-row {
    gap: 11px;
    margin-bottom: 22px;
  }
  .stepper input {
    width: 80px;
  }
  .primary {
    min-height: 54px;
    font-size: 17px;
  }
  .sound-setting {
    margin-top: 14px;
  }
  .recent-card h2 {
    font-size: 19px;
  }
  .recent-details p {
    font-size: 14px;
  }
  .login-panel {
    margin: 35px auto;
    padding: 25px;
  }
  .segmented {
    width: 100%;
  }
  .segmented button {
    flex: 1;
    padding: 8px 13px;
  }
  .overview-toolbar {
    gap: 14px;
  }
  .search-label {
    width: 100%;
  }
  .table-wrap {
    max-width: 100%;
  }
  td,
  th {
    padding: 12px;
  }
  .user-fields {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .form-actions > button {
    width: 100%;
  }
  .user-form h2 {
    font-size: 20px;
  }

  .toast {
    bottom: 14px;
    width: max-content;
    font-size: 15px;
    padding: 14px 17px;
  }
  dialog {
    padding: 22px;
  }
  dialog h2 {
    font-size: 21px;
  }
}
@media (max-width: 360px) {
  .wordmark {
    font-size: 21px;
  }
  .account-area {
    gap: 2px;
  }
  #user-name {
    max-width: 75px;
  }
  .navigation button {
    padding: 11px 13px;
  }
  .stepper input {
    width: 64px;
  }
  .stepper button {
    width: 42px;
  }
  .shelf-card > div {
    gap: 8px;
  }
  .shelf-card strong {
    font-size: 28px;
  }
  .entry-card {
    padding: 16px;
  }
  .quantity-row {
    gap: 8px;
  }
  .add-ten {
    padding: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
  }
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  font-size: 16px;
  font-weight: 600;
}
.zoom-control input[type='range'] {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 44px;
  padding: 0;
  accent-color: var(--accent);
  border: 0;
  background: transparent;
}
.zoom-control output {
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
