:root {
  color-scheme: light;
  --ink: #163128;
  --muted: #65756f;
  --forest: #12372a;
  --forest-soft: #e8f0ec;
  --mint: #c9f06b;
  --mint-strong: #a9dc3f;
  --paper: #fffef9;
  --canvas: #f3f1e9;
  --line: #dfe2d9;
  --danger: #b23a2f;
  --danger-soft: #fff0ed;
  --shadow: 0 12px 32px rgba(22, 49, 40, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--forest);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
select:not(:disabled),
input:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(169, 220, 63, 0.7);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-screen {
  display: grid;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  place-items: center;
  background:
    radial-gradient(circle at 12% 14%, rgba(201, 240, 107, 0.18), transparent 27%),
    radial-gradient(circle at 88% 86%, rgba(255, 255, 255, 0.08), transparent 30%),
    var(--forest);
}

.auth-card {
  display: grid;
  width: min(100%, 980px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(4, 21, 15, 0.28);
}

.auth-intro {
  position: relative;
  display: flex;
  min-height: 270px;
  padding: 30px 26px 24px;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background: #194534;
  isolation: isolate;
}

.auth-intro::before,
.auth-intro::after {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(201, 240, 107, 0.24);
  border-radius: 50%;
  content: "";
}

.auth-intro::before {
  top: -145px;
  right: -95px;
  width: 330px;
  height: 330px;
}

.auth-intro::after {
  right: 28px;
  bottom: -98px;
  width: 210px;
  height: 210px;
  background: rgba(201, 240, 107, 0.04);
}

.auth-brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 24px;
  border-radius: 15px;
  place-items: center;
  color: var(--forest);
  background: var(--mint);
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(6, 25, 18, 0.22);
}

.auth-overline {
  margin: 0;
  color: #8da29a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.auth-intro .auth-overline {
  color: rgba(255, 255, 255, 0.62);
}

.auth-intro h1 {
  max-width: 520px;
  margin: 8px 0 0;
  font-size: clamp(29px, 7.8vw, 46px);
  line-height: 1.14;
  letter-spacing: -0.055em;
}

.auth-description {
  max-width: 430px;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  line-height: 1.7;
}

.auth-feature-list {
  display: flex;
  gap: 7px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.auth-feature-list span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 700;
}

.auth-feature-list b {
  margin-right: 6px;
  color: var(--mint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.auth-form-panel {
  padding: 30px 24px 26px;
}

.auth-form-heading h2 {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.auth-form-heading > p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 24px 0 20px;
  padding: 4px;
  border-radius: 13px;
  background: #edf0eb;
}

.auth-tab {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  color: #718078;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.auth-tab.is-active {
  color: var(--forest);
  background: #fff;
  box-shadow: 0 3px 10px rgba(22, 49, 40, 0.08);
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-field {
  display: grid;
  gap: 7px;
  color: #344c43;
  font-size: 12px;
  font-weight: 800;
}

.auth-field > input,
.password-input-wrap {
  width: 100%;
  min-height: 50px;
  border: 1px solid #d7ddd7;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
}

.auth-field > input,
.password-input-wrap input {
  padding: 0 14px;
  font-size: 16px;
}

.auth-field > input::placeholder,
.password-input-wrap input::placeholder {
  color: #a1aaa5;
}

.auth-field > input:focus,
.password-input-wrap:focus-within {
  border-color: #6d8a7e;
  outline: 3px solid rgba(169, 220, 63, 0.24);
}

.auth-field > input:focus,
.password-input-wrap input:focus {
  outline: 0;
}

.password-input-wrap {
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-radius: inherit;
  flex: 1;
  background: transparent;
}

.password-toggle {
  min-height: 38px;
  margin-right: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  color: #547064;
  background: #eef2ee;
  font-size: 11px;
  font-weight: 800;
}

.auth-submit {
  min-height: 52px;
  margin-top: 3px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--forest);
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 12px 22px rgba(18, 55, 42, 0.18);
  transition: transform 120ms ease, background 120ms ease;
}

.auth-submit:hover {
  background: #194a38;
}

.auth-submit:active {
  transform: scale(0.99);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.68;
}

.auth-switch-copy,
.auth-storage-note,
.auth-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.auth-switch-copy button {
  padding: 0;
  border: 0;
  color: #315f4e;
  background: transparent;
  font-weight: 850;
}

.auth-message {
  margin-top: 15px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #7b261f;
  background: var(--danger-soft);
  font-weight: 750;
}

.auth-message.is-success {
  color: #315522;
  background: #edf7e4;
}

.auth-storage-note {
  margin-top: 18px;
  color: #929c97;
  font-size: 10px;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  padding-bottom: calc(94px + env(safe-area-inset-bottom));
  background: var(--canvas);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 154px;
  padding: calc(26px + env(safe-area-inset-top)) 20px 28px;
  color: #fff;
  background: var(--forest);
}

.app-header h1 {
  margin: 3px 0 0;
  font-size: clamp(30px, 9vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app-header .eyebrow {
  color: rgba(255, 255, 255, 0.64);
}

.header-action {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 700;
}

.header-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.current-user {
  width: 100%;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 750;
  text-align: right;
}

.current-user::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--mint);
  content: "";
  box-shadow: 0 0 0 3px rgba(201, 240, 107, 0.14);
}

.header-signout {
  border-color: transparent;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
}

.app-shell > main {
  width: min(100%, 760px);
  margin: -16px auto 0;
  padding: 0 14px 24px;
}

.sheet-card,
.progress-card,
.filter-panel {
  border: 1px solid rgba(22, 49, 40, 0.05);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.sheet-card {
  position: relative;
  z-index: 1;
  padding: 21px 18px 18px;
}

.section-heading-row,
.product-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.section-heading-row h2,
.product-heading-row h2,
.progress-card h2 {
  margin: 4px 0 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.save-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #476158;
  background: var(--forest-soft);
  font-size: 12px;
  font-weight: 700;
}

.save-status::before {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #4d9a6d;
  content: "";
}

.save-status.is-saving::before {
  animation: pulse 0.8s infinite alternate;
}

.field-stack + .field-stack {
  margin-top: 14px;
}

.field-label {
  display: block;
  margin: 0 0 7px 2px;
  color: #53645e;
  font-size: 13px;
  font-weight: 700;
}

.field-stack input,
.field-stack select {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  font-weight: 650;
  appearance: none;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 17px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #66766f;
  border-bottom: 2px solid #66766f;
  pointer-events: none;
  content: "";
  transform: translateY(-70%) rotate(45deg);
}

.select-wrap select {
  padding-right: 44px;
}

.new-sheet-button {
  width: 100%;
  min-height: 46px;
  margin-top: 16px;
  border: 1px dashed #b8c3bc;
  border-radius: 13px;
  color: #40564e;
  background: #f7f8f4;
  font-size: 14px;
  font-weight: 750;
}

.progress-card {
  margin-top: 12px;
  padding: 19px 18px 17px;
  color: #fff;
  background: var(--forest);
  box-shadow: none;
}

.progress-card .section-kicker,
.progress-note {
  color: rgba(255, 255, 255, 0.62);
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.progress-card h2 {
  font-size: 24px;
}

.piece-total {
  min-width: 92px;
  text-align: right;
}

.piece-total span {
  display: block;
  color: var(--mint);
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.piece-total small {
  display: block;
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.progress-track {
  height: 8px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--mint);
  transition: width 180ms ease-out;
}

.progress-note {
  margin: 9px 0 0;
  font-size: 12px;
}

.filter-panel {
  margin-top: 12px;
  padding: 20px 16px 16px;
}

.product-heading-row {
  margin-bottom: 16px;
}

.result-count {
  flex: 0 0 auto;
  padding-top: 19px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.search-box > span {
  flex: 0 0 auto;
  margin-right: 9px;
  color: #718078;
  font-size: 25px;
  line-height: 1;
  transform: rotate(-20deg);
}

.search-box input {
  min-width: 0;
  min-height: 48px;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  color: #5c6d65;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.category-list {
  display: flex;
  gap: 8px;
  margin: 14px -16px 0;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.category-list::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #53645e;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  scroll-snap-align: start;
}

.category-chip[aria-pressed="true"] {
  border-color: var(--forest);
  color: #fff;
  background: var(--forest);
}

.filled-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 62px;
  margin-top: 12px;
  padding: 10px 2px 0;
  border-top: 1px solid #eceee8;
  cursor: pointer;
}

.filled-toggle strong,
.filled-toggle small {
  display: block;
}

.filled-toggle strong {
  font-size: 14px;
}

.filled-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.filled-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: #cdd3ce;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(22, 49, 40, 0.2);
  content: "";
  transition: transform 160ms ease;
}

.filled-toggle input:checked + .switch {
  background: var(--forest);
}

.filled-toggle input:checked + .switch::after {
  transform: translateX(20px);
}

.filled-toggle input:focus-visible + .switch {
  outline: 3px solid rgba(169, 220, 63, 0.7);
  outline-offset: 2px;
}

.product-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 13px;
  min-height: 126px;
  padding: 16px;
  border: 1px solid rgba(22, 49, 40, 0.07);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 0 5px 16px rgba(22, 49, 40, 0.045);
  transition: border-color 140ms ease, background 140ms ease;
}

.product-card.is-filled {
  border-color: #b9d084;
  background: #fefff9;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.product-code {
  color: #6d7b75;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.product-category {
  padding: 3px 7px;
  border-radius: 999px;
  color: #3e574d;
  background: var(--forest-soft);
  font-size: 10px;
  font-weight: 750;
}

.product-price {
  padding: 3px 7px;
  border-radius: 999px;
  color: #5a4c16;
  background: #f2eab9;
  font-size: 10px;
  font-weight: 800;
}

.product-name {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.product-spec {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.quantity-field {
  display: block;
}

.quantity-label {
  display: block;
  margin-bottom: 6px;
  color: #718078;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.quantity-input {
  width: 82px;
  height: 58px;
  padding: 0 7px;
  border: 1.5px solid #c9d0ca;
  border-radius: 14px;
  outline: 0;
  color: var(--forest);
  background: #fff;
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}

.quantity-input::placeholder {
  color: #9ba69f;
  font-size: 13px;
  font-weight: 650;
}

.quantity-input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 4px rgba(18, 55, 42, 0.08);
}

.product-card.is-filled .quantity-input {
  border-color: var(--mint-strong);
  background: #fbfff1;
}

.loading-state,
.empty-state,
.error-state {
  margin-top: 12px;
  padding: 34px 20px;
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--paper);
  text-align: center;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 650;
}

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mint-strong);
  animation: pulse 0.8s infinite alternate;
}

.empty-mark,
.confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 13px;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: var(--forest-soft);
  font-size: 20px;
  font-weight: 800;
}

.empty-state h2,
.error-state h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.empty-state p,
.error-state p {
  margin: 8px auto 0;
  max-width: 360px;
  font-size: 13px;
  line-height: 1.6;
}

.empty-state button,
.error-state button {
  min-height: 44px;
  margin-top: 16px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--forest);
  font-weight: 700;
}

