:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --line: #dfe3dc;
  --line-strong: #c7cec2;
  --text: #20251f;
  --muted: #687064;
  --accent: #176b5b;
  --accent-dark: #0f4d42;
  --warm: #b66a28;
  --danger: #a64233;
  --shadow: 0 16px 45px rgba(38, 45, 36, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.app-stage {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  width: calc(100vw / var(--ui-scale, 1));
  height: calc(100vh / var(--ui-scale, 1));
  min-height: calc(100vh / var(--ui-scale, 1));
  transform: scale(var(--ui-scale, 1));
  transform-origin: top left;
  overflow: hidden;
  transition: transform .18s ease;
  will-change: transform;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff8dd;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 200, 87, .1), transparent 0 20%, transparent 42%),
    linear-gradient(135deg, #06110f 0%, #0d251f 50%, #071613 100%);
  opacity: 1;
  transition: opacity .82s ease, visibility .82s ease;
}

.app-ready .splash-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-booting .sidebar,
.app-booting .shell,
.app-booting .login-screen {
  opacity: 0;
}

.splash-orbit {
  position: absolute;
  width: min(62vw, 660px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 248, 221, .1);
  border-radius: 50%;
  opacity: .78;
  box-shadow:
    inset 0 0 36px rgba(255, 200, 87, .05),
    0 0 80px rgba(255, 200, 87, .06);
  animation: splashOrbit 11s linear infinite, splashOrbitBreathe 4.8s ease-in-out infinite;
}

.splash-orbit::before,
.splash-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.splash-orbit::before {
  inset: 13%;
  border: 1px solid rgba(255, 200, 87, .16);
  box-shadow: 0 0 42px rgba(255, 200, 87, .08);
}

.splash-orbit::after {
  top: 3%;
  left: 50%;
  width: 11px;
  height: 11px;
  background: #ffc857;
  box-shadow: 0 0 30px rgba(255, 200, 87, .78);
}

.splash-card {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(84vw, 620px);
  padding: 0 20px;
  background: transparent;
  box-shadow: none;
  animation: splashRise 1.35s cubic-bezier(.2, .8, .2, 1) both;
}

.splash-logo {
  position: relative;
  display: block;
  letter-spacing: 0;
  text-shadow: 0 16px 44px rgba(0, 0, 0, .36);
}

.splash-logo::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 56%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 200, 87, .9), transparent);
  transform: translateX(-50%) scaleX(.2);
  transform-origin: center;
  animation: splashUnderline 5.8s ease-in-out both;
}

.splash-logo span {
  display: block;
  color: #fff8dd;
  font-family: "STZhongsong", "Microsoft YaHei", "PingFang SC", serif;
  font-size: clamp(54px, 8vw, 86px);
  font-weight: 950;
  line-height: 1;
  background: linear-gradient(100deg, #fff8dd 0%, #fffaf0 38%, #ffc857 55%, #fff8dd 72%, #f5d98d 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: splashLogoShine 4.8s ease-in-out infinite;
}

.splash-card p {
  margin: 38px 0 30px;
  color: rgba(255, 248, 221, .86);
  font-size: 18px;
  font-weight: 500;
}

.app-version,
.sidebar-version {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(23, 107, 91, .18);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.splash-card .app-version {
  margin-top: 18px;
  border-color: rgba(255, 248, 221, .18);
  padding: 4px 10px;
  color: rgba(255, 248, 221, .68);
}

.login-brand-panel .app-version {
  margin-top: 10px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, .68);
}

.sidebar-version {
  margin-top: 5px;
  padding: 2px 8px;
  background: #eef5ef;
}

.splash-loader {
  width: min(64vw, 360px);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 248, 221, .12);
  box-shadow: 0 0 24px rgba(255, 200, 87, .16);
}

.splash-loader i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #ffc857, #fff8dd);
  animation: splashLoading 2.6s ease-in-out infinite;
}

@keyframes splashRise {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splashLogoShine {
  0% {
    background-position: 0% center;
  }
  55% {
    background-position: 100% center;
  }
  100% {
    background-position: 100% center;
  }
}

@keyframes splashUnderline {
  0% {
    opacity: 0;
    transform: translateX(-50%) scaleX(.2);
  }
  34% {
    opacity: 1;
    transform: translateX(-50%) scaleX(1);
  }
  to {
    opacity: .72;
    transform: translateX(-50%) scaleX(.88);
  }
}

@keyframes splashOrbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes splashOrbitBreathe {
  0%,
  100% {
    filter: brightness(.92);
  }
  50% {
    filter: brightness(1.2);
  }
}

@keyframes splashLoading {
  from {
    transform: translateX(-105%);
  }
  to {
    transform: translateX(245%);
  }
}

@media (max-width: 620px) {
  .splash-card {
    width: calc(100vw - 36px);
    padding: 0 14px;
  }

  .splash-logo span {
    font-size: 48px;
  }

  .splash-card p {
    max-width: 280px;
    text-align: center;
    font-size: 15px;
  }

  .splash-orbit {
    width: 86vw;
  }
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #fbfcf9;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
}

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

.brand span, .operator span, .eyebrow, label {
  color: var(--muted);
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 12px;
  text-align: left;
  color: #394037;
  background: transparent;
}

.nav-item:hover {
  background: #eef2eb;
}

.nav-item.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(23, 107, 91, .22);
}

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

.operator strong {
  display: block;
  margin-top: 3px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 3px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.top-actions, .toolbar, .customer-head, .subtotal {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scale-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86);
}

.scale-control button {
  min-width: 30px;
  height: 28px;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--accent);
  background: #edf5ef;
  font-weight: 800;
}

.scale-control button:hover {
  background: #dcece3;
}

.scale-control span {
  min-width: 66px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.primary, .secondary, .ghost, .export-btn {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

.save-state {
  color: var(--muted);
  font-size: 12px;
}

.toolbar-action {
  align-self: flex-end;
}

.view-root {
  display: grid;
  gap: 14px;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions button {
  padding: 0;
  color: var(--accent);
  background: transparent;
}

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

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

.segmented {
  align-self: flex-end;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0f2ee;
}

.segmented button {
  min-height: 30px;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 2px 8px rgba(32, 37, 31, .08);
}

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

.reconcile-card {
  padding: 20px;
}

.reconcile-card dl {
  margin: 0;
}

.reconcile-card dl div,
.difference {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.reconcile-card dt {
  color: var(--muted);
}

.reconcile-card dd {
  margin: 0;
  font-weight: 700;
}

.reconcile-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.reconcile-card input,
.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--text);
  background: #fff;
}

.difference {
  margin-bottom: 14px;
}

.difference.matched strong {
  color: var(--accent);
}

.dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: transparent;
}

.dialog::backdrop {
  background: rgba(23, 29, 24, .46);
  backdrop-filter: blur(2px);
}

.dialog-card {
  margin: 0;
  padding: 22px;
  background: #fff;
}

.dialog-card.compact {
  max-width: 560px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.dialog-head h2 {
  margin-bottom: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--muted);
  background: #f0f2ee;
  font-size: 22px;
  line-height: 1;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
}

.form-hint {
  margin: -4px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--accent-dark);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.form-hint.empty {
  display: none;
}

.form-hint button {
  min-height: 28px;
  margin-left: 10px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: none;
}

.reverse-cost {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: #fbf8ed;
}

.reverse-cost .secondary {
  min-height: 38px;
  box-shadow: none;
}

.reverse-cost span {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .continue-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(32, 91, 66, 0.16);
  border-radius: 14px;
  background: #f2f7ec;
  color: var(--text);
  font-weight: 800;
}

.form-grid .continue-entry input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.repair-dialog {
  width: min(1040px, calc(100vw - 28px));
}

.repair-card {
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
}

.repair-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.repair-toolbar label {
  display: grid;
  gap: 6px;
}

.repair-toolbar input,
.repair-toolbar select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--text);
  background: #fff;
}

.repair-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.repair-summary article {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7faf4;
}

.repair-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.repair-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.repair-list {
  display: grid;
  gap: 12px;
  min-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.repair-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdf8;
  overflow: hidden;
}

.repair-item-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #f0f6ed;
}

.repair-item-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.repair-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.repair-fields label {
  display: grid;
  gap: 6px;
}

.repair-fields input,
.repair-fields textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
}

.repair-fields textarea {
  min-height: 74px;
  resize: vertical;
}

@media (max-width: 760px) {
  .repair-toolbar,
  .repair-summary,
  .repair-fields {
    grid-template-columns: 1fr;
  }
}

.primary, .export-btn {
  color: #fff;
  background: var(--accent);
}

.primary:hover, .export-btn:hover {
  background: var(--accent-dark);
}

.secondary {
  color: var(--accent-dark);
  background: #e8f0ec;
}

.ghost {
  color: var(--muted);
  background: #eef1eb;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

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

.panel {
  padding: 18px;
}

.toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-export-card {
  display: grid;
  gap: 0;
}

.summary-export-copy {
  border-bottom: 1px solid var(--line);
}

.summary-export-copy h2 {
  margin-bottom: 3px;
}

.summary-export-copy p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
}

