:root {
  --paper:#f5f3ed;
  --surface:#fdfcf8;
  --side:#f8f7f1;
  --ink:#21362b;
  --pine:#274a32;
  --deep:#17392a;
  --sage:#8fa288;
  --gold:#aa8d5c;
  --muted:#7a8377;
  --line:#e4e8de;
  --soft:#ebf0e5;
  --danger:#a55242;
  --amber:#9a7035;
  --side-width:226px;
  --sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei UI","Microsoft YaHei",sans-serif
}

* {
  box-sizing:border-box
}

body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font:14px/1.6 var(--sans);
  -webkit-font-smoothing:antialiased
}

button,input,select,textarea {
  font:inherit;
  color:inherit
}

button {
  border:0;
  background:none;
  padding:0;
  cursor:pointer
}

button:disabled {
  opacity:.5;
  cursor:not-allowed
}

button:hover:not(:disabled) {
  filter:brightness(.96)
}

a {
  color:inherit;
  text-decoration:none
}

button:focus-visible,a:focus-visible {
  outline:2px solid var(--sage);
  outline-offset:3px
}

input:focus,select:focus {
  outline:2px solid #8fa28845;
  border-color:var(--sage)
}

h1,h2,h3,h4,p {
  margin:0
}

h1,h2,h3,b,strong {
  font-weight:600
}

[v-cloak] {
  display:none!important
}

.ic {
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.65;
  stroke-linecap:round;
  stroke-linejoin:round;
  vertical-align:middle;
  flex:none
}

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

.small {
  font-size:12px
}

.tiny {
  font-size:11px
}

.green {
  color:var(--pine)
}

.money {
  font-variant-numeric:tabular-nums;
  font-weight:600;
  white-space:nowrap
}

.row {
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0
}

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

.grow {
  flex:1;
  min-width:0
}

.btn {
  min-height:39px;
  padding:9px 17px;
  border:1px solid transparent;
  border-radius:8px;
  background:var(--pine);
  color:var(--surface);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  font-size:13px;
  white-space:nowrap;
  line-height:1.45
}

.btn.outline {
  color:var(--ink);
  border-color:#d8dfd0;
  background:transparent
}

.text-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  color:var(--pine);
  font-size:12px;
  min-height:28px;
  white-space:nowrap
}

.icon-btn {
  width:34px;
  height:34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:7px;
  flex:none
}

.icon-btn:hover {
  background:var(--soft)
}

.pill {
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:11px;
  line-height:1.5;
  padding:4px 8px;
  border-radius:5px;
  white-space:nowrap;
  color:var(--pine);
  background:var(--soft)
}

.pill.gray {
  color:var(--muted);
  background:#eeefe9
}

.pill.amber {
  color:var(--amber);
  background:#f6eddd
}

.pill.red {
  color:var(--danger);
  background:#f7e9e2
}

.pill.dot:before {
  content:"";
  width:5px;
  height:5px;
  border-radius:50%;
  background:currentColor
}

.input,select {
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:7px;
  min-height:37px;
  padding:8px 11px;
  font-size:13px;
  min-width:0
}

input::placeholder {
  color:#9aa18f
}

.segmented {
  display:flex;
  align-items:center;
  padding:3px;
  gap:3px;
  background:#eaede3;
  border-radius:8px
}

.segmented button {
  font-size:12px;
  padding:5px 11px;
  border-radius:5px;
  white-space:nowrap;
  color:#7e8875
}

.segmented button.active {
  background:var(--surface);
  color:var(--pine);
  font-weight:600;
  box-shadow:0 1px 5px #263f2210
}

.surface {
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:11px;
  min-width:0;
  overflow:hidden
}

.surface h2 {
  font-size:16px
}

.surface h3 {
  font-size:14px
}

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

.panel-head p {
  font-size:11px;
  color:var(--muted);
  margin-top:4px
}

.empty {
  padding:44px 20px;
  text-align:center;
  color:var(--muted);
  font-size:12px
}

.empty h3 {
  font-size:15px;
  color:var(--pine);
  margin-bottom:6px
}

/* Shared navigation shell. Each business module supplies its own HTML entry. */
.sidebar {
  position:fixed;
  inset:0 auto 0 0;
  width:var(--side-width);
  background:var(--side);
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
  z-index:30
}

.brand {
  display:flex;
  align-items:center;
  gap:10px;
  padding:25px 22px 20px;
  text-align:left;
  width:100%
}

.brand .ic {
  width:34px;
  height:34px;
  color:var(--pine);
  stroke-width:1.45
}

.brand strong {
  font-size:20px;
  letter-spacing:1px;
  display:block;
  color:var(--deep)
}

