:root {
  --bg: #f4f0e7;
  --bg-soft: #fbf8ef;
  --panel: rgba(255, 253, 247, 0.94);
  --panel-solid: #fffdf7;
  --ink: #1f2a24;
  --muted: #6f766d;
  --line: #e1d8c7;
  --line-strong: #cbbfaa;
  --green: #236448;
  --green-deep: #15291f;
  --green-2: #e5efe5;
  --tea: #7a5832;
  --tea-soft: #f2e8d5;
  --gold: #b07926;
  --red: #b94a48;
  --blue: #315f80;
  --shadow: 0 18px 46px rgba(52, 43, 27, 0.12);
  --shadow-hover: 0 24px 58px rgba(52, 43, 27, 0.17);
  --focus: 0 0 0 4px rgba(176, 121, 38, 0.16);
  --radius: 8px;
  --motion-fast: 150ms;
  --motion: 240ms;
  --motion-slow: 420ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 8%, rgba(176, 121, 38, 0.13), transparent 30%),
    radial-gradient(circle at 18% 18%, rgba(35, 100, 72, 0.12), transparent 34%),
    linear-gradient(135deg, #f7f2e8 0%, #edf3e8 56%, #f9f3e4 100%);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  display: grid;
  grid-template-columns: 264px 1fr;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(122, 88, 50, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 88, 50, 0.035) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(120deg, rgba(0, 0, 0, 0.62), transparent 72%);
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 74% 22%, rgba(222, 188, 108, 0.16), transparent 28%),
    linear-gradient(90deg, rgba(15, 28, 22, 0.52), rgba(12, 21, 17, 0.2) 42%, rgba(9, 16, 13, 0.72)),
    url("assets/login-bg.png") center / cover no-repeat,
    var(--green-deep);
}

.auth-footer {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 18px;
  text-align: center;
  font-size: 13px;
}

.auth-footer a {
  color: rgba(255, 253, 247, 0.82);
  text-decoration: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.auth-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.auth-card {
  width: min(460px, 100%);
  justify-self: end;
  margin-right: min(8vw, 96px);
  padding: 34px;
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 28px 80px rgba(5, 15, 10, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(18px);
}

.auth-brand {
  color: var(--ink);
  border-bottom-color: var(--line);
  margin-bottom: 22px;
}

.auth-brand span {
  color: var(--muted);
}

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

.auth-form h1 {
  font-size: 30px;
  line-height: 1.18;
  color: var(--green-deep);
}

.auth-form small {
  color: var(--muted);
}

.app-locked .sidebar,
.app-locked .shell {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button {
  transition:
    transform var(--motion-fast) var(--ease),
    box-shadow var(--motion) var(--ease),
    background var(--motion) var(--ease),
    border-color var(--motion) var(--ease),
    color var(--motion) var(--ease);
}

button:active {
  transform: translateY(1px) scale(0.99);
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(21, 41, 31, 0.98), rgba(24, 52, 39, 0.96)),
    #17251e;
  color: #f8fbf6;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  box-shadow: 18px 0 40px rgba(24, 37, 30, 0.14);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: block;
  flex: 0 0 48px;
  border-radius: var(--radius);
  object-fit: cover;
  background: #fffdf7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), 0 10px 22px rgba(0, 0, 0, 0.16);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  letter-spacing: 0;
}

.brand span {
  margin-top: 4px;
  color: rgba(248, 251, 246, 0.72);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button,
.ghost {
  border: 0;
  border-radius: var(--radius);
  padding: 11px 12px;
  cursor: pointer;
  text-align: left;
}

.nav button {
  position: relative;
  color: rgba(248, 251, 246, 0.78);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.nav button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(246, 230, 189, 0.16), rgba(255, 255, 255, 0.06));
  opacity: 0;
  transition: opacity var(--motion) var(--ease);
}

.nav button:hover,
.nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav button:hover::before,
.nav button.active::before {
  opacity: 1;
}

.nav button.active {
  box-shadow: inset 3px 0 0 #e6c982;
}

.nav button > * {
  position: relative;
}

.nav .nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: #e8d397;
  font-size: 12px;
  font-weight: 800;
  transition:
    background var(--motion) var(--ease),
    transform var(--motion) var(--ease);
}

.nav button:hover .nav-icon,
.nav button.active .nav-icon {
  background: rgba(246, 230, 189, 0.2);
  transform: translateX(1px);
}

.ghost {
  margin-top: auto;
  color: #f7e8e8;
  background: rgba(185, 74, 72, 0.18);
}

.sidebar-reset {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  line-height: 1.25;
  white-space: normal;
}

.ghost:hover {
  background: rgba(185, 74, 72, 0.28);
}

.shell {
  padding: 30px;
  min-width: 0;
}

.site-footer {
  margin-top: 28px;
  padding: 18px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--green);
  text-decoration: underline;
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 6px 0 2px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--tea);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.16;
}