.summary-export-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px 18px;
}

.summary-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 180px));
  align-items: end;
  gap: 10px;
}

.summary-range .field {
  min-width: 0;
}

.summary-buttons {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.summary-buttons button {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 16px;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 190px;
}

.field.wide {
  min-width: 260px;
}

input {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(23, 107, 91, .16);
  border-color: var(--accent);
}

.bill-groups {
  display: grid;
  gap: 14px;
}

.customer-block {
  overflow: hidden;
}

.customer-head {
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.customer-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.export-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.bill-layer + .bill-layer {
  border-top: 1px solid var(--line-strong);
}

.layer-head {
  min-height: 46px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8faf7;
}

.pending-layer .layer-head {
  border-left: 3px solid var(--warm);
}

.paid-layer .layer-head {
  border-left: 3px solid var(--accent);
}

.layer-head div {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.layer-head b {
  font-size: 14px;
}

.layer-empty {
  padding: 18px 16px;
  color: var(--muted);
  background: var(--surface);
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: #556052;
  font-size: 12px;
  font-weight: 600;
  background: #f3f5f1;
}

td.num, th.num {
  text-align: right;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  color: var(--accent-dark);
  background: #e7f3ee;
}

.status.pending {
  color: var(--warm);
  background: #f8ece0;
}

.status.overdue {
  color: var(--danger);
  background: #f8e7e4;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #eef1ec;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(410px, 100%);
  display: grid;
  gap: 20px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-card label {
  display: grid;
  gap: 6px;
}

.login-card input {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 12px;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
}

.login-options label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-options input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

.login-button {
  min-height: 42px;
}

.form-error {
  min-height: 20px;
  margin: -10px 0;
  color: var(--danger);
  font-size: 12px;
}

.text-button {
  margin-top: 8px;
  padding: 0;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
}

.category-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.category-summary > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.category-summary span {
  color: var(--muted);
  font-size: 12px;
}

.category-summary strong {
  margin-top: 4px;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(440px, 1.2fr);
  gap: 14px;
}

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

.pie-layout {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 22px;
  padding: 8px 20px 22px;
}

.pie-chart {
  width: 140px;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 28px #fff;
}

.chart-legend {
  display: grid;
  gap: 8px;
}

.chart-legend div {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.chart-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.trend-chart {
  display: block;
  width: 100%;
  height: 190px;
  padding: 0 12px 8px;
}

.trend-chart polyline {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend-income { stroke: var(--accent); }
.trend-expense { stroke: var(--warm); }
.axis-line { stroke: var(--line-strong); }
.trend-chart text { fill: var(--muted); font-size: 11px; }

.legend-line {
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-line.income { background: var(--accent); }
.legend-line.expense { background: var(--warm); }

.permission-panel {
  min-height: 320px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 28px;
}

.permission-panel p {
  color: var(--muted);
}

.permission-request-select {
  display: grid;
  gap: 8px;
  width: min(320px, 100%);
  margin: 14px auto;
  text-align: left;
}

.permission-request-select span {
  color: var(--muted);
  font-weight: 700;
}

.permission-request-select select {
  width: 100%;
  border: 1px solid rgba(26, 83, 62, .18);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  font: inherit;
}

.permission-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  color: var(--warm);
  background: #f8ece0;
  font-weight: 700;
  font-size: 20px;
}

.subtotal {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #fbfcf9;
}

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

.subtotal strong {
  margin-left: 4px;
}

.profit {
  color: var(--accent);
}

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

.hidden {
  display: none;
}

[hidden],
.nav-item[hidden],
.nav-item.hidden {
  display: none !important;
}

.muted-cell,
.readonly-note {
  color: var(--muted);
  font-size: 12px;
}

.readonly-note {
  padding: 11px 12px;
  border-radius: 7px;
  background: #f3f5f1;
}

.dashboard-details {
  display: grid;
  gap: 14px;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.dashboard-summary > div {
  padding: 20px;
  border-right: 1px solid var(--line);
}

.dashboard-summary > div:last-child {
  border-right: 0;
}

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

.dashboard-summary strong {
  display: inline-block;
  margin: 6px 4px 0 0;
  font-size: 22px;
}

.offbank-total-panel {
  overflow: hidden;
  padding: 0;
}

.offbank-total-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.offbank-total-grid > div {
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(247, 251, 244, .84));
  border-right: 1px solid var(--line);
}

.offbank-total-grid > div:last-child {
  border-right: 0;
}

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

.offbank-total-grid strong {
  display: inline-block;
  margin: 7px 0 3px;
  font-size: 24px;
}

.goal-progress {
  padding: 18px;
}

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

.goal-head h2 {
  margin: 8px 0 4px;
}

.goal-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.goal-head strong {
  color: var(--accent-dark);
  font-size: 32px;
  font-variant-numeric: tabular-nums;
}

.goal-track {
  height: 16px;
  border-radius: 999px;
  background: #eef3e9;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(35, 49, 45, .08);
}

.goal-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  box-shadow: 0 6px 16px rgba(47, 138, 104, .22);
}

.goal-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.goal-foot b {
  color: var(--text);
}

.section-heading {
  padding: 18px 18px 8px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.recent-table {
  min-width: 720px;
}

.quote-calculator {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 16px;
  align-items: stretch;
}

.cost-finder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .85fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.cost-finder-form,
.cost-finder-picker {
  display: grid;
  gap: 14px;
}

.cost-finder-form .primary {
  justify-self: start;
}

.standalone-search {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  font-size: 15px;
}

.cost-database-heading {
  display: grid;
  gap: 12px;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
}

.cost-category-pills,
#selectedCostFactories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cost-category-pills button,
.selected-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf6ee;
  color: var(--accent-strong);
  font-weight: 800;
  min-height: 36px;
  padding: 0 14px;
}

.cost-category-pills button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.selected-chip button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(47, 138, 104, .15);
  color: var(--accent-strong);
  padding: 0;
  min-height: 0;
}

.selected-factory-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfdf8;
}

.selected-factory-box > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-factory-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.cost-factory-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
}

.cost-factory-option.active {
  border-color: var(--accent);
  background: #edf7ef;
}

.cost-factory-option strong,
.cost-factory-option small {
  display: block;
}

.cost-factory-option small {
  margin-top: 3px;
  color: var(--muted);
}

.quote-main,
.quote-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quote-main {
  padding: 22px;
}

.quote-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.quote-head h2 {
  margin-bottom: 0;
}

.quote-head strong {
  color: var(--accent);
  font-size: 24px;
}

.quote-field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.quote-field span,
.quote-result span {
  color: var(--muted);
  font-size: 12px;
}

.quote-field input,
.quote-field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  font-size: 17px;
}

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

.rate-pills.common-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0 18px 18px;
}

.custom-rate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.factory-rate-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(120px, .9fr) auto;
  gap: 10px;
  align-items: end;
}

.custom-rate-row .secondary {
  min-height: 48px;
  padding: 0 16px;
}

.factory-rate-row .secondary {
  min-height: 48px;
  padding: 0 16px;
  white-space: nowrap;
}

.rate-pills button {
  position: relative;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: #f7f8f5;
  font-weight: 700;
}

.rate-pills button span {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: #a6473d;
  font-size: 14px;
  line-height: 1;
}

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

.quote-result {
  display: grid;
  align-content: center;
  gap: 0;
  overflow: hidden;
}