.brand small {
  font-size:8px;
  letter-spacing:1.8px;
  color:#8c9780;
  display:block;
  margin-top:2px
}

.store {
  display:flex;
  align-items:center;
  gap:9px;
  padding:11px 12px;
  background:#f0f2e9;
  border:1px solid var(--line);
  border-radius:9px;
  margin:0 14px 13px
}

.store .ic {
  color:#8a9c7d
}

.store b {
  display:block;
  font-size:12px
}

.store small {
  display:block;
  font-size:10px;
  color:var(--muted)
}

.store>i {
  width:6px;
  height:6px;
  border-radius:50%;
  background:#a4b98c;
  margin-left:auto
}

.nav-search {
  margin:0 14px 12px;
  display:flex;
  align-items:center;
  gap:7px;
  border:1px solid var(--line);
  border-radius:7px;
  padding:6px 9px;
  color:#8a997d
}

.nav-search input {
  border:0;
  outline:0;
  width:100%;
  background:transparent;
  font-size:11px;
  min-width:0
}

.nav-search .ic {
  width:13px;
  height:13px
}

.nav-list {
  flex:1;
  overflow:auto;
  scrollbar-width:thin;
  scrollbar-color:#d6dece transparent;
  padding:0 10px 18px
}

.nav-group {
  margin-top:10px
}

.nav-group-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  width:100%;
  font-size:11px;
  color:#7e8c73;
  padding:10px 12px 7px
}

.nav-group-heading .ic {
  width:11px;
  height:11px
}

.nav-link {
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  border-radius:7px;
  min-height:37px;
  padding:8px 12px;
  margin:2px 0;
  text-align:left;
  color:#64745b;
  font-size:12px;
  position:relative
}

.nav-link .ic {
  width:17px;
  height:17px;
  color:#889c7b
}

.nav-link.active {
  background:#e5edde;
  color:var(--pine);
  font-weight:600
}

.nav-link.active:before {
  content:"";
  position:absolute;
  left:0;
  top:11px;
  bottom:11px;
  width:3px;
  background:var(--pine);
  border-radius:2px
}

.nav-link:hover {
  background:#edf1e6
}

.side-bottom {
  padding:15px 18px;
  border-top:1px solid var(--line);
  display:flex;
  align-items:center;
  gap:6px;
  font-size:10px;
  color:#829074
}

.side-bottom .ic {
  width:13px;
  height:13px
}

.shell {
  margin-left:var(--side-width);
  min-width:0
}

.topbar {
  min-height:66px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  padding:0 28px;
  background:var(--surface);
  border-bottom:1px solid var(--line)
}

.crumb {
  font-size:12px;
  color:#8c9780;
  display:flex;
  align-items:center;
  gap:14px
}

.crumb b {
  color:var(--ink);
  font-weight:500
}

.top-right {
  display:flex;
  align-items:center;
  gap:14px
}

.global-search {
  display:flex;
  align-items:center;
  gap:8px;
  background:#f3f4ee;
  border:1px solid #e8ebe1;
  border-radius:7px;
  width:231px;
  height:33px;
  padding:0 11px;
  color:#7a876e;
  font-size:11px
}

.global-search .ic {
  width:14px;
  height:14px
}

.global-search kbd {
  margin-left:auto;
  font:10px var(--sans);
  padding:1px 4px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:3px
}

.user-avatar {
  width:32px;
  height:32px;
  border-radius:50%;
  background:#e6eddc;
  display:grid;
  place-items:center;
  font-size:12px;
  color:#6c805b
}

.user-info b {
  font-size:11px;
  display:block;
  font-weight:500
}

.user-info small {
  font-size:9px;
  color:var(--muted);
  display:block
}

.account-menu { position:relative }
.account-trigger { padding:7px 0; text-align:left }
.account-panel {
  position:absolute; right:0; top:100%; z-index:1000;
  width:230px; max-width:calc(100vw - 32px); padding:18px;
  display:flex; flex-direction:column; gap:8px;
  background:var(--surface); border:1px solid var(--line); border-radius:10px;
  box-shadow:0 10px 30px #21362b1a; color:var(--ink); font-size:12px;
  overflow-wrap:anywhere
}
.account-panel > span { color:var(--muted) }
.account-logout { margin-top:8px; width:100%; justify-content:center }
.account-trigger:focus-visible,.account-logout:focus-visible { outline:2px solid var(--pine); outline-offset:3px }
.account-error {
  position:fixed; right:24px; top:76px; z-index:1400; max-width:420px;
  padding:12px 18px; border-radius:8px; background:#33423b; color:#fff; font-size:12px
}