h2 {
  font-size: 20px;
  line-height: 1.28;
  margin-bottom: 8px;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.today-card,
.panel,
.metric,
.item-card {
  background: var(--panel);
  border: 1px solid rgba(203, 191, 170, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.today-card {
  min-width: 190px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(242, 232, 213, 0.86));
}

.topbar-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.operator-field,
.user-card {
  min-width: 190px;
  padding: 11px 12px;
  background: var(--panel);
  border: 1px solid rgba(203, 191, 170, 0.72);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.user-card span,
.user-card strong {
  display: block;
}

.user-card strong {
  margin: 5px 0 8px;
}

.operator-field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  outline: none;
}

.today-card span,
.metric span,
.panel-title span,
.item-card span {
  color: var(--muted);
  font-size: 13px;
}

.today-card strong,
.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 25px;
  line-height: 1.1;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
  animation: view-in var(--motion-slow) var(--ease) both;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 18px;
  transition:
    transform var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease),
    border-color var(--motion) var(--ease);
}

.metric::after {
  content: "";
  position: absolute;
  right: -36px;
  top: -36px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(176, 121, 38, 0.09);
}

.metric:hover,
.item-card:hover,
.panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(176, 121, 38, 0.42);
}

.metric small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
  transition:
    transform var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease),
    border-color var(--motion) var(--ease);
}

.panel-title,
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.panel-title {
  padding-bottom: 12px;
}

.toolbar {
  margin-bottom: 2px;
}

.toolbar h2,
.panel-title h2 {
  margin-bottom: 5px;
}

.product-toolbar {
  display: block;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

.inline-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  padding: 16px;
  border: 1px dashed rgba(122, 88, 50, 0.34);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(247, 251, 247, 0.9), rgba(242, 232, 213, 0.55));
  animation: view-in var(--motion-slow) var(--ease) both;
}

.inline-section.hidden {
  display: none;
}

.section-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 7px;
  color: #39453c;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d2c9b9;
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  transition:
    border-color var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease),
    background var(--motion) var(--ease),
    transform var(--motion-fast) var(--ease);
}

input:hover,
select:hover {
  border-color: #bfae92;
  background: #fffdf7;
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: var(--focus);
  background: #fff;
}

button.primary {
  border: 0;
  border-radius: var(--radius);
  min-height: 42px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), #2f7654);
  box-shadow: 0 10px 20px rgba(35, 100, 72, 0.18);
  cursor: pointer;
  font-weight: 800;
}

button.primary:hover {
  background: linear-gradient(135deg, #1d573d, #2f7654);
  box-shadow: 0 14px 26px rgba(35, 100, 72, 0.24);
  transform: translateY(-1px);
}

.compact-button {
  padding: 0 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.file-button {
  min-height: 40px;
  border: 1px solid #c7b897;
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--green);
  background: rgba(255, 253, 247, 0.82);
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
}

.file-button input {
  display: none;
}

.wide-label {
  display: block;
  margin-bottom: 12px;
}

button.secondary {
  min-height: 40px;
  border: 1px solid #c7b897;
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--green);
  background: rgba(255, 253, 247, 0.82);
  cursor: pointer;
  font-weight: 800;
}