.quote-result div {
  display: grid;
  gap: 6px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.quote-result div:last-child {
  border-bottom: 0;
}

.quote-result strong {
  font-size: 26px;
}

.quote-result div:first-child strong {
  color: var(--accent);
  font-size: 34px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #20251f;
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  pointer-events: none;
}

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

@media (max-width: 980px) {
  .app-stage {
    grid-template-columns: 1fr;
  }

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

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

  .topbar, .customer-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .offbank-total-grid {
    grid-template-columns: 1fr;
  }

  .offbank-ledger-totals,
  .offbank-grid,
  .offbank-books,
  .offbank-factory-export {
    grid-template-columns: 1fr;
  }

  .offbank-ledger-totals article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .offbank-ledger-totals article:last-child {
    border-bottom: 0;
  }

  .offbank-total-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .offbank-total-grid > div:last-child {
    border-bottom: 0;
  }

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

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

  .quote-calculator {
    grid-template-columns: 1fr;
  }

  .cost-finder-grid {
    grid-template-columns: 1fr;
  }

  .cost-database-heading {
    grid-template-columns: 1fr;
  }

  .dashboard-summary > div:nth-child(2) {
    border-right: 0;
  }

  .dashboard-summary > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .table-pager {
    align-items: stretch;
    flex-direction: column;
  }

  .table-pager > div {
    justify-content: space-between;
  }

  .sidebar {
    gap: 14px;
    padding: 14px 16px 10px;
  }

  .brand {
    min-height: 38px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .shell {
    padding: 18px 16px 28px;
  }

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

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

  .nav-item {
    width: auto;
    min-height: 34px;
    flex: 0 0 auto;
    padding: 0 12px;
    text-align: center;
  }

  .operator {
    display: none;
  }

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

  .dashboard-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-summary > div,
  .dashboard-summary > div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-summary > div:last-child {
    border-bottom: 0;
  }

  .goal-head,
  .goal-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .goal-head strong {
    font-size: 28px;
  }

  .field, .field.wide, .secondary {
    width: 100%;
  }

  .toolbar-action,
  .segmented {
    width: 100%;
  }

  .summary-export-card {
    grid-template-columns: 1fr;
  }

  .summary-export-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .summary-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .summary-range {
    grid-template-columns: 1fr 1fr;
  }

  .summary-range .field {
    min-width: 0;
  }

  .segmented button {
    flex: 1;
  }

  .topbar {
    gap: 12px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .customer-card {
    overflow: hidden;
  }

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

  .form-grid .span-2 {
    grid-column: auto;
  }

  .reverse-cost {
    align-items: stretch;
    flex-direction: column;
  }

  .reverse-cost .secondary {
    width: 100%;
  }

  .dialog-card {
    padding: 18px;
  }

  .pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .chart-legend {
    width: 100%;
  }

  .login-card {
    padding: 22px;
  }

  .login-options {
    align-items: flex-start;
    flex-direction: column;
  }

  .quote-main {
    padding: 18px;
  }

  .quote-head {
    flex-direction: column;
  }

  .quote-head strong,
  .quote-result div:first-child strong {
    font-size: 30px;
  }

  .quote-field input,
  .quote-field select,
  .rate-pills button {
    min-height: 52px;
    font-size: 18px;
  }

  .custom-rate-row {
    grid-template-columns: 1fr;
  }

  .factory-rate-row {
    grid-template-columns: 1fr;
  }

  .custom-rate-row .secondary {
    width: 100%;
    min-height: 52px;
  }

  .factory-rate-row .secondary {
    width: 100%;
    min-height: 52px;
  }
}

/* Light game-feel theme */
:root {
  --bg: #f4f7ef;
  --surface: #fffdf7;
  --line: #dfe8de;
  --line-strong: #c7d5c7;
  --text: #23312d;
  --muted: #6c7c75;
  --accent: #2f8a68;
  --accent-dark: #206149;
  --warm: #f0b755;
  --danger: #bf5140;
  --peach: #ee7f5f;
  --sky: #5b8fb6;
  --mint: #e8f6ed;
  --shadow: 0 18px 42px rgba(32, 71, 56, .1);
}

body {
  background:
    linear-gradient(135deg, rgba(244, 247, 239, .96), rgba(232, 246, 237, .96)),
    repeating-linear-gradient(45deg, rgba(47, 138, 104, .045) 0 10px, transparent 10px 24px);
}

.sidebar {
  width: 236px;
  border-right: 0;
  color: #f8fff9;
  background: #263b32;
  box-shadow: 12px 0 34px rgba(35, 49, 45, .1);
}

.brand {
  padding: 6px 4px 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #23312d;
  background: var(--warm);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .14);
  font-weight: 900;
}

.sidebar .brand strong {
  color: #fff;
}

.sidebar .brand span,
.sidebar .operator span {
  color: rgba(248, 255, 249, .68);
}

.nav {
  gap: 10px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border-radius: 14px;
  padding: 0 12px;
  color: rgba(248, 255, 249, .76);
  font-weight: 700;
}

.nav-item::before {
  content: "总";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: rgba(255, 255, 255, .88);
  background: rgba(255, 255, 255, .12);
  font-size: 12px;
}

.nav-item[data-view="ledger"]::before { content: "账"; }
.nav-item[data-view="fixed"]::before { content: "电"; }
.nav-item[data-view="payments"]::before { content: "款"; }
.nav-item[data-view="reconcile"]::before { content: "核"; }
.nav-item[data-view="bills"]::before { content: "单"; }
.nav-item[data-view="calculator"]::before { content: "算"; }
.nav-item[data-view="costFinder"]::before { content: "价"; }
.nav-item[data-view="factory"]::before { content: "厂"; }
.nav-item[data-view="data"]::before { content: "备"; }
.nav-item[data-view="approvals"]::before { content: "批"; }

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .1);
}

.nav-item.active {
  color: #23312d;
  background: #fff8dd;
  box-shadow: 0 7px 0 rgba(0, 0, 0, .14);
}

.nav-item.active::before {
  color: #23312d;
  background: #ffe3a3;
}

.operator {
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .1);
}

.operator strong {
  color: #fff;
}

.text-button {
  color: #fff8dd;
}

.shell {
  padding: 28px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.topbar {
  padding: 18px;
  border: 1px solid rgba(35, 49, 45, .08);
  border-radius: 24px;
  background: rgba(255, 253, 247, .86);
  box-shadow: var(--shadow);
}

.topbar h1 {
  font-size: 30px;
}

.eyebrow {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 800;
}

.primary,
.export-btn {
  border-radius: 15px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 7px 0 #1f634b;
  font-weight: 900;
}

.primary:hover,
.export-btn:hover {
  background: var(--accent-dark);
}

.secondary,
.ghost {
  border-radius: 14px;
  font-weight: 800;
}

.secondary {
  color: var(--accent-dark);
  background: var(--mint);
}

.ghost {
  color: var(--muted);
  background: #eef3e9;
}

.overview {
  gap: 14px;
}

.metric {
  position: relative;
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(35, 49, 45, .08);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(35, 49, 45, .07);
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -28px;
  width: 92px;
  height: 92px;
  border-radius: 28px;
  background: rgba(240, 183, 85, .2);
  transform: rotate(18deg);
}

.metric:nth-child(2)::after {
  background: rgba(91, 143, 182, .18);
}

.metric:nth-child(3)::after {
  background: rgba(238, 127, 95, .18);
}

.metric:nth-child(4)::after {
  background: rgba(47, 138, 104, .16);
}

.metric span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--mint);
  font-weight: 800;
}

.metric strong {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.panel,
.customer-block,
.toolbar {
  border: 1px solid rgba(35, 49, 45, .08);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(35, 49, 45, .065);
}

.panel {
  padding: 0;
  overflow: hidden;
}

.reconcile-card,
.permission-panel {
  padding: 20px;
}

.empty-panel {
  padding: 30px;
}

.toolbar {
  padding: 16px;
}

.field span,
label span,
.save-state {
  font-weight: 700;
}

input,
select,
.reconcile-card input,
.form-grid input,
.form-grid select {
  min-height: 42px;
  border-radius: 14px;
  background: #fbfdf8;
}

input:focus,
select:focus {
  outline: 3px solid rgba(47, 138, 104, .16);
  border-color: var(--accent);
}

.section-heading {
  padding: 17px 18px 10px;
}

.section-heading h2 {
  margin-bottom: 3px;
  font-size: 19px;
}

.dashboard-summary {
  border-radius: 22px;
}

.dashboard-summary > div {
  background: #fff;
}

.chart-card {
  padding-bottom: 14px;
}

.pie-layout,
.trend-chart,
.chart-empty {
  padding: 0 16px 16px;
}

.table-wrap {
  padding: 0 14px 14px;
}

table {
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 16px;
}

th {
  color: var(--muted);
  background: #f8faf3;
  font-weight: 800;
}

td,
th {
  border-bottom-color: #edf2e9;
}

tbody tr:hover {
  background: #fbf8ed;
}

.actions button {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--accent-dark);
  background: var(--mint);
  font-weight: 800;
}

.actions .danger-link {
  color: var(--danger);
  background: #f9e8e3;
}

.status {
  border-radius: 999px;
  font-weight: 900;
}

.status.pending {
  color: #916118;
  background: #fff1c9;
}

.status.overdue {
  color: #fff;
  background: var(--peach);
}

.segmented {
  border-radius: 999px;
  background: #eef3e9;
}

.segmented button {
  border-radius: 999px;
  font-weight: 800;
}

.segmented button.active {
  color: #23312d;
  background: #fff8dd;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .08);
}

.category-summary div,
.reconcile-card,
.quote-main,
.quote-result {
  border-radius: 22px;
}

.customer-head {
  padding: 17px 18px;
  background: #fffdf7;
}

.customer-head h3 {
  font-size: 20px;
}

.layer-head {
  background: #f8faf3;
}

.subtotal {
  padding: 14px 18px;
  background: #fff8dd;
}

.quote-calculator {
  align-items: stretch;
}

.quote-main,
.quote-result {
  border: 1px solid rgba(35, 49, 45, .08);
  box-shadow: 0 14px 30px rgba(35, 49, 45, .07);
}

.quote-head strong,
.quote-result div:first-child strong {
  color: var(--accent-dark);
}

.rate-pills button {
  border-radius: 16px;
  background: #fff1c9;
  box-shadow: 0 5px 0 rgba(131, 88, 20, .16);
}

.rate-pills button.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 5px 0 #1f634b;
}

.dialog {
  border-radius: 24px;
}

.dialog-card,
.login-card {
  border-radius: 24px;
  background: #fffdf7;
  box-shadow: 0 24px 54px rgba(32, 71, 56, .14);
}

.icon-btn {
  border-radius: 12px;
}

