:root {
  --brand: #315e51;
  --brand-dark: #24483f;
  --brand-soft: #e6efe8;
  --accent: #739784;
  --accent-soft: #edf3ee;
  --bg: #f3f5f0;
  --surface: #fff;
  --surface-muted: #eef2ec;
  --line: #dde4dc;
  --danger: #a94d45;
  --text: #26332d;
  --muted: #748078;
  --shadow: 0 20px 55px rgba(30, 48, 41, .07);
  --shadow-soft: 0 5px 20px rgba(30, 48, 41, .045);
  --sidebar-width: 236px;
}

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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 4%, rgba(184, 207, 191, .28), transparent 25rem),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.58;
  letter-spacing: 0;
}

body:has(.topbar) {
  padding-left: var(--sidebar-width);
}

a {
  text-underline-offset: 3px;
}

.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  min-height: 100vh;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow-y: auto;
  background: #edf2eb;
  border-right: 1px solid #dce4dc;
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  gap: 12px;
  margin: 0 6px 34px;
  font-size: 16px;
  font-weight: 730;
  letter-spacing: .01em;
  color: #29483f;
}

.brand-symbol {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #dce9df;
  color: #315c50;
  font-size: 16px;
  box-shadow: none;
}

.nav-links {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.nav-links::before {
  content: "工作导航";
  margin: 0 12px 10px;
  color: #8a978e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}

.nav-links a {
  position: relative;
  padding: 11px 13px 11px 38px;
  border-radius: 10px;
  color: #52645b;
  font-size: 14px;
  font-weight: 590;
}

.nav-links a::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1.5px solid #8da69a;
  border-radius: 3px;
  transform: translateY(-50%);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: #dfe9e1;
  color: #294f44;
}

.nav-links a:hover::before,
.nav-links a:focus-visible::before {
  border-color: #6f9583;
  background: #6f9583;
}

.nav-links .account-nav-link {
  color: #e9dcc1;
}

.nav-links .account-nav-link::before {
  border-color: #c9aa72;
  border-radius: 50%;
}

.topbar .grow {
  display: block;
  flex: 1;
  min-height: 28px;
}

.user-area {
  display: grid;
  gap: 9px;
  padding-top: 18px;
  border-top: 1px solid #d7e0d8;
}

.user-chip {
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #43564d;
  font-size: 13px;
}

.user-chip::before {
  content: "当前账号  ";
  color: #8a978f;
}

.user-area form,
.user-area button {
  width: 100%;
}

.topbar .secondary {
  padding: 8px 12px;
  background: #e2e9e2;
  border: 1px solid #d4ded5;
  color: #41574d;
  box-shadow: none;
}

.container {
  width: min(100%, 1480px);
  max-width: none;
  margin: 0 auto;
  padding: 42px 42px 76px;
}

h1,
h2,
h3 {
  color: var(--text);
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(27px, 2.4vw, 35px);
  line-height: 1.16;
  font-weight: 720;
  letter-spacing: -.04em;
}

h2 {
  font-size: 18px;
  font-weight: 690;
  letter-spacing: -.02em;
}

.eyebrow {
  margin-bottom: 7px;
  color: #6f806f;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .16em;
}

.page-heading {
  align-items: center;
  margin-bottom: 25px;
}

.page-heading h1 {
  margin-bottom: 0;
}

.page-heading p:not(.eyebrow) {
  max-width: 720px;
  margin-top: 7px;
  color: var(--muted);
}

.card {
  margin-bottom: 18px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(216, 217, 207, .82);
  border-radius: 16px;
  background: rgba(255, 254, 250, .94);
  box-shadow: var(--shadow-soft);
}

.card:hover {
  border-color: #d9dbd0;
}

.grid {
  gap: 14px;
}

.field {
  gap: 6px;
}

.field label {
  color: #59635d;
  font-size: 12px;
  font-weight: 640;
}

input,
select,
textarea,
button,
.button {
  min-height: 42px;
  padding: 9px 12px;
  border-color: #d9ddd6;
  border-radius: 9px;
}

input,
select,
textarea {
  background: #fff;
  color: #28312d;
}

input::placeholder,
textarea::placeholder {
  color: #a1a7a2;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #76978c;
  box-shadow: 0 0 0 3px rgba(42, 95, 80, .1);
}

button,
.button {
  background: #214f45;
  color: #fff;
  font-weight: 650;
  box-shadow: none;
}

button:hover,
.button:hover {
  background: #183f37;
  transform: translateY(-1px);
}

.secondary {
  background: #f0f1ec;
  color: #42524b;
}

.secondary:hover {
  background: #e6e9e2;
}

.danger {
  background: #a94d45;
}

.flash {
  padding: 13px 15px;
  border-color: #cde2d8;
  border-radius: 10px;
  background: #edf6f1;
  color: #285b4d;
}

.flash.error {
  border-color: #ecd3d0;
  background: #fff3f1;
  color: #94473f;
}

.table-wrap {
  border-color: #e4e5dd;
  border-radius: 12px;
  background: #fffefa;
  box-shadow: none;
}

table {
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  border-bottom-color: #ecece5;
}

th {
  background: #f3f4ef;
  color: #69736d;
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .04em;
}

tbody tr:hover {
  background: #fafaf6;
}

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

.hero {
  min-height: 0;
  margin-bottom: 22px;
  padding: 30px 32px;
  border: 1px solid #dfe4db;
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 18%, rgba(182, 204, 193, .27), transparent 17rem),
    #fffefa;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.hero::after {
  display: none;
}

