:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #eef2ea;
  --text: #17211b;
  --muted: #68736b;
  --line: #dce4dc;
  --accent: #24735a;
  --accent-dark: #15543f;
  --warn: #a55d12;
  --danger: #a13333;
  --shadow: 0 12px 30px rgba(20, 38, 28, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  max-width: 520px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding: 18px 14px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.1;
  font-weight: 760;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.closing-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.closing-panel label {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}

.closing-progress {
  flex: 0 0 auto;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--warn);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.closing-progress.complete {
  background: #edf7f1;
  color: var(--accent-dark);
}

.closing-panel input {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  text-transform: uppercase;
}

.ghost-button,
.section-title button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 650;
  padding: 0 12px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.status-strip button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 10px;
  color: var(--text);
  text-align: left;
}

.status-strip button.active {
  border-color: var(--accent);
  background: #edf7f1;
}

.status-strip strong {
  display: block;
  font-size: 21px;
  line-height: 1;
}

.status-strip span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sync-strip {
  margin: -4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 9px 10px;
  font-size: 12px;
}

.sync-strip.online {
  border-color: #b9dbc9;
  background: #edf7f1;
  color: var(--accent-dark);
}

.sync-strip.pending {
  border-color: #ead5ad;
  background: #fff7e8;
  color: var(--warn);
}

.sync-strip.error {
  border-color: #edc0bd;
  background: #fdeceb;
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  min-height: 38px;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 650;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.search-row {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 4px 0 12px;
  background: var(--bg);
}

.search-row input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 12px;
}

.action-row button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-dark);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.search-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 115, 90, 0.12);
}

.product-list {
  display: grid;
  gap: 8px;
}

.product-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px;
  text-align: left;
}

.product-row.counted {
  border-color: #b9dbc9;
  background: #f4fbf7;
}

.product-main {
  min-width: 0;
}

.product-name {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.product-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: var(--surface-strong);
  padding: 0 8px;
}

.product-meta .low {
  color: var(--danger);
  background: #f7e7e4;
}

.product-meta .done {
  color: var(--accent-dark);
  background: #dff1e8;
}

.count-box {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef7f2;
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 760;
}

.count-wrap {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
}

.movement-badge {
  min-width: 44px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--warn);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.log-panel {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2 {
  font-size: 16px;
}

.log-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.log-item {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.log-item:first-child {
  border-top: 0;
  padding-top: 0;
}

dialog {
  width: min(92vw, 440px);
  border: 0;
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(12, 20, 16, 0.38);
}

.dialog-card {
  padding: 16px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-card h2 {
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.2;
}

.dialog-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-today-log {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
}

.dialog-today-log div {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
}

.dialog-today-log strong {
  color: var(--accent-dark);
}

.dialog-today-log em {
  font-style: normal;
  color: var(--muted);
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
}

.quantity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.quantity-grid button,
.primary-wide {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 760;
}

.quantity-grid button:first-child {
  background: var(--danger);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.field input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.field select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

#movementStaff {
  text-transform: uppercase;
}

.primary-wide {
  width: 100%;
  margin-top: 10px;
}

@media (min-width: 760px) {
  .app-shell {
    max-width: 980px;
  }

  .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