.login-screen {
  background:
    linear-gradient(135deg, rgba(244, 247, 239, .96), rgba(232, 246, 237, .96)),
    repeating-linear-gradient(45deg, rgba(47, 138, 104, .045) 0 10px, transparent 10px 24px);
}

.login-button {
  min-height: 46px;
}

.login-screen {
  isolation: isolate;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 200, 87, .12), transparent 0 20%, transparent 46%),
    linear-gradient(135deg, #06110f 0%, #0e2b24 48%, #071613 100%);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, transparent 0 49.8%, rgba(255, 248, 221, .035) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 0 49.8%, rgba(255, 248, 221, .028) 50%, transparent 50.2%);
  background-size: 74px 74px;
  mask-image: radial-gradient(circle at 50% 46%, #000 0 34%, transparent 76%);
}

.login-screen::after {
  content: "";
  position: absolute;
  width: min(66vw, 720px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 248, 221, .08);
  border-radius: 50%;
  box-shadow:
    inset 0 0 44px rgba(255, 200, 87, .04),
    0 0 90px rgba(255, 200, 87, .06);
  animation: splashOrbit 18s linear infinite;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 920px);
  grid-template-columns: minmax(280px, 1.08fr) minmax(300px, .92fr);
  gap: 18px 28px;
  padding: 28px;
  border: 1px solid rgba(255, 248, 221, .14);
  border-radius: 30px;
  color: #fff8dd;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .105), rgba(255, 255, 255, .045));
  box-shadow: 0 34px 96px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .16);
  backdrop-filter: blur(20px);
}

.login-brand-panel {
  position: relative;
  display: grid;
  align-content: center;
  gap: 26px;
  min-height: 410px;
  padding: 34px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 200, 87, .22), transparent 0 20%, transparent 48%),
    linear-gradient(145deg, rgba(10, 41, 34, .92), rgba(5, 21, 18, .62));
}

.login-brand-panel::after {
  content: "";
  position: absolute;
  inset: auto 28px 28px auto;
  width: 126px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 200, 87, .9));
}

.login-emblem {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 1px solid rgba(255, 248, 221, .18);
  border-radius: 26px;
  color: #11271f;
  background: linear-gradient(135deg, #fff8dd, #ffc857);
  box-shadow: 0 18px 42px rgba(255, 200, 87, .18);
  font-size: 24px;
  font-weight: 950;
}

.login-brand-panel .eyebrow {
  color: rgba(255, 248, 221, .56);
}

.login-brand-panel h1 {
  margin: 4px 0 10px;
  font-family: "STZhongsong", "Microsoft YaHei", "PingFang SC", serif;
  font-size: clamp(48px, 5vw, 70px);
  line-height: 1;
}

.login-brand-panel span {
  color: rgba(255, 248, 221, .76);
  font-size: 16px;
}

.login-form-head {
  align-self: end;
  padding-top: 10px;
}

.login-form-head .eyebrow,
.login-card label span {
  color: rgba(255, 248, 221, .58);
}

.login-form-head h2 {
  margin: 5px 0 0;
  font-size: 28px;
}

.login-card > label,
.login-options,
.form-error,
.login-button {
  grid-column: 2;
}

.login-card label {
  gap: 8px;
}

.login-card input {
  min-height: 50px;
  border: 1px solid rgba(255, 248, 221, .16);
  border-radius: 16px;
  color: #fff8dd;
  background: rgba(3, 18, 15, .46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  outline: none;
}

.login-card input:focus {
  border-color: rgba(255, 200, 87, .68);
  box-shadow: 0 0 0 4px rgba(255, 200, 87, .12), inset 0 1px 0 rgba(255, 255, 255, .05);
}

.login-card input::placeholder {
  color: rgba(255, 248, 221, .32);
}

.login-options {
  margin-top: -2px;
}

.login-options label {
  color: rgba(255, 248, 221, .68);
}

.login-options input {
  accent-color: #ffc857;
}

.login-button {
  min-height: 52px;
  border-radius: 17px;
  color: #10251f;
  background: linear-gradient(135deg, #fff8dd, #ffc857);
  box-shadow: 0 9px 0 rgba(119, 77, 8, .42), 0 18px 34px rgba(255, 200, 87, .12);
}

.login-button:hover {
  background: linear-gradient(135deg, #fffdf2, #ffd873);
}

.login-register-button {
  grid-column: 2;
  justify-self: center;
  color: #f8f1d7;
  opacity: .84;
  margin-top: -6px;
}

.login-register-button:hover {
  opacity: 1;
}

.login-card .form-error {
  color: #ffcf9f;
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff8dd;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 200, 87, .14), transparent 0 18%, transparent 45%),
    linear-gradient(135deg, rgba(6, 17, 15, .97), rgba(14, 43, 36, .98));
  animation: welcomeFadeIn .38s ease both;
}

.welcome-screen.hidden {
  display: none;
}

.welcome-screen.leaving {
  animation: welcomeFadeOut .72s ease forwards;
}

.welcome-card {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  width: min(84vw, 660px);
  text-align: center;
  animation: welcomeRise .9s cubic-bezier(.2, .8, .2, 1) both;
}

.welcome-role {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid rgba(255, 248, 221, .18);
  border-radius: 999px;
  color: #10251f;
  background: linear-gradient(135deg, #fff8dd, #ffc857);
  font-size: 13px;
  font-weight: 950;
}

.welcome-card h2 {
  margin: 24px 0 12px;
  font-family: "STZhongsong", "Microsoft YaHei", "PingFang SC", serif;
  font-size: clamp(40px, 5.5vw, 68px);
  line-height: 1.08;
  text-shadow: 0 16px 44px rgba(0, 0, 0, .34);
}

.welcome-card p {
  margin: 0 0 28px;
  color: rgba(255, 248, 221, .8);
  font-size: clamp(17px, 2.2vw, 24px);
}

.welcome-line {
  width: min(62vw, 380px);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 248, 221, .12);
  box-shadow: 0 0 26px rgba(255, 200, 87, .16);
}

.welcome-line i {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #ffc857, #fff8dd);
  animation: splashLoading 2s ease-in-out infinite;
}

.welcome-effect {
  position: absolute;
  width: min(70vw, 720px);
  aspect-ratio: 1;
  opacity: .85;
}

.welcome-effect::before,
.welcome-effect::after {
  content: "";
  position: absolute;
}

.welcome-screen.ops .welcome-effect {
  border-radius: 30px;
  background:
    linear-gradient(90deg, rgba(255, 248, 221, .08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 200, 87, .09) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle, #000 0 44%, transparent 72%);
}

.welcome-screen.ops .welcome-effect::after {
  inset: 34% 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 200, 87, .86), transparent);
  animation: welcomeScan 2.2s ease-in-out infinite;
}

.welcome-screen.boss .welcome-effect::before {
  inset: 18%;
  border-radius: 50%;
  border: 1px solid rgba(255, 200, 87, .22);
  box-shadow: 0 0 70px rgba(255, 200, 87, .08);
  animation: welcomePulse 2.8s ease-in-out infinite;
}

.welcome-screen.boss .welcome-effect::after {
  left: 12%;
  right: 12%;
  top: 52%;
  height: 46px;
  background: linear-gradient(90deg, transparent 0 7%, rgba(255, 200, 87, .85) 7% 9%, transparent 9% 22%, rgba(255, 200, 87, .55) 22% 24%, transparent 24% 38%, rgba(255, 248, 221, .9) 38% 41%, transparent 41% 100%);
  clip-path: polygon(0 52%, 14% 52%, 20% 18%, 28% 82%, 36% 38%, 45% 52%, 62% 52%, 69% 26%, 78% 78%, 86% 52%, 100% 52%, 100% 60%, 0 60%);
}

.welcome-screen.chairman .welcome-effect {
  border-radius: 50%;
  border: 1px solid rgba(255, 248, 221, .1);
  box-shadow: inset 0 0 50px rgba(255, 200, 87, .06), 0 0 90px rgba(255, 200, 87, .08);
  animation: splashOrbit 13s linear infinite;
}

.welcome-screen.chairman .welcome-effect::before {
  inset: 15%;
  border: 1px solid rgba(255, 200, 87, .18);
  border-radius: 50%;
}

.welcome-screen.senior-sales .welcome-effect::before {
  left: 8%;
  right: 8%;
  top: 48%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 200, 87, .1), rgba(255, 200, 87, .85), rgba(255, 248, 221, .18));
}

.welcome-screen.senior-sales .welcome-effect::after {
  top: calc(48% - 7px);
  left: 8%;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #ffc857;
  box-shadow: 0 0 36px rgba(255, 200, 87, .75);
  animation: welcomeRoute 3.2s ease-in-out infinite;
}

.welcome-screen.sales .welcome-effect {
  background:
    radial-gradient(circle at 28% 42%, rgba(255, 200, 87, .62) 0 4px, transparent 5px),
    radial-gradient(circle at 62% 30%, rgba(255, 248, 221, .42) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 62%, rgba(255, 200, 87, .5) 0 5px, transparent 6px),
    radial-gradient(circle at 42% 70%, rgba(255, 248, 221, .34) 0 3px, transparent 4px);
  animation: welcomeFloat 3.4s ease-in-out infinite;
}