.mobile-menu {
  display:none
}

.main {
  padding:27px 28px 35px;
  max-width:1770px;
  margin:0 auto;
  min-height:calc(100vh - 66px)
}

.page-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-bottom:22px
}

.eyebrow {
  font-size:8px;
  letter-spacing:1.8px;
  color:var(--gold);
  margin-bottom:6px
}

.page-heading h1 {
  font-size:27px;
  line-height:1.45;
  letter-spacing:.3px
}

.page-heading p {
  font-size:12px;
  color:var(--muted);
  margin-top:6px
}

.heading-actions {
  display:flex;
  align-items:center;
  gap:9px;
  flex-wrap:wrap;
  justify-content:flex-end
}

.page-footer {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:25px;
  padding-top:17px;
  border-top:1px solid #e0e7d5;
  color:#7c8970;
  font-size:10px;
  gap:12px
}

/* Read-only drawers, shared by later modules. */
.overlay {
  position:fixed;
  inset:0;
  z-index:100;
  display:flex;
  justify-content:flex-end
}

.overlay-shade {
  position:absolute;
  inset:0;
  background:#162a2260
}

.drawer {
  position:relative;
  width:min(690px,100%);
  height:100%;
  display:flex;
  flex-direction:column;
  background:var(--surface);
  box-shadow:-15px 0 60px #162a221a
}

.drawer-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:23px 27px;
  border-bottom:1px solid var(--line);
  gap:12px
}

.drawer-header small {
  font-size:8px;
  letter-spacing:1.6px;
  color:var(--gold)
}

.drawer-header h2 {
  font-size:22px;
  margin-top:5px
}

.drawer-close {
  background:none;
  border:0;
  font-size:27px;
  font-weight:300;
  line-height:1
}

.drawer-body {
  overflow:auto;
  flex:1;
  padding:24px 27px
}

.drawer-footer {
  padding:16px 27px;
  border-top:1px solid var(--line);
  display:flex;
  justify-content:flex-end;
  gap:10px
}

.meta {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:20px;
  font-size:12px;
  padding:9px 0
}

.meta>span {
  color:var(--muted);
  flex:none
}

.meta>strong {
  text-align:right;
  font-weight:500;
  overflow-wrap:anywhere
}

.divider {
  height:1px;
  background:var(--line);
  margin:18px 0
}

.detail-section {
  font-size:14px;
  margin-bottom:12px
}

.toast {
  position:fixed;
  z-index:200;
  left:50%;
  top:30px;
  transform:translateX(-50%);
  padding:12px 20px;
  border-radius:9px;
  background:#2b342feb;
  color:#fff;
  box-shadow:0 8px 30px #17392a17;
  max-width:min(620px,90vw);
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font-size:13px
}

.pagination {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-left:auto;
  font-size:11px;
  gap:6px
}

.surface > .pagination {
  padding:14px 20px;
  border-top:1px solid var(--line)
}

.pagination button {
  flex-shrink:0;
  width:28px;
  height:28px;
  border:1px solid var(--line);
  border-radius:5px;
  font-size:11px;
  display:grid;
  place-items:center
}

.pagination button.active {
  background:#e6eedb;
  color:var(--pine)
}

.pagination .ic {
  width:12px;
  height:12px
}

.skip-link {
  position:fixed;
  top:-50px;
  left:240px;
  z-index:300;
  background:var(--pine);
  color:white;
  padding:8px 18px
}

.skip-link:focus {
  top:8px
}

.fatal {
  margin:60px auto;
  max-width:600px;
  padding:25px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:12px
}

.nav-backdrop {
  display:none
}

@media(min-width:1700px) {
  :root {
    --side-width:240px
  }
  .main {
    padding:32px 38px
  }
  .topbar {
    padding:0 38px
  }
}

@media(max-width:1100px) {
  .global-search {
    width:180px
  }
  .main {
    padding:24px 20px
  }
  .topbar {
    padding:0 20px
  }
  .heading-actions {
    gap:6px
  }
}

@media(max-width:850px) {
  .sidebar {
    display:none
  }
  .sidebar.open {
    display:flex
  }
  .nav-backdrop.open {
    display:block;
    position:fixed;
    inset:0;
    background:#162a2260;
    z-index:29
  }
  .shell {
    margin-left:0
  }
  .mobile-menu {
    display:inline-flex
  }
  .global-search {
    width:34px;
    padding:0;
    justify-content:center
  }
  .global-search span,.global-search kbd {
    display:none
  }
  .user-info {
    display:none
  }
  .topbar {
    padding:0 16px
  }
  .main {
    padding:22px 16px
  }
  .page-heading {
    align-items:flex-start;
    flex-wrap:wrap
  }
  .page-heading h1 {
    font-size:24px
  }
  .heading-actions {
    justify-content:flex-start
  }
  .skip-link {
    left:16px
  }
  .drawer-body {
    padding:20px
  }
  .drawer-header {
    padding:20px
  }
  .page-footer {
    flex-wrap:wrap
  }
}