.hero .eyebrow {
  color: #6e806f;
}

.hero h1 {
  margin-bottom: 8px;
  color: #1c2d27;
  font-size: clamp(29px, 3vw, 40px);
  font-weight: 710;
}

.hero p {
  color: #6f7973;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 13px;
  margin-bottom: 24px;
}

.overview-card {
  position: relative;
  min-height: 132px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid #e1e2da;
  border-radius: 15px;
  background: rgba(255, 254, 250, .96);
  box-shadow: var(--shadow-soft);
}

.overview-card::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9caf9f;
  box-shadow: 0 0 0 5px #edf3ee;
}

.overview-card.purchase::after {
  background: #c09a62;
  box-shadow: 0 0 0 5px #f6efe4;
}

.overview-card.account::after {
  background: #627e75;
}

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

.overview-card span {
  color: #79817c;
  font-size: 12px;
  font-weight: 630;
}

.overview-card strong {
  margin: 15px 0 7px;
  color: #25362f;
  font-size: clamp(22px, 2.2vw, 29px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}

.overview-card small {
  color: #959b96;
  font-size: 11px;
}

.entity-hero {
  margin-bottom: 18px;
}

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

.entity-card {
  position: relative;
  min-height: 390px;
  padding: 25px;
  overflow: hidden;
  border: 1px solid #dddfd6;
  border-radius: 18px;
  background: rgba(255, 254, 250, .97);
  box-shadow: var(--shadow-soft);
}

.entity-card::after {
  content: "";
  position: absolute;
  right: -75px;
  bottom: -95px;
  width: 230px;
  height: 230px;
  border: 48px solid rgba(58, 97, 84, .045);
  border-radius: 50%;
  pointer-events: none;
}

.entity-xingping::after {
  border-color: rgba(173, 135, 77, .055);
}

.entity-card > * {
  position: relative;
  z-index: 1;
}

.entity-card-head,
.entity-card-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
}

.entity-card-head h2 {
  margin: 0;
  font-size: 24px;
}

.entity-card-head .eyebrow {
  margin: 0 0 2px;
}

.entity-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #eaf2ed;
  color: #2f5d50;
  font-size: 18px;
  font-weight: 760;
}

.entity-xingping .entity-mark {
  background: #f5eee3;
  color: #8a6338;
}

.entity-independent {
  padding: 5px 10px;
  border-radius: 999px;
  background: #edf3ef;
  color: #49675d;
  font-size: 11px;
  font-weight: 690;
}