.welcome-screen.sales .welcome-effect::after {
  left: 34%;
  top: 34%;
  width: 210px;
  height: 124px;
  border: 1px solid rgba(255, 248, 221, .13);
  border-radius: 18px;
  background: rgba(255, 255, 255, .045);
  transform: rotate(-5deg);
}

.welcome-screen.design .welcome-effect {
  filter: blur(.2px);
  background:
    radial-gradient(circle at 36% 36%, rgba(255, 121, 94, .26), transparent 0 18%, transparent 42%),
    radial-gradient(circle at 65% 38%, rgba(97, 202, 255, .23), transparent 0 19%, transparent 44%),
    radial-gradient(circle at 52% 68%, rgba(255, 200, 87, .24), transparent 0 18%, transparent 44%);
  animation: welcomeFloat 4.2s ease-in-out infinite;
}

@keyframes welcomeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes welcomeFadeOut {
  to { opacity: 0; visibility: hidden; }
}

@keyframes welcomeRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes welcomeScan {
  0%, 100% { transform: translateY(-80px); opacity: .3; }
  50% { transform: translateY(88px); opacity: 1; }
}

@keyframes welcomePulse {
  0%, 100% { transform: scale(.9); opacity: .45; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes welcomeRoute {
  0% { transform: translateX(0) scale(.86); }
  60% { transform: translateX(min(56vw, 520px)) scale(1); }
  100% { transform: translateX(min(56vw, 520px)) scale(.86); }
}

@keyframes welcomeFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.03); }
}

/* Refined personal entry scenes */
.welcome-screen {
  --scene-a: #ffc857;
  --scene-b: #fff8dd;
  --scene-c: #176b5b;
  place-items: stretch;
  padding: clamp(32px, 5vw, 70px);
  background:
    radial-gradient(circle at 74% 46%, color-mix(in srgb, var(--scene-a) 20%, transparent), transparent 0 18%, transparent 46%),
    radial-gradient(circle at 18% 26%, color-mix(in srgb, var(--scene-c) 28%, transparent), transparent 0 20%, transparent 48%),
    linear-gradient(135deg, #050e0c 0%, #0d211d 54%, #071310 100%);
}

.welcome-screen.ops {
  --scene-a: #ffd36a;
  --scene-b: #d8fff3;
  --scene-c: #2ea77e;
}

.welcome-screen.boss {
  --scene-a: #ffd56f;
  --scene-b: #fff4c2;
  --scene-c: #74531a;
}

.welcome-screen.chairman {
  --scene-a: #d6ad57;
  --scene-b: #fff1b0;
  --scene-c: #493816;
}

.welcome-screen.senior-sales {
  --scene-a: #77b7ff;
  --scene-b: #fff0a6;
  --scene-c: #1a65a0;
}

.welcome-screen.sales {
  --scene-a: #ffb04f;
  --scene-b: #fff0c8;
  --scene-c: #9f5720;
}

.welcome-screen.design {
  --scene-a: #9ab4ff;
  --scene-b: #ffd2f0;
  --scene-c: #6952d8;
}

.welcome-screen.cashier {
  --scene-a: #f2c46d;
  --scene-b: #73d0b6;
  --scene-c: #b7c8ff;
}

.welcome-card {
  position: relative;
  z-index: 2;
  align-self: center;
  justify-self: start;
  justify-items: start;
  width: min(52vw, 620px);
  padding-left: clamp(10px, 3vw, 44px);
  text-align: left;
}

.welcome-role {
  color: #0a1714;
  background: linear-gradient(135deg, var(--scene-b), var(--scene-a));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--scene-a) 18%, transparent);
}

.welcome-card h2 {
  margin-top: 28px;
  max-width: 720px;
}

.welcome-card p {
  max-width: 560px;
  color: color-mix(in srgb, var(--scene-b) 82%, white);
}

.welcome-line {
  width: min(44vw, 430px);
  background: color-mix(in srgb, var(--scene-b) 14%, transparent);
}

.welcome-line i {
  background: linear-gradient(90deg, transparent, var(--scene-a), var(--scene-b));
}

.welcome-effect {
  position: absolute;
  right: clamp(34px, 8vw, 150px);
  left: auto;
  top: 50%;
  width: min(39vw, 510px);
  aspect-ratio: 1;
  opacity: .92;
  transform: translateY(-50%);
}

.welcome-effect::before,
.welcome-effect::after {
  box-sizing: border-box;
}

.welcome-screen.ops .welcome-effect {
  border: 1px solid color-mix(in srgb, var(--scene-b) 20%, transparent);
  border-radius: 26px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--scene-b) 12%, transparent) 1px, transparent 1px),
    linear-gradient(0deg, color-mix(in srgb, var(--scene-a) 14%, transparent) 1px, transparent 1px),
    linear-gradient(135deg, color-mix(in srgb, var(--scene-c) 16%, transparent), transparent);
  background-size: 64px 64px, 64px 64px, auto;
  box-shadow: inset 0 0 60px color-mix(in srgb, var(--scene-a) 8%, transparent), 0 0 80px color-mix(in srgb, var(--scene-c) 12%, transparent);
  mask-image: none;
  animation: scenePanelIn 3.4s ease-in-out infinite;
}

.welcome-screen.ops .welcome-effect::before {
  inset: 12%;
  border: 1px solid color-mix(in srgb, var(--scene-b) 22%, transparent);
  border-radius: 18px;
  background:
    linear-gradient(color-mix(in srgb, var(--scene-a) 70%, transparent), color-mix(in srgb, var(--scene-a) 70%, transparent)) 18% 26% / 44% 2px no-repeat,
    linear-gradient(color-mix(in srgb, var(--scene-b) 54%, transparent), color-mix(in srgb, var(--scene-b) 54%, transparent)) 18% 43% / 64% 2px no-repeat,
    linear-gradient(color-mix(in srgb, var(--scene-c) 72%, transparent), color-mix(in srgb, var(--scene-c) 72%, transparent)) 18% 60% / 52% 2px no-repeat;
}

.welcome-screen.ops .welcome-effect::after {
  inset: 0 10%;
  width: auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--scene-a), transparent);
  animation: welcomeScan 2.4s ease-in-out infinite;
}

.welcome-screen.boss .welcome-effect {
  border-radius: 30px;
  background:
    linear-gradient(120deg, transparent 0 20%, color-mix(in srgb, var(--scene-a) 17%, transparent) 20% 21%, transparent 21% 100%),
    linear-gradient(180deg, transparent 0 52%, color-mix(in srgb, var(--scene-a) 22%, transparent) 52% 53%, transparent 53% 100%);
}

.welcome-screen.boss .welcome-effect::before {
  left: 4%;
  right: 4%;
  top: 22%;
  height: 58%;
  border: 1px solid color-mix(in srgb, var(--scene-a) 18%, transparent);
  border-radius: 24px;
  background:
    linear-gradient(120deg, transparent 0 16%, color-mix(in srgb, var(--scene-b) 18%, transparent) 16% 17%, transparent 17% 100%),
    linear-gradient(110deg, transparent 0 48%, color-mix(in srgb, var(--scene-a) 76%, transparent) 48% 50%, transparent 50% 100%);
  box-shadow: 0 0 70px color-mix(in srgb, var(--scene-a) 10%, transparent);
  animation: sceneChartGlow 3.6s ease-in-out infinite;
}

.welcome-screen.boss .welcome-effect::after {
  left: 12%;
  right: 12%;
  top: 58%;
  height: 90px;
  background: linear-gradient(90deg, transparent 0 8%, var(--scene-a) 8% 10%, transparent 10% 22%, var(--scene-b) 22% 24%, transparent 24% 38%, var(--scene-a) 38% 41%, transparent 41% 100%);
  clip-path: polygon(0 62%, 12% 62%, 20% 34%, 30% 70%, 40% 46%, 52% 22%, 66% 38%, 78% 18%, 91% 44%, 100% 32%, 100% 42%, 91% 54%, 78% 28%, 66% 48%, 52% 32%, 40% 56%, 30% 80%, 20% 44%, 12% 72%, 0 72%);
}

.welcome-screen.chairman .welcome-effect {
  border: 1px solid color-mix(in srgb, var(--scene-b) 12%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--scene-a) 12%, transparent), transparent 0 34%, transparent 58%);
  box-shadow: inset 0 0 80px color-mix(in srgb, var(--scene-a) 8%, transparent), 0 0 110px color-mix(in srgb, var(--scene-a) 10%, transparent);
  animation: splashOrbit 16s linear infinite;
}

.welcome-screen.chairman .welcome-effect::before {
  inset: 18%;
  border: 1px solid color-mix(in srgb, var(--scene-a) 26%, transparent);
  border-radius: 50%;
}

.welcome-screen.chairman .welcome-effect::after {
  inset: 34%;
  border-radius: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--scene-b) 28%, transparent), color-mix(in srgb, var(--scene-a) 16%, transparent));
  box-shadow: 0 0 48px color-mix(in srgb, var(--scene-a) 14%, transparent);
  transform: rotate(45deg);
}