button.secondary:hover {
  background: var(--tea-soft);
  border-color: var(--gold);
  transform: translateY(-1px);
}

button.text-danger {
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-weight: 800;
  padding: 4px 0;
}

button.text-danger:hover {
  color: #963836;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--gold);
  background: var(--tea-soft);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) 1fr 1fr;
  gap: 14px;
  align-items: end;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sale-order {
  display: grid;
  gap: 16px;
}

.sale-lines-head {
  align-items: center;
}

.sale-line-table {
  min-width: 1040px;
}

.sale-line-table th:first-child,
.sale-line-table td:first-child {
  min-width: 260px;
}

.sale-line-table input,
.sale-line-table select {
  min-width: 120px;
}

.sale-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 4px;
}

.sale-total strong {
  color: var(--green);
  font-size: 23px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  animation: modal-fade var(--motion) var(--ease) both;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 37, 30, 0.5);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(203, 191, 170, 0.82);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: 0 28px 70px rgba(26, 34, 27, 0.26);
  animation: modal-panel-in var(--motion-slow) var(--ease) both;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.settlement-order-panel {
  width: min(1120px, 100%);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.detail-grid > div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(225, 216, 199, 0.9);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.78);
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-grid strong {
  margin-top: 7px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
}

.detail-wide {
  grid-column: span 2;
}

.settlement-detail-table {
  margin: 16px 0;
}

.settlement-amount-grid {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.table-wrap {
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #cdbf9d;
  border-radius: 999px;
  border: 3px solid #fff8ea;
}

.product-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 10px;
}

.product-list-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.product-table {
  width: max-content;
  min-width: 1380px;
}

.product-table th,
.product-table td {
  min-width: 96px;
}

.product-table th:first-child,
.product-table td:first-child {
  min-width: 190px;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4) {
  min-width: 220px;
}

.product-table th:last-child,
.product-table td:last-child {
  min-width: 130px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid rgba(225, 216, 199, 0.82);
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

td small {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

th {
  color: #766d5d;
  background: rgba(242, 232, 213, 0.52);
  font-size: 12px;
  font-weight: 900;
}

tbody tr {
  transition:
    background var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease);
}

tbody tr:hover {
  background: rgba(229, 239, 229, 0.54);
  box-shadow: inset 3px 0 0 rgba(176, 121, 38, 0.45);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--green-2);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  transition:
    transform var(--motion-fast) var(--ease),
    background var(--motion) var(--ease);
}

.tag.gold {
  color: #7a4d10;
  background: #f5ead8;
}

.tag.blue {
  color: var(--blue);
  background: #e0edf4;
}

.tag.red {
  color: var(--red);
  background: #f7e3e3;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.card-grid.compact {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.item-card {
  padding: 16px;
  transition:
    transform var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease),
    border-color var(--motion) var(--ease);
}

.item-card h3 {
  margin: 10px 0 8px;
  font-size: 17px;
}

.item-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 0;
}

.item-card dt {
  color: var(--muted);
  font-size: 12px;
}

.item-card dd {
  margin: 2px 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid rgba(225, 216, 199, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.82);
  transition:
    transform var(--motion) var(--ease),
    border-color var(--motion) var(--ease),
    background var(--motion) var(--ease);
}

.stack-row:hover {
  transform: translateX(2px);
  border-color: rgba(176, 121, 38, 0.42);
  background: #fffdf7;
}

.stack-row strong,
.stack-row span {
  display: block;
}

.stack-row span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.inventory-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.inventory-category-list {
  display: grid;
  gap: 16px;
}

.category-group {
  border: 1px solid rgba(225, 216, 199, 0.86);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 253, 247, 0.82);
  transition:
    transform var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease);
}