.entity-xingping .entity-independent {
  background: #f6efe5;
  color: #80613d;
}

.entity-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 28px 0 24px;
}

.entity-metrics > div {
  min-height: 94px;
  padding: 15px;
  border: 1px solid #e6e7df;
  border-radius: 12px;
  background: #f8f8f4;
}

.entity-metrics span,
.entity-metrics strong {
  display: block;
}

.entity-metrics span {
  margin-bottom: 10px;
  color: #808782;
  font-size: 11px;
}

.entity-metrics strong {
  overflow-wrap: anywhere;
  color: #2d423a;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.entity-xingping .entity-metrics strong {
  color: #5b4a37;
}

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

.entity-actions .account-entry {
  border: 1px solid #d4c09c;
  background: #faf3e7;
  color: #76582e;
}

.entity-actions .account-entry:hover {
  background: #f2e6d2;
}

.warehouse-grid {
  gap: 15px;
}

.warehouse {
  min-height: 215px;
  padding: 24px;
}

.warehouse::after {
  right: -52px;
  bottom: -66px;
  width: 150px;
  height: 150px;
  background: #f1f3ed;
}

.warehouse-mark {
  width: 42px;
  height: 42px;
  margin-bottom: 22px;
  border-radius: 12px;
  background: #edf3ef;
  color: #345e52;
  font-size: 16px;
}

.warehouse h2 {
  font-size: 20px;
}

.section-tabs {
  gap: 6px;
  margin-bottom: 20px;
  padding: 5px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #e3e4dc;
  border-radius: 12px;
  background: #efefe9;
}

.section-tabs .button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 8px;
}

.section-tabs .secondary {
  background: transparent;
}

.smart-entry-card {
  border-color: #dbe4dd;
  background: #fffefa;
}

.smart-entry-card::before {
  content: "";
  display: block;
  width: 38px;
  height: 3px;
  margin: -22px 0 19px;
  border-radius: 99px;
  background: #b79058;
}

.smart-input-block {
  padding: 16px;
  border-color: #e5e7df;
  border-radius: 11px;
  background: #f8f8f4;
}

.smart-input-block > label {
  color: #3a5149;
}

.mic-button.compact {
  background: #214f45;
}

.mic-icon {
  color: #e6c994;
}

.daily-card,
.filter-card {
  background: rgba(255, 254, 250, .97);
}