.welcome-screen.senior-sales .welcome-effect {
  background:
    radial-gradient(circle at 16% 55%, var(--scene-a) 0 7px, transparent 8px),
    radial-gradient(circle at 45% 36%, var(--scene-b) 0 5px, transparent 6px),
    radial-gradient(circle at 78% 25%, var(--scene-a) 0 8px, transparent 9px),
    linear-gradient(105deg, transparent 0 17%, color-mix(in srgb, var(--scene-a) 78%, transparent) 17% 18%, transparent 18% 44%, color-mix(in srgb, var(--scene-b) 78%, transparent) 44% 45%, transparent 45% 75%, color-mix(in srgb, var(--scene-a) 78%, transparent) 75% 76%, transparent 76% 100%);
}

.welcome-screen.senior-sales .welcome-effect::before {
  left: 8%;
  right: 8%;
  top: 56%;
  height: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--scene-a) 15%, transparent), var(--scene-a), var(--scene-b));
}

.welcome-screen.senior-sales .welcome-effect::after {
  top: calc(56% - 9px);
  left: 8%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--scene-b);
  box-shadow: 0 0 38px color-mix(in srgb, var(--scene-a) 70%, transparent);
  animation: welcomeRoute 3.2s ease-in-out infinite;
}

.welcome-screen.sales .welcome-effect {
  border-radius: 28px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--scene-a) 13%, transparent), color-mix(in srgb, var(--scene-c) 13%, transparent));
  box-shadow: 0 0 90px color-mix(in srgb, var(--scene-a) 10%, transparent);
  animation: scenePanelIn 3.8s ease-in-out infinite;
}

.welcome-screen.sales .welcome-effect::before {
  left: 16%;
  top: 26%;
  width: 68%;
  height: 42%;
  border: 1px solid color-mix(in srgb, var(--scene-b) 18%, transparent);
  border-radius: 22px;
  background:
    linear-gradient(color-mix(in srgb, var(--scene-a) 70%, transparent), color-mix(in srgb, var(--scene-a) 70%, transparent)) 18% 32% / 48% 2px no-repeat,
    linear-gradient(color-mix(in srgb, var(--scene-b) 46%, transparent), color-mix(in srgb, var(--scene-b) 46%, transparent)) 18% 56% / 68% 2px no-repeat,
    rgba(255, 255, 255, .045);
  transform: rotate(-4deg);
}

.welcome-screen.sales .welcome-effect::after {
  right: 18%;
  bottom: 20%;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--scene-a), transparent 68%);
  box-shadow: 0 0 44px color-mix(in srgb, var(--scene-a) 58%, transparent);
  animation: welcomePulse 2.8s ease-in-out infinite;
}

.welcome-screen.design .welcome-effect {
  border-radius: 38px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--scene-a) 42%, transparent), transparent 54%),
    linear-gradient(40deg, transparent 0 38%, color-mix(in srgb, var(--scene-b) 38%, transparent) 38% 68%, transparent 68%),
    linear-gradient(160deg, transparent 0 52%, color-mix(in srgb, var(--scene-c) 36%, transparent) 52% 82%, transparent 82%);
  filter: saturate(1.1);
  animation: welcomeFloat 4.4s ease-in-out infinite;
}

.welcome-screen.design .welcome-effect::before {
  inset: 16%;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 28px;
}

.welcome-screen.design .welcome-effect::after {
  left: 24%;
  top: 22%;
  width: 42%;
  height: 34%;
  border-radius: 22px;
  background: rgba(255, 255, 255, .16);
  transform: rotate(-8deg);
}

.welcome-screen.cashier .welcome-effect {
  border-radius: 30px;
  background:
    linear-gradient(90deg, transparent 0 16%, color-mix(in srgb, var(--scene-a) 34%, transparent) 16% 17%, transparent 17% 100%),
    linear-gradient(0deg, transparent 0 38%, color-mix(in srgb, var(--scene-b) 28%, transparent) 38% 39%, transparent 39% 100%),
    radial-gradient(circle at 72% 30%, color-mix(in srgb, var(--scene-a) 55%, transparent), transparent 0 14%, transparent 38%);
  box-shadow: 0 0 90px color-mix(in srgb, var(--scene-a) 12%, transparent);
  animation: scenePanelIn 3.8s ease-in-out infinite;
}

.welcome-screen.cashier .welcome-effect::before {
  left: 15%;
  top: 20%;
  width: 64%;
  height: 52%;
  border: 1px solid color-mix(in srgb, var(--scene-b) 20%, transparent);
  border-radius: 22px;
  background:
    linear-gradient(color-mix(in srgb, var(--scene-a) 70%, transparent), color-mix(in srgb, var(--scene-a) 70%, transparent)) 18% 30% / 52% 2px no-repeat,
    linear-gradient(color-mix(in srgb, var(--scene-b) 58%, transparent), color-mix(in srgb, var(--scene-b) 58%, transparent)) 18% 52% / 66% 2px no-repeat,
    linear-gradient(color-mix(in srgb, var(--scene-c) 64%, transparent), color-mix(in srgb, var(--scene-c) 64%, transparent)) 18% 74% / 42% 2px no-repeat,
    rgba(255, 255, 255, .05);
}

.welcome-screen.cashier .welcome-effect::after {
  right: 16%;
  bottom: 18%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--scene-a) 34%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--scene-a) 70%, transparent), transparent 66%);
  box-shadow: 0 0 52px color-mix(in srgb, var(--scene-a) 42%, transparent);
  animation: welcomePulse 2.9s ease-in-out infinite;
}

@keyframes scenePanelIn {
  0%, 100% { transform: translateY(-50%) perspective(900px) rotateY(-7deg); }
  50% { transform: translateY(-50%) perspective(900px) rotateY(0deg) translateY(-8px); }
}

@keyframes sceneChartGlow {
  0%, 100% { opacity: .62; transform: translateY(8px); }
  50% { opacity: 1; transform: translateY(0); }
}

/* Soft scene transitions */
.sidebar,
.shell,
.login-screen {
  transition:
    opacity .78s ease,
    transform .78s cubic-bezier(.2, .8, .2, 1),
    filter .78s ease;
}

.app-booting .login-screen {
  transform: translateY(10px) scale(.99);
  filter: brightness(.8);
}

.app-booting .sidebar,
.app-booting .shell {
  transform: translateY(10px);
}

.login-screen.exiting {
  opacity: 0;
  transform: translateY(18px) scale(.985);
  filter: brightness(.72) blur(4px);
  pointer-events: none;
}

.workspace-preparing .sidebar,
.workspace-preparing .shell {
  opacity: 0;
  transform: translateY(16px) scale(.992);
  filter: brightness(.88);
}

.workspace-ready .sidebar,
.workspace-ready .shell {
  animation: workspaceReveal .86s cubic-bezier(.2, .8, .2, 1) both;
}

.welcome-screen {
  transition: opacity .72s ease, filter .72s ease;
}

.welcome-screen.leaving {
  filter: brightness(.85) blur(3px);
}

@keyframes workspaceReveal {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.992);
    filter: brightness(.88);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

.readonly-note {
  border-radius: 14px;
  background: #eef3e9;
}

.toast {
  border-radius: 16px;
  background: #263b32;
  box-shadow: 0 16px 34px rgba(35, 49, 45, .18);
}

.data-management {
  overflow: hidden;
}

.data-management-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
}

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

.data-actions button {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 16px;
  white-space: nowrap;
}

.data-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.data-status-grid article {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.data-status-grid article:last-child {
  border-right: 0;
}

.data-status-grid span,
.data-path span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.data-status-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.data-path {
  margin: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .64);
}

.data-path code {
  display: block;
  overflow: auto;
  margin-top: 7px;
  color: var(--accent-dark);
  font-family: inherit;
  font-size: 13px;
  white-space: nowrap;
}

.lan-sync-panel {
  margin: 18px;
  padding: 18px;
  border: 1px solid rgba(35, 49, 45, .08);
  border-radius: 18px;
  background: linear-gradient(135deg, #fbfff8, #f2f8ee);
}

.lan-sync-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.data-sync-panel {
  padding: 0;
  overflow: hidden;
}

.data-sync-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, .96), rgba(246, 251, 244, .9)),
    radial-gradient(circle at 92% 12%, rgba(255, 200, 87, .18), transparent 34%);
  border-bottom: 1px solid var(--line);
}

.data-sync-hero h2 {
  margin: 12px 0 6px;
  font-size: 24px;
}

.data-sync-hero p {
  margin: 0;
  color: var(--muted);
}

.sync-address-card {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid rgba(23, 107, 91, .14);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(23, 107, 91, .1), rgba(255, 255, 255, .86));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

.sync-address-card span {
  color: var(--muted);
  font-size: 12px;
}

.sync-address-card strong {
  overflow-wrap: anywhere;
  color: var(--accent-dark);
  font-size: 18px;
}


.sync-role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);
}