.error-state {
  border: 1px solid #f0c7c0;
  background: var(--danger-soft);
}

.action-bar {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 0.68fr 1fr 1.35fr;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(22, 49, 40, 0.1);
  background: rgba(255, 254, 249, 0.94);
  box-shadow: 0 -10px 28px rgba(22, 49, 40, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.button {
  min-height: 50px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
}

.button-subtle {
  border: 1px solid transparent;
  color: var(--danger);
  background: var(--danger-soft);
}

.button-secondary {
  border: 1px solid #cdd3ce;
  color: var(--forest);
  background: #fff;
}

.button-primary {
  border: 1px solid var(--forest);
  color: #fff;
  background: var(--forest);
}

.button-danger {
  border: 1px solid var(--danger);
  color: #fff;
  background: var(--danger);
}

.button:active,
.header-action:active,
.new-sheet-button:active,
.category-chip:active {
  transform: translateY(1px);
}

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(10, 26, 20, 0.55);
  backdrop-filter: blur(2px);
}

.sheet-dialog {
  width: min(100%, 760px);
  max-width: none;
  max-height: min(82vh, 760px);
  margin: auto auto 0;
  padding: 9px 14px calc(18px + env(safe-area-inset-bottom));
  overflow: hidden auto;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--canvas);
}