.category-group:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(52, 43, 27, 0.1);
}

.category-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(229, 239, 229, 0.9), rgba(242, 232, 213, 0.7));
  border-bottom: 1px solid var(--line);
}

.category-head strong,
.category-head span {
  display: block;
}

.category-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.inventory-item {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(225, 216, 199, 0.78);
  transition: background var(--motion) var(--ease);
}

.inventory-item:hover {
  background: rgba(229, 239, 229, 0.45);
}

.inventory-item:last-child {
  border-bottom: 0;
}

.inventory-item strong,
.inventory-item span {
  display: block;
}

.inventory-name {
  grid-column: 1 / -1;
}

.inventory-item span,
.inventory-field label {
  color: var(--muted);
  font-size: 12px;
}

.inventory-field strong {
  margin-top: 3px;
}

.voided-row {
  color: rgba(31, 42, 36, 0.58);
  background: rgba(247, 227, 227, 0.24);
}

.voided-row strong,
.voided-row td {
  text-decoration-color: rgba(185, 74, 72, 0.38);
}

.voided-note {
  display: inline-flex;
  margin-left: 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.print-report {
  display: none;
}

.print-report h1 {
  font-size: 26px;
}

.print-report h2 {
  margin-top: 22px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, #17251e, #254a37);
  box-shadow: 0 20px 42px rgba(23, 37, 30, 0.22);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition:
    opacity var(--motion) var(--ease),
    transform var(--motion) var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.error {
  background: linear-gradient(135deg, var(--red), #8f3937);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modal-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  body {
    display: block;
    background: #fff;
  }

  body::before,
  .sidebar,
  .topbar,
  .view,
  .site-footer,
  .toast {
    display: none !important;
  }

  .shell {
    padding: 0;
  }

  .print-report {
    display: none;
  }

  .print-report.active-print {
    display: block;
    color: #111;
  }

  .delivery-order-print {
    width: 100%;
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  }

  .delivery-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 16px;
    border-bottom: 3px solid #173022;
  }

  .delivery-brand {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .delivery-mark {
    width: 52px;
    height: 52px;
    display: block;
    object-fit: cover;
    border-radius: 8px;
  }

  .delivery-brand strong,
  .delivery-brand span,
  .delivery-meta span,
  .delivery-meta strong,
  .delivery-customer span,
  .delivery-customer strong {
    display: block;
  }

  .delivery-brand strong {
    font-size: 19px;
  }

  .delivery-brand span,
  .delivery-title p,
  .delivery-meta span,
  .delivery-customer span,
  .delivery-summary span,
  .delivery-signatures span {
    color: #666;
    font-size: 11px;
  }

  .delivery-title {
    text-align: right;
  }

  .delivery-title h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: 0;
  }

  .delivery-title p {
    margin: 4px 0 0;
  }

  .delivery-meta,
  .delivery-customer {
    display: grid;
    gap: 0;
    margin-top: 14px;
    border: 1px solid #222;
  }

  .delivery-meta {
    grid-template-columns: repeat(4, 1fr);
  }

  .delivery-customer {
    grid-template-columns: 1.1fr 1fr 2fr;
    margin-bottom: 16px;
  }

  .delivery-meta > div,
  .delivery-customer > div {
    min-height: 52px;
    padding: 8px 10px;
    border-right: 1px solid #222;
  }

  .delivery-meta > div:last-child,
  .delivery-customer > div:last-child {
    border-right: 0;
  }

  .delivery-meta strong,
  .delivery-customer strong {
    margin-top: 5px;
    font-size: 13px;
  }

  .delivery-table {
    width: 100%;
    border: 1px solid #222;
    border-collapse: collapse;
  }

  .delivery-table th,
  .delivery-table td {
    border: 1px solid #222;
    padding: 8px 7px;
    color: #111;
    font-size: 12px;
    text-align: left;
    white-space: normal;
  }

  .delivery-table th {
    background: #f1f1f1;
    font-weight: 800;
  }

  .delivery-table th:first-child,
  .delivery-table td:first-child {
    width: 40px;
    text-align: center;
  }

  .delivery-table th:nth-child(5),
  .delivery-table th:nth-child(7),
  .delivery-table th:nth-child(8),
  .delivery-table td:nth-child(5),
  .delivery-table td:nth-child(7),
  .delivery-table td:nth-child(8) {
    text-align: right;
  }

  .delivery-summary {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 18px;
    align-items: stretch;
    margin-top: 16px;
  }

  .delivery-summary > div {
    min-height: 72px;
    padding: 10px 12px;
    border: 1px solid #222;
  }

  .delivery-summary p {
    margin: 6px 0 0;
    color: #111;
    font-size: 12px;
    line-height: 1.6;
  }

  .delivery-total {
    text-align: right;
  }

  .delivery-total strong {
    display: block;
    margin-top: 8px;
    font-size: 24px;
  }

  .delivery-signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 28px;
  }

  .delivery-signatures > div {
    height: 54px;
    border-bottom: 1px solid #222;
  }

  .delivery-signatures span {
    display: block;
    padding-bottom: 28px;
  }

  .settlement-print {
    width: 100%;
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  }

  .settlement-print-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 14px;
    border-bottom: 3px solid #173022;
  }

  .settlement-print-head h1 {
    margin: 0;
    font-size: 26px;
  }

  .settlement-print-head p,
  .settlement-print-head span {
    display: block;
    margin: 6px 0 0;
    color: #555;
    font-size: 12px;
  }

  .settlement-print-head > div:last-child {
    text-align: right;
  }

  .settlement-print table {
    width: 100%;
    border: 1px solid #222;
    border-collapse: collapse;
  }

  .settlement-print th,
  .settlement-print td {
    padding: 7px;
    border: 1px solid #222;
    color: #111;
    font-size: 11px;
    text-align: left;
    white-space: normal;
  }

  .settlement-print th {
    background: #f1f1f1;
    font-weight: 800;
  }

  .settlement-summary-table {
    margin-top: 14px;
  }

  .settlement-print h2 {
    margin: 18px 0 8px;
    font-size: 18px;
  }

  .settlement-print-order {
    break-inside: avoid;
    margin-top: 14px;
  }

  .settlement-order-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #222;
    border-bottom: 0;
    background: #f8f8f8;
    color: #111;
    font-size: 12px;
  }

  .settlement-order-info {
    margin-bottom: 8px;
  }

  .settlement-order-info th {
    width: 82px;
  }

  .settlement-print-items th:first-child,
  .settlement-print-items td:first-child {
    width: 38px;
    text-align: center;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    white-space: normal;
    font-size: 12px;
  }
}

@media (max-width: 1080px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .ghost {
    margin-top: 0;
  }

  .metrics,
  .content-grid,
  .inventory-split,
  .report-controls,
  .filter-bar,
  .form-grid,
  .inline-section,
  .card-grid,
  .card-grid.compact {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .panel-title,
  .toolbar,
  .sale-total {
    display: grid;
    justify-content: stretch;
  }

  .today-card {
    min-width: 0;
  }

  .metrics,
  .content-grid,
  .inventory-split,
  .report-controls,
  .filter-bar,
  .form-grid,
  .inline-section,
  .detail-grid,
  .settlement-amount-grid,
  .card-grid,
  .card-grid.compact,
  .nav {
    grid-template-columns: 1fr;
  }

  .detail-wide {
    grid-column: auto;
  }

  .sidebar {
    padding: 18px;
  }

  .modal {
    padding: 14px;
  }

  .modal-head,
  .section-head {
    display: grid;
  }

  h1 {
    font-size: 28px;
  }
}

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

  .metric:hover,
  .item-card:hover,
  .panel:hover,
  .stack-row:hover,
  .category-group:hover,
  button.primary:hover,
  button.secondary:hover {
    transform: none;
  }
}