.sync-role-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 18px;
  text-align: left;
  border: 1px solid rgba(23, 107, 91, .14);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff, rgba(244, 250, 241, .9));
  color: var(--ink);
  box-shadow: none;
}

.sync-role-card strong {
  font-size: 18px;
}

.sync-role-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sync-role-card.active {
  border-color: rgba(23, 107, 91, .38);
  background: linear-gradient(135deg, rgba(232, 247, 238, .95), rgba(255, 246, 212, .7));
  box-shadow: inset 0 0 0 1px rgba(23, 107, 91, .08), 0 14px 30px rgba(23, 107, 91, .08);
}

.sync-mode-panel {
  border-bottom: 1px solid var(--line);
  background: rgba(250, 252, 247, .7);
}

.sync-mode-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 0;
}

.sync-mode-heading h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.sync-mode-heading p {
  margin: 0;
  color: var(--muted);
}

.sync-warning {
  margin: 14px 24px 0;
  padding: 12px 14px;
  border: 1px solid rgba(210, 169, 76, .34);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 247, 219, .82), rgba(232, 247, 238, .7));
  color: #5d4a17;
  font-size: 13px;
  line-height: 1.6;
}

.data-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 245, .72);
}

.data-sync-actions button {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 16px;
}

.data-sync-connect {
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) minmax(180px, .9fr) repeat(4, auto);
  gap: 10px;
  align-items: end;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .64);
}

.data-sync-connect label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.data-sync-connect label span {
  color: var(--muted);
  font-size: 12px;
}

.data-sync-connect input {
  width: 100%;
  min-width: 0;
  border-radius: 14px;
}

.data-sync-connect button {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 16px;
  white-space: nowrap;
}

.data-sync-package {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, .88), rgba(241, 248, 238, .72));
}

.data-sync-package > div:first-child {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.data-sync-package strong {
  font-size: 15px;
  color: var(--ink);
}

.data-sync-package span {
  color: var(--muted);
  font-size: 12px;
}

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

.data-sync-package-actions button {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 16px;
  white-space: nowrap;
}

.data-status-box {
  padding: 0 24px 22px;
}

.data-client-table {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.data-status-grid strong {
  overflow-wrap: anywhere;
}

.data-safety-panel {
  margin-top: 18px;
  overflow: hidden;
  padding: 0;
}

.data-safety-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 94% 16%, rgba(255, 200, 87, .18), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(246, 251, 244, .9));
}

.data-safety-head h2 {
  margin: 10px 0 5px;
  font-size: 22px;
}

.data-safety-head p {
  margin: 0;
  color: var(--muted);
}

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

.data-safety-actions button {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 16px;
  white-space: nowrap;
}

.data-safety-box {
  padding: 20px 24px 24px;
  background: rgba(250, 252, 247, .74);
}

.data-safety-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
}

.data-safety-grid article {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.data-safety-grid article:last-child {
  border-right: 0;
}

.data-safety-grid span,
.data-safety-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.data-safety-grid strong {
  display: block;
  overflow-wrap: anywhere;
  margin: 7px 0 3px;
  color: var(--ink);
  font-size: 20px;
}

.data-safety-grid .attention strong {
  color: #9a5200;
}

.data-safety-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(196, 121, 16, .22);
  border-radius: 16px;
  background: rgba(255, 246, 225, .82);
}

.data-safety-alert span {
  min-width: 0;
  color: #7a4a08;
  overflow-wrap: anywhere;
}

.data-safety-alert button {
  min-height: 36px;
  border-radius: 12px;
  padding: 0 14px;
}

.backup-list {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  overflow: hidden;
}

.backup-list-head,
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.backup-list-head {
  background: rgba(247, 250, 244, .9);
}

.backup-list-head span,
.backup-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.backup-row:last-child {
  border-bottom: 0;
}

.backup-row > div {
  min-width: 0;
}

.backup-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.backup-row button {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 12px;
  padding: 0 14px;
}

.data-health-panel,
.audit-panel {
  margin-top: 18px;
  overflow: hidden;
  padding: 0;
}

.health-badge {
  align-self: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(232, 247, 238, .95);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.health-badge.warning {
  background: rgba(255, 243, 205, .92);
  color: #8a5600;
}

.health-list {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.health-list article {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
}

.health-list article.warning {
  border-color: rgba(196, 121, 16, .22);
  background: rgba(255, 246, 225, .72);
}

.health-list article.info {
  border-color: rgba(23, 107, 91, .16);
  background: rgba(238, 248, 241, .74);
}

.health-list strong,
.health-list span {
  display: block;
}

.health-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.table-pager > div {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.table-pager button {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  background: #eef6ec;
  color: var(--accent-dark);
  font-weight: 800;
  box-shadow: none;
}

.table-pager button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.table-pager strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.offbank-grid {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.offbank-ledger-summary {
  overflow: hidden;
  margin-bottom: 18px;
}

.offbank-ledger-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.offbank-ledger-totals article {
  min-width: 0;
  padding: 18px 20px;
  background: rgba(255, 255, 255, .7);
  border-right: 1px solid var(--line);
}

.offbank-ledger-totals article:last-child {
  border-right: 0;
}

.offbank-ledger-totals span,
.offbank-ledger-totals small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.offbank-ledger-totals strong {
  display: block;
  margin: 7px 0 3px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.offbank-factory-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.offbank-factory-export {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(150px, .8fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(26, 83, 62, .12);
  border-radius: 18px;
  background: rgba(247, 252, 245, .82);
}

.offbank-factory-export label {
  display: grid;
  gap: 7px;
}

.offbank-factory-export span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.offbank-factory-export input,
.offbank-factory-export select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink);
  font: inherit;
}

.offbank-entry-card .span-2 {
  grid-column: 1 / -1;
}

.offbank-entry-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .7);
}

.offbank-entry-switch button {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  box-shadow: none;
}

.offbank-entry-switch button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 12px 24px rgba(19, 98, 82, .18);
}

.offbank-entry-switch button[data-offbank-type="支出"].active {
  background: linear-gradient(135deg, #c97854, #9e4d35);
  box-shadow: 0 12px 24px rgba(158, 77, 53, .16);
}

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

.offbank-book {
  overflow: hidden;
  padding: 0;
}

.offbank-book-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.offbank-book-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.offbank-book-head h2 {
  margin: 5px 0 0;
}

.offbank-book-head strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.offbank-book.income .offbank-book-head {
  background: linear-gradient(135deg, rgba(237, 249, 232, .94), rgba(255, 255, 255, .86));
}

.offbank-book.expense .offbank-book-head {
  background: linear-gradient(135deg, rgba(255, 240, 229, .94), rgba(255, 255, 255, .86));
}

.offbank-book.income .offbank-book-head strong {
  color: var(--accent-dark);
}

.offbank-book.expense .offbank-book-head strong {
  color: #a95035;
}

.inline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-tools input {
  min-width: 180px;
}

.rate-pills .common-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin: 0;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(23, 107, 91, .08);
  background: linear-gradient(135deg, #edf7ed, #f7fbf4);
  color: var(--accent-dark);
  font-weight: 700;
  cursor: default;
  transition: padding .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.rate-pills .common-pill:focus,
.rate-pills .common-pill:focus-within,
.rate-pills .common-pill:hover {
  padding-right: 36px;
  border-color: rgba(23, 107, 91, .22);
  background: linear-gradient(135deg, #e5f3e6, #fbfff8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), 0 8px 18px rgba(23, 107, 91, .08);
  outline: none;
}

.rate-pills .common-pill-delete {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  min-height: 20px;
  width: 20px;
  height: 20px;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 999px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(.78);
  background: rgba(23, 107, 91, .14);
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1;
  box-shadow: none;
  transition: opacity .16s ease, transform .16s ease, background .16s ease, color .16s ease;
}

.rate-pills .common-pill:focus .common-pill-delete,
.rate-pills .common-pill:focus-within .common-pill-delete,
.rate-pills .common-pill:hover .common-pill-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

.rate-pills .common-pill-delete:hover {
  background: #a6473d;
  color: #fff;
}

.lan-sync-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.lan-sync-head p,
.lan-sync-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sync-badge {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #e9f6df;
  font-size: 12px;
  font-weight: 800;
}

.sync-badge.client {
  color: #6b4a00;
  background: #fff1c9;
}

.sync-badge.host {
  color: #fff;
  background: var(--accent);
}

.lan-sync-notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px dashed rgba(35, 49, 45, .18);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, .56);
  font-size: 13px;
}

.lan-sync-notice.active {
  border-style: solid;
  color: var(--accent-dark);
  background: #e9f6df;
}

.lan-sync-notice strong {
  word-break: break-all;
}

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

.lan-sync-grid article {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .74);
}

.lan-sync-grid span {
  color: var(--muted);
  font-size: 12px;
}

.lan-sync-grid strong {
  word-break: break-all;
  color: var(--text);
  font-size: 16px;
}

.lan-connect-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

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

.lan-connect-row input {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 0 12px;
  background: #fbfdf8;
}

.lan-client-log {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
}

.lan-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.lan-log-head strong {
  font-size: 15px;
}

.lan-log-head span {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
}

.lan-log-head button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 12px;
}