.daily-inventory-card { background: rgba(255,254,250,.98); }
.daily-inventory-head { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:22px; }
.daily-inventory-head h2 { margin-bottom:6px; }
.daily-date-loader { display:flex; align-items:flex-end; gap:8px; }
.daily-date-loader label { display:grid; gap:6px; color:#66766f; font-size:13px; font-weight:700; }
.daily-date-loader button { min-height:43px; }
.daily-unit-row { display:flex; align-items:flex-end; gap:18px; margin-bottom:14px; }
.daily-unit-row .field { width:190px; }
.daily-unit-row p { margin-bottom:10px; }
.daily-product strong { color:#294c42; font-size:15px; }
.daily-entry-table input { min-width:100px; }
.daily-entry-table tfoot th { background:#eef3ee; color:#35574d; }

.metric-grid {
  gap: 13px;
}

.metric-card {
  padding: 21px;
  border-color: #e1e2da;
  border-radius: 15px;
  background: #fffefa;
  box-shadow: var(--shadow-soft);
}

.metric-card::after {
  display: none;
}

.metric-card strong {
  font-size: 28px;
  font-weight: 700;
}

.metric-card.receivable {
  border-top: 3px solid #759b8e;
}

.metric-card.payable {
  border-top: 3px solid #c19a64;
}

.metric-card.net {
  border: 1px solid #d7e3da;
  border-top: 3px solid #7fa18f;
  background: #eaf2ec;
  color: #28463d;
}

.metric-card.net span,
.metric-card.net small {
  color: #6d7e75;
}

.metric-card.net strong {
  color: #2b5146;
}

.partner-list-card {
  overflow: visible;
}

.partner-ledger-row {
  border-top-color: #ebebe4;
}

.partner-ledger-row:hover {
  background: #f8f8f3;
}

.partner-avatar {
  border-radius: 50%;
  background: #edf3ef;
  color: #315a4e;
}

.net-pill.positive,
.type-销售,
.type-收款,
.status-confirmed {
  background: #edf5f0;
  color: #356958;
}

.net-pill.negative,
.type-采购,
.type-付款 {
  background: #f8efe7;
  color: #93613f;
}

.popover-card {
  border-color: #dedfd6;
  background: #fffefa;
  box-shadow: 0 24px 60px rgba(28, 47, 39, .14);
}

.segmented {
  background: #eff0eb;
}

.segmented input:checked + span {
  background: #fffefa;
  color: #235347;
}

.accent-button {
  background: #b48a4a;
}

.accent-button:hover {
  background: #9b733a;
}

.soft-note {
  background: #f7f0e4;
  color: #795d32;
}

.auth-shell {
  border: 1px solid #dfe1d8;
  background: #fffefa;
  box-shadow: 0 30px 80px rgba(28, 47, 39, .12);
}

.auth-brand {
  background: #e3ece4;
  color: #29473e;
}

.auth-brand::after {
  border-color: rgba(76, 118, 96, .09);
}

.auth-brand p,
.auth-brand .eyebrow {
  color: #667970;
}

.auth-form {
  background: #fffefa;
}

.mail-side-note,
.partner-compact,
.permission-editor {
  background: #f6f7f2;
}

.account-sidebar {
  top: 24px;
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 210px;
  }

  .container {
    padding: 34px 27px 64px;
  }

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

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

@media (max-width: 760px) {
  body:has(.topbar) {
    padding-left: 0;
    padding-bottom: 72px;
  }

  .topbar {
    inset: auto 0 0;
    width: 100%;
    min-height: 0;
    height: 66px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    overflow: hidden;
    flex-direction: row;
    background: rgba(243, 247, 242, .98);
    border-top: 1px solid #d9e3da;
    box-shadow: 0 -10px 30px rgba(43, 66, 55, .08);
  }

  .brand,
  .topbar .grow,
  .user-area {
    display: none;
  }

  .nav-links {
    width: 100%;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar,
  .nav-links::before {
    display: none;
  }

  .nav-links a {
    flex: 0 0 auto;
    min-width: 86px;
    padding: 8px 10px 7px;
    text-align: center;
    font-size: 11px;
    color: #4c6257;
  }

  .nav-links a::before {
    position: static;
    display: block;
    margin: 0 auto 4px;
    transform: none;
  }

  .container {
    margin: 0 auto;
    padding: 22px 14px 38px;
  }

  .hero {
    padding: 24px 21px;
    border-radius: 15px;
  }

  .hero h1 {
    font-size: 28px;
  }

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

  .overview-card {
    min-height: 118px;
    padding: 16px;
  }

  .overview-card strong {
    margin-top: 13px;
    font-size: 21px;
  }

  .entity-card {
    min-height: 0;
    padding: 19px;
  }

  .entity-card-head {
    align-items: flex-start;
  }

  .entity-metrics {
    margin: 22px 0 18px;
  }

  .entity-metrics strong {
    font-size: 16px;
  }

  .warehouse {
    min-height: 0;
  }

  .page-heading {
    margin-bottom: 19px;
  }

  .card {
    padding: 16px;
    border-radius: 13px;
  }

  .smart-entry-card::before {
    margin: -16px 0 15px;
  }

  .section-tabs {
    width: 100%;
  }

  .daily-inventory-head { align-items:stretch; flex-direction:column; }
  .daily-date-loader { width:100%; }
  .daily-date-loader label { flex:1; }
  .daily-unit-row { align-items:stretch; flex-direction:column; gap:4px; }
  .daily-unit-row .field { width:100%; }

  .metric-card strong {
    font-size: 25px;
  }
}

@media (max-width: 430px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .overview-card {
    min-height: 105px;
  }

  .overview-card strong {
    margin: 10px 0 5px;
  }
}