/* Shared read-only historical item rows. */
.admin-item-lines { width:100%; font-size:12px; }
.admin-item-group { padding:12px 0; border-bottom:1px solid var(--line); }
.admin-item-group:last-child { border-bottom:0; }
.admin-item-group > .admin-item-name { display:block; font-weight:600; overflow-wrap:anywhere; }
.admin-item-line { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px 12px; margin-top:7px; }
.admin-item-line-amounts { grid-template-columns:minmax(0,1fr) auto auto; }
.admin-item-spec { min-width:0; overflow-wrap:anywhere; color:var(--muted); }
.admin-item-line .admin-item-spec small { display:block; margin:2px 0 0; color:var(--muted); font-size:11px; line-height:1.6; }
.admin-item-quantity,.admin-item-amount { white-space:nowrap; font-variant-numeric:tabular-nums; }
.admin-item-line .admin-item-amount { font-weight:500; }
.admin-item-lines-compact .admin-item-group { padding:7px 0; }

/* Shared category/product selection; all rules remain inside this control. */
.admin-product-tree { width:100%; max-height:360px; overflow:auto; border:1px solid var(--line); border-radius:10px; background:var(--surface,#fffdf7); }
.admin-product-tree-group + .admin-product-tree-group { border-top:1px solid var(--line); }
.admin-product-tree-heading { display:flex; align-items:center; gap:8px; min-height:42px; padding:8px 12px; background:rgba(39,74,50,.035); }
.admin-product-tree-toggle { display:flex; align-items:center; justify-content:center; flex:0 0 22px; width:22px; height:24px; padding:0; margin:0; border:0; border-radius:4px; background:transparent; color:var(--ink,#263d2d); cursor:pointer; }
.admin-product-tree-toggle svg { width:14px; height:14px; }
.admin-product-tree-category,.admin-product-tree-option { display:flex; align-items:center; gap:9px; margin:0; min-width:0; text-align:left; cursor:pointer; }
.admin-product-tree-category { flex:1; font-size:12px; font-weight:600; }
.admin-product-tree-category span { overflow-wrap:anywhere; }
.admin-product-tree input[type="checkbox"] { flex:0 0 14px; width:14px; height:14px; padding:0; margin:0; accent-color:var(--green,#274a32); }
.admin-product-tree-count { flex:0 0 auto; color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.admin-product-tree-option { padding:9px 12px 9px 43px; font-size:12px; line-height:1.6; }
.admin-product-tree-option + .admin-product-tree-option { border-top:1px solid rgba(39,74,50,.05); }
.admin-product-tree-copy { display:block; flex:1; min-width:0; overflow-wrap:anywhere; }
.admin-product-tree-copy small { display:block; margin:2px 0 0; color:var(--muted); font-size:10px; }
.admin-product-tree-price { margin-left:auto; flex:0 0 auto; font-size:11px; color:var(--muted); white-space:nowrap; font-variant-numeric:tabular-nums; }
.admin-product-tree-empty { padding:20px 12px; margin:0; color:var(--muted); font-size:12px; text-align:center; }
.admin-product-tree-toggle:focus-visible { outline:2px solid var(--green,#274a32); outline-offset:2px; }
@media(max-width:600px) { .admin-product-tree-option { padding-left:28px; }.admin-product-tree-heading { padding:8px; } }
.product-sort-handle { display:inline-flex; align-items:center; justify-content:center; flex:0 0 24px; width:24px; height:32px; padding:0; margin:0; border:0; border-radius:4px; background:transparent; color:var(--muted); font:22px/1 sans-serif; cursor:grab; user-select:none; }
.product-sort-handle:hover:not(:disabled) { background:var(--soft); color:var(--green,#274a32); }
.product-sort-handle:active:not(:disabled) { cursor:grabbing; }
.product-sort-handle:disabled { cursor:default; opacity:.4; }
.product-sort-handle:focus-visible { outline:2px solid var(--green,#274a32); outline-offset:2px; }
.product-sort-dragging { opacity:.5; }
.product-sort-before { box-shadow:0 -3px 0 var(--green,#274a32); }
.product-sort-after { box-shadow:0 3px 0 var(--green,#274a32); }