.lan-client-log .table-wrap {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.data-loading {
  padding: 28px 18px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .sidebar {
    width: auto;
  }

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

@media (max-width: 620px) {
  .sidebar,
  .shell,
  .topbar,
  .overview,
  .view-root {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
  }

  .shell {
    padding: 16px 12px 28px;
  }

  .sidebar {
    border-radius: 0 0 22px 22px;
    box-shadow: 0 12px 28px rgba(35, 49, 45, .14);
  }

  .brand {
    padding-bottom: 4px;
  }

  .nav-item {
    grid-template-columns: 24px auto;
    min-height: 38px;
    border-radius: 13px;
    padding: 0 10px;
    max-width: max-content;
  }

  .nav-item[data-view="dashboard"] { order: 1; }
  .nav-item[data-view="calculator"] { order: 2; }
  .nav-item[data-view="costFinder"] { order: 3; }
  .nav-item[data-view="ledger"] { order: 4; }
  .nav-item[data-view="bills"] { order: 5; }
  .nav-item[data-view="payments"] { order: 6; }
  .nav-item[data-view="fixed"] { order: 7; }
  .nav-item[data-view="reconcile"] { order: 8; }
  .nav-item[data-view="factory"] { order: 9; }
  .nav-item[data-view="data"] { order: 10; }
  .nav-item[data-view="approvals"] { order: 11; }

  .nav-item::before {
    width: 24px;
    height: 24px;
    border-radius: 8px;
  }

  .topbar {
    border-radius: 22px;
    padding: 16px;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .metric,
  .dashboard-summary > div {
    min-width: 0;
  }

  .metric strong,
  .dashboard-summary span,
  .dashboard-summary small {
    width: auto;
  }

  .metric {
    min-height: 104px;
  }

  .panel,
  .customer-block,
  .toolbar {
    border-radius: 20px;
  }

  .table-wrap {
    padding: 0 10px 10px;
  }
}

.goal-progress {
  padding: 20px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, .98), rgba(238, 248, 235, .98));
}

.goal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.goal-top > div:first-child {
  min-width: 0;
}

.goal-top .tag,
.goal-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.goal-top h2 {
  margin: 10px 0 4px;
  font-size: 21px;
}

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

.goal-percent {
  min-width: 132px;
  padding: 12px 14px;
  border: 1px solid rgba(35, 49, 45, .08);
  border-radius: 18px;
  text-align: right;
  background: #fff8dd;
  box-shadow: 0 8px 20px rgba(35, 49, 45, .06);
}

.goal-percent strong {
  display: block;
  color: var(--accent-dark);
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.goal-percent span {
  display: block;
  margin-top: 6px;
  color: #83601c;
  font-size: 12px;
  font-weight: 900;
}

.goal-percent.done {
  background: var(--mint);
}

.goal-percent.done span {
  color: var(--accent-dark);
}

.goal-track {
  height: 14px;
  margin: 8px 0 14px;
  border: 1px solid rgba(35, 49, 45, .06);
  background: #e9f0e5;
}

.goal-foot {
  flex-wrap: wrap;
  margin-top: 0;
}

.goal-foot span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(35, 49, 45, .06);
}

@media (max-width: 620px) {
  .sync-role-grid {
    grid-template-columns: 1fr;
  }

  .sync-role-card {
    min-height: 92px;
  }

  .data-sync-connect {
    grid-template-columns: 1fr;
  }

  .data-sync-connect button {
    width: 100%;
  }

  .data-sync-package {
    align-items: stretch;
    flex-direction: column;
  }

  .data-sync-package-actions {
    justify-content: stretch;
  }

  .data-sync-package-actions button {
    flex: 1 1 140px;
  }

  .data-safety-head {
    flex-direction: column;
  }

  .data-safety-actions,
  .data-safety-actions button {
    width: 100%;
  }

  .data-safety-grid {
    grid-template-columns: 1fr;
  }

  .data-safety-grid article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .data-safety-grid article:last-child {
    border-bottom: 0;
  }

  .data-safety-alert,
  .backup-list-head,
  .backup-row {
    align-items: stretch;
    flex-direction: column;
  }

  .data-safety-alert {
    grid-template-columns: 1fr;
  }

  .goal-progress {
    padding: 16px;
  }

  .goal-top {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .goal-percent {
    min-width: 0;
    text-align: left;
  }

  .goal-percent strong {
    font-size: 30px;
  }

  .goal-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .goal-foot span {
    justify-content: space-between;
    width: 100%;
  }

  .data-management-head,
  .data-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .data-actions {
    width: 100%;
  }

  .data-status-grid {
    grid-template-columns: 1fr;
  }

  .data-status-grid article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .data-status-grid article:last-child {
    border-bottom: 0;
  }

  .lan-sync-head,
  .lan-sync-grid,
  .lan-connect-row {
    grid-template-columns: 1fr;
  }

  .lan-sync-head {
    display: grid;
  }

  .login-screen {
    padding: 16px;
  }

  .login-screen::after {
    width: 92vw;
  }

  .login-card {
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
    padding: 16px;
    border-radius: 24px;
  }

  .login-brand-panel {
    min-height: 210px;
    padding: 24px;
    border-radius: 20px;
  }

  .login-emblem {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-size: 19px;
  }

  .login-brand-panel h1 {
    font-size: 42px;
  }

  .login-form-head,
  .login-card > label,
  .login-options,
  .form-error,
  .login-button,
  .login-register-button {
    grid-column: 1;
  }

  .login-options {
    flex-direction: row;
  }

  .welcome-card {
    width: calc(100vw - 36px);
    padding: 0 12px;
  }

  .welcome-card h2 {
    font-size: 36px;
  }

  .welcome-card p {
    max-width: 280px;
    font-size: 16px;
  }

  .welcome-effect {
    width: 94vw;
  }

  .welcome-screen {
    place-items: center;
    padding: 20px;
  }

  .welcome-card {
    justify-self: center;
    justify-items: center;
    width: calc(100vw - 36px);
    padding: 0;
    text-align: center;
  }

  .welcome-effect {
    top: 54%;
    right: auto;
    left: 50%;
    width: 82vw;
    opacity: .38;
    transform: translate(-50%, -50%);
  }

  @keyframes scenePanelIn {
    0%, 100% { transform: translate(-50%, -50%) perspective(900px) rotateY(-5deg); }
    50% { transform: translate(-50%, -53%) perspective(900px) rotateY(0deg); }
  }
}

#entryDialog {
  width: min(1180px, calc(100vw - 28px));
}

.entry-card {
  height: min(92vh, 860px);
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

.entry-card .dialog-head {
  position: sticky;
  top: 0;
  z-index: 5;
  flex: 0 0 auto;
  background: #fff;
}

.entry-card .dialog-actions {
  z-index: 5;
  flex: 0 0 auto;
  margin-top: 10px;
  padding-top: 12px;
  background: #fff;
}

.entry-head-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#entryForm {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

#entryForm > .form-grid,
.entry-tools-grid,
#entryForm > .continue-entry {
  flex: 0 0 auto;
}

.entry-items-panel {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
  overflow: hidden;
}

.entry-items-head,
.entry-items-summary,
.entry-tools-grid,
.continue-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-items-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf9;
}

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

.entry-items-head span,
.entry-items-summary span,
#entryCostHint {
  color: var(--muted);
  font-size: 12px;
}

.entry-items-wrap {
  min-height: 220px;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
}

.entry-items-table {
  min-width: 1120px;
  width: 100%;
  border-collapse: collapse;
}

.entry-items-table th,
.entry-items-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.entry-items-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f5f8f1;
  font-size: 12px;
  font-weight: 900;
}

.entry-items-table input,
.entry-items-table select,
.entry-tools-grid input,
.entry-tools-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 9px;
  background: #fff;
  color: var(--text);
}

.entry-items-table .entry-row-item { min-width: 160px; }
.entry-items-table .entry-row-spec { min-width: 120px; }
.entry-items-table .entry-row-factory { min-width: 120px; }
.entry-items-table .entry-row-category { min-width: 120px; }
.entry-items-table .entry-row-unit { min-width: 62px; }
.entry-items-table .entry-row-actions { width: 74px; }

.entry-items-summary {
  position: sticky;
  bottom: 0;
  z-index: 3;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.entry-items-summary strong {
  color: var(--accent-dark);
}

.entry-tools-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  margin-top: 14px;
}

.entry-tools-grid label {
  display: grid;
  gap: 6px;
}

#entryForm > .continue-entry {
  justify-content: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(32, 91, 66, 0.16);
  border-radius: 14px;
  background: #f2f7ec;
  color: var(--text);
  font-weight: 800;
}

#entryForm > .continue-entry input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

#entryDialog.editing-entry [data-action="add-entry-row"] {
  display: none;
}

@media (max-width: 980px) {
  .entry-head-grid,
  .entry-tools-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 760px) {
  .entry-card {
    height: calc(100vh - 18px);
  }

  .entry-items-wrap {
    min-height: 150px;
  }
}
