:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #f0f4ef;
  --ink: #20231f;
  --muted: #667063;
  --line: #dfe5dc;
  --primary: #23715a;
  --primary-strong: #185741;
  --accent: #b04b2f;
  --amber: #a86b12;
  --danger: #b42318;
  --shadow: 0 14px 30px rgba(28, 36, 30, 0.08);
  --shadow-soft: 0 8px 22px rgba(27, 39, 31, 0.08);
  --shadow-card: 0 18px 38px rgba(28, 36, 30, 0.1);
  --radius: 10px;
  --radius-lg: 14px;
  --success: #1d7a55;
  --blue: #2e5aac;
  --purple: #6a4fb3;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -10%, rgba(35, 113, 90, 0.12), transparent 34%),
    linear-gradient(180deg, #fbfcfa 0%, #f4f6f2 44%, #eef2ed 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

body.auth-mode .shell {
  display: none;
}

body:not(.auth-mode) #authRoot {
  display: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(35, 113, 90, 0.12), transparent 40%),
    linear-gradient(315deg, rgba(176, 75, 47, 0.1), transparent 34%),
    var(--bg);
}

.auth-card {
  width: min(1030px, 100%);
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(27, 39, 31, 0.12);
}

.auth-copy {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
  padding: 38px 34px;
  border: 1px solid rgba(28, 70, 49, 0.14);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(243, 248, 244, 0.9)),
    linear-gradient(135deg, #f7faf5 0%, #eef5ef 52%, #e7f0e8 100%);
  color: #15261d;
}

.auth-copy::after {
  content: none;
}

.auth-copy > * {
  position: relative;
  z-index: 1;
}

.auth-logo {
  width: min(430px, 100%);
  max-height: 126px;
  object-fit: contain;
  object-position: left center;
  margin: 0 0 30px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  filter: drop-shadow(0 10px 20px rgba(6, 20, 12, 0.08));
}

.auth-mark {
  width: 112px;
  height: 112px;
  object-fit: contain;
  margin: 0 0 18px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  filter: drop-shadow(0 12px 20px rgba(2, 12, 7, 0.28));
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--primary-strong);
  font-size: 12px;
  text-transform: uppercase;
}

.auth-copy h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.2;
}

.auth-copy h1 span {
  display: block;
}

.auth-copy p {
  max-width: 410px;
  margin: 0;
  color: #435247;
  font-size: 16px;
  line-height: 1.65;
}