.sheet-dialog[open] {
  animation: slide-up 180ms ease-out;
}

.dialog-handle {
  width: 38px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #c4c9c4;
}

.dialog-header {
  position: sticky;
  z-index: 2;
  top: -9px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -14px;
  padding: 15px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 241, 233, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dialog-header h2 {
  margin: 3px 0 0;
  font-size: 22px;
}

.dialog-close {
  min-height: 42px;
  padding: 0 8px;
  border: 0;
  color: #2d6950;
  background: transparent;
  font-size: 15px;
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.history-card {
  padding: 16px;
  border: 1px solid rgba(22, 49, 40, 0.07);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.history-card.is-current {
  border-color: #a5c453;
}

.history-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-date {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-dealer {
  margin: 4px 0 0;
  font-size: 17px;
}

.history-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #52655d;
  background: var(--forest-soft);
  font-size: 11px;
  font-weight: 750;
}

.history-status.is-saved {
  color: #5b4b12;
  background: #f4eab6;
}

.history-summary {
  margin-top: 13px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #52635c;
  background: #f4f5f0;
  font-size: 12px;
  line-height: 1.5;
}

.history-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.history-actions button {
  min-height: 44px;
  border: 1px solid #cdd3ce;
  border-radius: 12px;
  color: var(--forest);
  background: #fff;
  font-size: 13px;
  font-weight: 750;
}

.history-open {
  border-color: var(--forest) !important;
  color: #fff !important;
  background: var(--forest) !important;
}

.history-empty {
  padding: 50px 20px;
  color: var(--muted);
  text-align: center;
}

.confirm-dialog {
  width: min(calc(100% - 32px), 420px);
  padding: 25px 20px 20px;
  border: 0;
  border-radius: 22px;
  background: var(--paper);
  text-align: center;
  box-shadow: var(--shadow);
}

.confirm-dialog[open] {
  animation: pop-in 150ms ease-out;
}

.confirm-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 21px;
}

.confirm-dialog p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 20px;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 16px;
  max-width: 480px;
  margin: 0 auto;
  padding: 13px 16px;
  border-radius: 13px;
  color: #fff;
  background: rgba(18, 55, 42, 0.96);
  box-shadow: 0 12px 30px rgba(18, 55, 42, 0.24);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  animation: toast-in 160ms ease-out;
}

@keyframes pulse {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(24px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pop-in {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 640px) {
  .auth-screen {
    padding: 32px;
  }

  .auth-card {
    grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);
  }

  .auth-intro {
    min-height: 650px;
    padding: 42px 36px 34px;
  }

  .auth-intro h1 {
    margin-top: 14px;
  }

  .auth-feature-list {
    display: grid;
    gap: 9px;
  }

  .auth-feature-list span {
    width: fit-content;
  }

  .auth-form-panel {
    display: flex;
    padding: 48px clamp(36px, 6vw, 68px) 34px;
    flex-direction: column;
    justify-content: center;
  }

  .app-header {
    padding-right: max(24px, calc((100vw - 720px) / 2));
    padding-left: max(24px, calc((100vw - 720px) / 2));
  }

  .app-shell > main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .sheet-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
  }

  .section-heading-row,
  .new-sheet-button {
    grid-column: 1 / -1;
  }

  .field-stack + .field-stack {
    margin-top: 0;
  }

  .product-list {
    grid-template-columns: 1fr 1fr;
  }

  .action-bar {
    right: max(20px, calc((100vw - 720px) / 2));
    bottom: 16px;
    left: max(20px, calc((100vw - 720px) / 2));
    padding: 9px;
    border: 1px solid rgba(22, 49, 40, 0.1);
    border-radius: 18px;
  }
}

@media (min-width: 960px) {
  .auth-card {
    grid-template-columns: 42% 58%;
  }

  .app-header {
    min-height: 138px;
    padding-right: max(24px, calc((100vw - 1140px) / 2));
    padding-left: max(24px, calc((100vw - 1140px) / 2));
  }

  .app-shell > main {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    align-items: start;
    gap: 16px;
    width: min(100%, 1180px);
    padding-right: 20px;
    padding-left: 20px;
  }

  .desktop-sidebar {
    position: sticky;
    top: 16px;
    min-width: 0;
  }

  .inventory-workspace {
    min-width: 0;
  }

  .sheet-card {
    display: block;
  }

  .sheet-card .field-stack + .field-stack {
    margin-top: 14px;
  }

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

  .action-bar {
    right: max(20px, calc((100vw - 1140px) / 2));
    left: max(20px, calc((100vw - 1140px) / 2));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