.auth-note {
  width: 100%;
  max-width: 430px;
  margin-top: 22px;
  padding: 9px 12px;
  border: 1px solid rgba(35, 113, 90, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: #2f4438;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 26px;
}

.auth-metrics span {
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(35, 113, 90, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #425247;
}

.auth-metrics strong {
  display: block;
  margin-bottom: 6px;
  color: #15241c;
  font-size: 17px;
}

.auth-panel {
  align-self: center;
  width: 100%;
  padding: 12px 8px;
}

.auth-panel-title {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.auth-panel-title strong {
  font-size: 26px;
  letter-spacing: 0;
}

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

.auth-panel .stack-form {
  gap: 12px;
}

.auth-panel input {
  min-height: 46px;
}

.auth-panel .primary {
  min-height: 48px;
  margin-top: 2px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 5px;
  border-radius: 8px;
  background: var(--surface-2);
}

.auth-tabs button {
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 4px 12px rgba(28, 36, 30, 0.08);
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-tabs button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.settings-tabs button.active,
.settings-tabs button:hover {
  background: var(--primary);
  color: #fff;
}

.shell {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #1c2620;
  color: #f8fbf7;
}

.brand {
  display: grid;
  gap: 9px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo {
  width: 100%;
  height: 74px;
  object-fit: contain;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: none;
}

.brand-logo-wide {
  padding: 10px;
  border: 1px solid rgba(29, 77, 55, 0.12);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 247, 243, 0.94));
  box-shadow: 0 12px 22px rgba(3, 15, 9, 0.16);
}

.brand strong {
  color: #f4fbf6;
  font-size: 15px;
  line-height: 1.25;
}

.brand strong span {
  display: block;
  color: #ffffff;
  font-size: inherit;
}

.brand > span {
  color: #b8c7be;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 16px;
  padding-bottom: 160px;
  overflow-y: auto;
  max-height: calc(100vh - 156px);
}

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

.nav-label {
  display: block;
  margin: 0 2px 1px;
  color: #91a397;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nav button {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  background: transparent;
  color: #dfe8e1;
  text-align: left;
  font-weight: 700;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav button.active,
.nav button:hover {
  background: #2b3b31;
  color: #ffffff;
}

.nav button:hover {
  transform: translateX(2px);
}

.user-box {
  position: absolute;
  right: 22px;
  bottom: 22px;
  left: 22px;
  display: grid;
  gap: 10px;
}

.user-card {
  padding: 12px;
  border-radius: 8px;
  background: #111914;
}

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

.user-card small {
  margin-top: 4px;
  color: #b8c7be;
}

.badge {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 8px;
  background: #e5f4ec;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
}

.logout {
  width: 100%;
  background: #25352b;
  color: #fff;
  border-color: #425549;
}

.main {
  min-width: 0;
  padding: 26px;
}

.main.view-enter {
  animation: viewEnter 0.22s ease-out;
}

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

.hero-band,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-band {
  min-height: 142px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #213027;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-band .eyebrow {
  color: #bfe0cc;
}

.hero-band h1,
.toolbar h1 {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.25;
}

.hero-band p,
.toolbar p {
  margin: 0;
  color: var(--muted);
}

.hero-band p {
  color: #d5e3da;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary,
.ghost,
.icon {
  min-height: 40px;
  border-radius: 8px;
}

.primary {
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.primary:hover {
  background: var(--primary-strong);
}

.ghost {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.ghost.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.quick-products {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.quick-products > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.quick-products > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.danger {
  color: var(--danger);
}

.icon {
  width: 40px;
  background: #fff4f2;
  font-size: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat {
  min-height: 112px;
  padding: 16px;
}

.stat span,
.stat small {
  display: block;
  color: var(--muted);
}

.stat strong {
  display: block;
  margin: 10px 0;
  font-size: 24px;
}

.compact-stats {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 0;
}

.compact-stats .stat {
  min-height: 94px;
  padding: 14px;
}

.compact-stats .stat strong {
  font-size: 20px;
}

.month-panel {
  border-top: 4px solid var(--primary);
}

.month-select {
  width: auto;
  min-width: 160px;
  background: #fff;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  margin-bottom: 18px;
  padding: 18px;
}

.form-panel {
  border-top: 4px solid var(--primary);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.check-row {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.table-scroll {
  max-height: 560px;
  overflow: auto;
}

.statement-panel {
  border-top: 4px solid var(--primary);
}

.statement-table table {
  min-width: 920px;
  table-layout: fixed;
}

.statement-table th,
.statement-table td {
  padding: 9px 10px;
}

.statement-table th:nth-child(1),
.statement-table td:nth-child(1) {
  width: 104px;
}

.statement-table th:nth-child(2),
.statement-table td:nth-child(2) {
  width: 92px;
}

.statement-table th:nth-child(3),
.statement-table td:nth-child(3) {
  width: 190px;
}

.statement-table th:nth-child(9),
.statement-table td:nth-child(9) {
  width: 96px;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #415047;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.type-sale {
  background: #e9f2ff;
  color: #1d4f8f;
}

.type-payment {
  background: #e5f4ec;
  color: #176044;
}

.type-return {
  background: #fff0ed;
  color: #9d2a1e;
}

.type-purchase {
  background: #f0ebff;
  color: #5a3a9d;
}

.type-expense {
  background: #fff3dc;
  color: #87550c;
}

.type-neutral {
  background: var(--surface-2);
  color: #415047;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-active {
  background: #e8f5ee;
  color: #1d6749;
}

.status-void {
  background: #f1f2ee;
  color: #7b8279;
  text-decoration: line-through;
}

.price-table {
  margin-top: 16px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  border-spacing: 0;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  color: #415047;
  font-size: 13px;
  white-space: nowrap;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.empty-inline {
  color: var(--muted);
  font-size: 13px;
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.summary-line span {
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

td.actions {
  display: table-cell;
  width: 112px;
  white-space: nowrap;
}

td.actions .ghost,
td.actions .primary,
td.actions .icon {
  margin: 0 6px 6px 0;
}

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

.warn-row {
  background: #fff5d8;
}

.muted-row {
  color: #89928b;
  text-decoration: line-through;
}

.amount-danger {
  color: var(--danger);
  font-weight: 800;
}

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

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

.wide {
  grid-column: 1 / -1;
}

.double {
  grid-column: span 2;
}

label,
.stack-form {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(35, 113, 90, 0.2);
  border-color: var(--primary);
}

.search {
  max-width: 320px;
}

.item-head,
.item-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 88px 88px 118px 120px 44px;
  gap: 10px;
  align-items: center;
}

.purchase-head,
.purchase-item {
  grid-template-columns: minmax(220px, 2fr) 88px 88px 118px 150px 44px;
}

.product-picker {
  display: grid;
  grid-template-columns: minmax(120px, 0.85fr) minmax(160px, 1.15fr);
  gap: 8px;
}

.customer-picker {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.1fr);
  gap: 8px;
}

.customer-results {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.customer-results:empty {
  display: none;
}

.customer-results button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.customer-results button:hover {
  background: var(--surface-2);
}

.customer-results small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.customer-result-count {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.customer-no-result {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.settings-list-panel {
  align-self: start;
}

.settings-list-scroll {
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.settings-list-scroll table {
  min-width: 620px;
}

.item-head {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.item-row {
  margin-bottom: 10px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.stack-form {
  gap: 10px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

hr {
  height: 1px;
  margin: 20px 0;
  border: 0;
  background: var(--line);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 8px;
  background: #1b241f;
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
}

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

.toast.error {
  background: var(--danger);
}

#printArea {
  display: none;
}

.invoice {
  color: #111;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

.invoice header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 3px solid #111;
}

.invoice h1 {
  margin: 0;
  font-size: 24px;
}

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

.invoice-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.invoice header p {
  margin: 6px 0 0;
  color: #333;
}

.invoice-no {
  display: grid;
  gap: 4px;
  text-align: right;
}

.invoice-no strong {
  font-size: 22px;
}

.invoice-no span {
  font-size: 13px;
}

.invoice-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 18px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid #222;
}

.invoice-meta span {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
}

.invoice-meta b {
  font-weight: 700;
}

.invoice table {
  min-width: 0;
}

.invoice-product {
  font-weight: 700;
}

.invoice-summary,
.invoice-sign {
  display: grid;
  gap: 10px;
}

.invoice-summary {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
}

.invoice-summary div {
  min-height: 54px;
  padding: 8px;
  border: 1px solid #222;
}

.invoice-summary span,
.invoice-summary strong {
  display: block;
}

.invoice-summary strong {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
}

.invoice-sign {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
}

.invoice-sign span {
  min-height: 44px;
  padding-top: 18px;
  border-bottom: 1px solid #222;
}

.invoice-note {
  margin: 12px 0 0;
}

/* Polished desktop skin */
.sidebar {
  overflow: hidden;
  background:
    radial-gradient(circle at 28px 24px, rgba(86, 166, 124, 0.24), transparent 26%),
    linear-gradient(180deg, #16281f 0%, #111d17 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06), 12px 0 34px rgba(17, 29, 23, 0.14);
}

.brand {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 9px;
  margin-bottom: 20px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand::before {
  content: none;
  position: absolute;
  top: 16px;
  left: 16px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #78d6a5;
  box-shadow: 0 0 0 5px rgba(120, 214, 165, 0.13);
}

.brand strong,
.brand span {
  padding-left: 0;
}

.brand strong {
  margin-top: 0;
  color: #fff;
  font-size: 15px;
  line-height: 1.18;
}

.brand > span {
  grid-column: auto;
  font-size: 12px;
}

.nav {
  gap: 14px;
  padding-right: 2px;
}

.nav::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.settings-list-scroll::-webkit-scrollbar,
.customer-results::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.nav::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb,
.settings-list-scroll::-webkit-scrollbar-thumb,
.customer-results::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(29, 61, 45, 0.28);
  background-clip: content-box;
}

.nav-group {
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.025);
}

.nav-label {
  margin: 0 8px 3px;
  color: #9fb8aa;
  letter-spacing: 0;
}

.nav button {
  position: relative;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #dce8df;
}

.nav button::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 7px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.18s ease, transform 0.18s ease;
}

.nav button.active {
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(44, 122, 91, 0.82), rgba(34, 74, 55, 0.88));
  color: #fff;
  box-shadow: 0 10px 22px rgba(3, 15, 9, 0.2);
}

.nav button.active::before {
  background: #b9f4d2;
}

.nav button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.user-card,
.logout {
  border-radius: var(--radius);
}

.main {
  padding: 28px;
}

.main.view-enter {
  animation: viewEnter 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sectionEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-section:not(.hidden),
.panel,
.stat {
  animation: sectionEnter 0.24s ease-out;
}

.toolbar {
  min-height: 76px;
  padding: 4px 4px 10px;
}

.toolbar h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.toolbar p {
  color: #66756a;
}

.hero-band {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(120, 214, 165, 0.14), transparent 34%),
    linear-gradient(115deg, #173225 0%, #1d3b2d 62%, #2c5a44 100%);
  box-shadow: var(--shadow-card);
}

.hero-band::before {
  content: none;
}

.hero-band::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -100px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.hero-band > * {
  position: relative;
  z-index: 1;
}

.hero-logo {
  display: none;
}

.stats {
  gap: 14px;
}

.stat {
  position: relative;
  overflow: hidden;
  border-color: rgba(38, 76, 55, 0.12);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 249, 0.96));
  box-shadow: var(--shadow-soft);
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), rgba(35, 113, 90, 0.16));
}

.stat:nth-child(2n)::before {
  background: linear-gradient(90deg, var(--blue), rgba(46, 90, 172, 0.14));
}

.stat:nth-child(3n)::before {
  background: linear-gradient(90deg, var(--amber), rgba(168, 107, 18, 0.14));
}

.stat strong {
  letter-spacing: 0;
}

.panel {
  border-color: rgba(38, 76, 55, 0.12);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 253, 250, 0.96));
  box-shadow: var(--shadow-soft);
}

.panel:hover {
  box-shadow: var(--shadow-card);
}

.form-panel,
.statement-panel,
.month-panel {
  border-top: 0;
  box-shadow: inset 0 3px 0 var(--primary), var(--shadow-soft);
}

.panel-head {
  min-height: 42px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(33, 63, 47, 0.08);
}

.panel-head h2 {
  font-size: 19px;
  letter-spacing: 0;
}

.panel-head small {
  color: var(--muted);
}

.primary,
.ghost,
.icon,
.chip {
  border-radius: var(--radius);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.primary {
  min-height: 44px;
  background: linear-gradient(135deg, #287e63, #1e624c);
  box-shadow: 0 9px 18px rgba(35, 113, 90, 0.18);
}

.primary:hover,
.ghost:hover,
.chip:hover {
  transform: translateY(-1px);
}

.ghost {
  min-width: 74px;
  background: linear-gradient(180deg, #fff, #fafcf9);
}

.ghost.small {
  min-width: 58px;
  min-height: 34px;
}

.danger.ghost,
.ghost.danger {
  border-color: #f2d8d4;
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(38, 76, 55, 0.1);
  border-radius: var(--radius);
  background: #fff;
}

.table-scroll,
.settings-list-scroll {
  max-height: min(62vh, 620px);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom-color: rgba(34, 65, 47, 0.1);
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #eef5ef, #e8f0e9);
  color: #2e4438;
  font-weight: 800;
}

tbody tr {
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

tbody tr:hover {
  background: #f7fbf8;
  box-shadow: inset 3px 0 0 rgba(35, 113, 90, 0.24);
}

.money-cell,
.amount-danger {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-danger {
  color: #c12a1d;
}

.muted-row {
  background: #fafafa;
  color: #8a918b;
}

.muted-row td {
  text-decoration: line-through;
}

.warn-row {
  background: #fff7df;
}

.action-cell,
.actions {
  text-align: center;
  white-space: nowrap;
}

.empty {
  padding: 34px 18px;
  color: #718076;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(246, 249, 246, 0.84), rgba(255, 255, 255, 0.84));
}

.empty::before {
  content: "暂无数据";
  display: block;
  margin-bottom: 4px;
  color: #435147;
  font-weight: 800;
}

.type-pill,
.status-pill,
.badge {
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.status-active {
  background: #e4f5ec;
  color: #196345;
}

.status-void {
  background: #eef0ed;
  color: #6f7a71;
}

label,
.stack-form {
  font-weight: 700;
}

input,
select {
  min-height: 44px;
  border-color: rgba(34, 65, 47, 0.16);
  border-radius: var(--radius);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:hover,
select:hover {
  border-color: rgba(35, 113, 90, 0.42);
}

input:focus,
select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(35, 113, 90, 0.12);
}

input[type="file"] {
  padding: 8px;
  border-style: dashed;
  background: #fbfdfb;
}

.search {
  max-width: 360px;
  padding-left: 34px;
  background:
    linear-gradient(transparent, transparent),
    #fff;
  background-image:
    radial-gradient(circle at 16px 50%, transparent 5px, transparent 6px);
}

.table-tools {
  align-items: center;
  padding: 2px 0;
}

.settings-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  border-color: rgba(38, 76, 55, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
}

.settings-tabs button {
  position: relative;
  border-radius: var(--radius);
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.settings-tabs button.active,
.settings-tabs button:hover {
  background: linear-gradient(135deg, #2a7e63, #1f634d);
  box-shadow: 0 8px 18px rgba(35, 113, 90, 0.16);
  transform: translateY(-1px);
}

.item-row,
.purchase-item {
  padding: 10px;
  border: 1px solid rgba(38, 76, 55, 0.1);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfdfb);
}

.item-head {
  padding: 0 10px;
}

.customer-results {
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.customer-results button:hover {
  background: #eef7f1;
}

.toast {
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

@media (max-width: 1180px) {
  .stats {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: auto;
  }

  .auth-note {
    max-width: none;
    white-space: normal;
  }

  .auth-metrics {
    grid-template-columns: 1fr;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
    max-height: none;
    padding-bottom: 0;
  }

  .nav-label {
    text-align: center;
  }

  .nav button {
    padding: 0 8px;
    text-align: center;
    font-size: 13px;
  }

  .user-box {
    position: static;
    margin-top: 14px;
  }

  .main {
    padding: 16px;
  }

  .hero-band,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-band h1,
  .toolbar h1 {
    font-size: 22px;
  }

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

  .form-grid,
  .form-grid.compact {
    grid-template-columns: 1fr;
  }

  .double {
    grid-column: 1;
  }

  .item-head {
    display: none;
  }

  .item-row,
  .purchase-item {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
  }

  .item-row select,
  .purchase-item select,
  .product-picker,
  .sale-line-total {
    grid-column: 1 / -1;
  }

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

  .item-row .icon {
    justify-self: end;
  }

  .row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    max-width: none;
  }
}

@media (max-width: 500px) {
  .auth-page {
    padding: 12px;
  }

  .auth-card {
    padding: 14px;
  }

  .auth-copy h1 {
    font-size: 28px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .nav {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media print {
  body {
    background: #fff;
  }

  .shell,
  #authRoot,
  .toast {
    display: none !important;
  }

  #printArea {
    display: block;
    padding: 8mm;
  }

  @page {
    size: A4;
    margin: 10mm;
  }

  th,
  td {
    padding: 8px;
    border: 1px solid #222;
  }
}
