/* 汇单: translucent controls, opaque business content, finite tactile feedback. */
:root {
  --glass-edge:rgb(255 255 255 / 82%);
  --glass-line:rgb(42 74 57 / 12%);
  --glass-shadow:0 8px 28px rgb(27 44 34 / 9%),inset 0 1px 0 rgb(255 255 255 / 85%);
  --motion-press:220ms;
  --motion-feedback:180ms;
  --motion-surface:280ms;
  --motion-ease:cubic-bezier(.2,.8,.2,1);
  --motion-spring:cubic-bezier(.16,1.28,.3,1);
}

/* Materials have an opaque fallback. Blur is restricted to a handful of floating layers. */
/* Shared by portals and the management workspace, including native image dialogs. */
html[data-portal-scroll-locked] { overflow:hidden; overscroll-behavior:none; }
html[data-portal-scroll-locked] body:is(.client-body,.admin-workspace) {
  position:fixed; top:var(--portal-scroll-y); left:var(--portal-scroll-x); width:100%;
  overflow:hidden; padding-right:var(--portal-scroll-gutter); overscroll-behavior:none;
}
html[data-portal-scroll-locked] .admin-workspace #page { overflow:hidden; }
.admin-workspace .overlay { overflow:hidden; overscroll-behavior:none; }
.admin-workspace .modal-body,.admin-workspace .evidence-preview-stage {
  min-height:0; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
}
.topbar,.client-header,.inventory-more-menu,.modal,.platform-body dialog { background:#fff; }
.topbar {
  position:relative; z-index:30;
  border-bottom:1px solid var(--glass-line);
  box-shadow:0 1px 0 rgb(255 255 255 / 75%);
}
.client-header { border-radius:16px; padding-left:12px; padding-right:12px; border:1px solid var(--glass-line); }
.inventory-more-menu { border:1px solid var(--glass-edge); box-shadow:var(--glass-shadow),0 16px 40px rgb(27 44 34 / 12%); border-radius:16px; transform-origin:top right; }
.modal,.platform-body dialog {
  border:1px solid var(--glass-edge); border-radius:20px;
  box-shadow:0 24px 80px rgb(17 32 23 / 22%),inset 0 1px 0 rgb(255 255 255 / 95%);
}
.overlay { background:rgb(22 36 28 / 28%); }
.modal-head { background:rgb(255 255 255 / 42%); border-bottom-color:var(--glass-line); }
.modal-foot { background:rgb(255 255 255 / 58%); border-top-color:var(--glass-line); }
.platform-body dialog::backdrop { background:rgb(22 36 28 / 28%); }
.sidebar { border-right:1px solid rgb(255 255 255 / 8%); }

@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
  .topbar,.client-header {
    background:rgb(255 255 255 / 78%);
    -webkit-backdrop-filter:blur(18px) saturate(145%);
    backdrop-filter:blur(18px) saturate(145%);
  }
  .sidebar {
    background:rgb(28 40 33 / 93%);
    -webkit-backdrop-filter:blur(16px) saturate(120%);
    backdrop-filter:blur(16px) saturate(120%);
  }
  .inventory-more-menu {
    background:rgb(255 255 255 / 90%);
    -webkit-backdrop-filter:blur(20px) saturate(150%);
    backdrop-filter:blur(20px) saturate(150%);
  }
  .modal,.platform-body dialog {
    background:rgb(251 254 252 / 94%);
    -webkit-backdrop-filter:blur(16px) saturate(135%);
    backdrop-filter:blur(16px) saturate(135%);
  }
  .overlay,.platform-body dialog::backdrop {
    -webkit-backdrop-filter:blur(4px);
    backdrop-filter:blur(4px);
  }
}

/* Controls react immediately, without moving the layout or waiting for a request. */
[data-ui-tactile] { position:relative; overflow:hidden; }
.ui-touch-glint {
  position:absolute; pointer-events:none; border-radius:50%; z-index:2; opacity:0;
  background:radial-gradient(circle,rgb(255 255 255 / 80%),rgb(235 255 244 / 32%) 42%,transparent 70%);
}
.button,.icon-button,.link-button,.nav button,.platform-body button,.inventory-more>summary {
  -webkit-tap-highlight-color:transparent;
  transition:
    transform var(--motion-press) var(--motion-spring),
    background-color var(--motion-feedback) var(--motion-ease),
    border-color var(--motion-feedback) var(--motion-ease),
    box-shadow var(--motion-feedback) var(--motion-ease),
    color var(--motion-feedback) var(--motion-ease);
  transform-origin:center;
  touch-action:manipulation;
}
.button:not(.ghost),.platform-body button,.inventory-more>summary {
  background-image:linear-gradient(180deg,rgb(255 255 255 / 30%),rgb(255 255 255 / 0%));
  box-shadow:0 1px 2px rgb(23 44 31 / 4%),inset 0 1px 0 rgb(255 255 255 / 70%);
}
.button.primary,.platform-body button.primary {
  background-color:var(--ui-accent);
  background-image:linear-gradient(180deg,rgb(255 255 255 / 10%),transparent);
  box-shadow:0 3px 8px rgb(23 44 31 / 10%),inset 0 1px 0 rgb(255 255 255 / 24%);
}
.button:not(:disabled):active,.icon-button:not(:disabled):active,.link-button:not(:disabled):active,
.nav button:not(:disabled):active,.platform-body button:not(:disabled):active,.inventory-more>summary:active {
  transform:scale(.965);
  transition-duration:70ms;
}
.button:disabled,.platform-body button:disabled { transform:none; }
.nav button.active { box-shadow:inset 0 1px 0 rgb(255 255 255 / 10%); }
.client-nav .button.active,.purchase-tabs .button.active {
  box-shadow:inset 0 1px 0 rgb(255 255 255 / 85%),0 2px 6px rgb(27 44 34 / 5%);
}
.inventory-more>summary svg { transition:transform 220ms var(--motion-spring); }
.inventory-more[open]>summary svg { transform:rotate(180deg); }
.inventory-more-menu .button,.purchase-tabs .button { background-image:none; box-shadow:none; }
.inventory-more-menu .button:not(:disabled):hover { box-shadow:none; background:rgb(226 237 230 / 65%); }
.field input,.field select,.field textarea,.input,.platform-body input,.platform-body select {
  transition:border-color var(--motion-feedback) var(--motion-ease),box-shadow var(--motion-feedback) var(--motion-ease),background-color var(--motion-feedback) var(--motion-ease);
}
.field input:focus-visible,.field select:focus-visible,.field textarea:focus-visible,.input:focus-visible,
.platform-body input:focus-visible,.platform-body select:focus-visible {
  box-shadow:0 0 0 3px rgb(0 117 95 / 10%);
}
tbody tr,.purchase-card,.activity-card,.stat,.platform-body .system {
  transition:background-color 160ms var(--motion-ease),border-color 160ms var(--motion-ease);
}
@media(hover:hover) and (pointer:fine) {
  .button:not(:disabled):active,.icon-button:not(:disabled):active,.link-button:not(:disabled):active,
  .nav button:not(:disabled):active,.platform-body button:not(:disabled):active,.inventory-more>summary:active { transform:scale(.985); }
  .button:not(:disabled):hover,.platform-body button:not(:disabled):hover,.inventory-more>summary:hover {
    box-shadow:0 3px 10px rgb(27 44 34 / 8%),inset 0 1px 0 rgb(255 255 255 / 80%);
  }
  .button.primary:not(:disabled):hover,.platform-body button.primary:not(:disabled):hover {
    box-shadow:0 5px 14px rgb(27 44 34 / 13%),inset 0 1px 0 rgb(255 255 255 / 28%);
  }
}

/* Real submit feedback: ui-motion.js adds this state only while a submitted button is disabled. */
button.ui-busy {
  position:relative;
  color:transparent !important;
  opacity:.82;
  cursor:progress;
}
button.ui-busy::after {
  content:""; position:absolute; left:calc(50% - 7px); top:calc(50% - 7px);
  width:14px; height:14px; border:2px solid var(--ui-accent); border-right-color:transparent; border-radius:50%;
  animation:glass-working 700ms linear infinite;
}
button.primary.ui-busy::after { border-color:#fff; border-right-color:transparent; }
@keyframes glass-working { to { transform:rotate(360deg); } }

/* Notices float above the current work and do not cover mobile navigation. */
#toast,.platform-body #notice {
  display:block; visibility:hidden; opacity:0; pointer-events:none;
  border:1px solid rgb(255 255 255 / 25%);
  border-radius:16px; background:rgb(30 52 39 / 94%); color:#fff;
  box-shadow:0 8px 32px rgb(18 35 24 / 18%),inset 0 1px 0 rgb(255 255 255 / 15%);
  transform:translate(-50%,12px) scale(.97);
  transition:opacity 200ms var(--motion-ease),transform 260ms var(--motion-spring),visibility 200ms;
}
#toast.visible,.platform-body #notice.visible { opacity:1; visibility:visible; transform:translate(-50%,0) scale(1); }
#toast.error { background:rgb(135 48 56 / 96%); }
@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
  #toast,.platform-body #notice { -webkit-backdrop-filter:blur(12px) saturate(130%); backdrop-filter:blur(12px) saturate(130%); }
}

@media(max-width:800px) {
  .client-shell:not(.purchase-shell) .client-header,.buyer-page .purchase-shell .client-header {
    padding-left:12px; padding-right:12px; margin-top:8px;
    /* A filtered ancestor would capture the position:fixed bottom navigation. */
    -webkit-backdrop-filter:none; backdrop-filter:none;
  }
  .client-shell:not(.purchase-shell) .client-nav,.buyer-page .purchase-shell .client-nav {
    inset:auto 12px calc(10px + env(safe-area-inset-bottom));
    width:auto; max-width:calc(100% - 24px); margin:0;
    padding:8px; border:1px solid rgb(214 225 217 / 85%); border-radius:20px;
    background:#fff; box-shadow:var(--glass-shadow),0 8px 28px rgb(27 44 34 / 12%);
  }
  .client-shell:not(.purchase-shell) .client-nav .button,.buyer-page .purchase-shell .client-nav .button { border-radius:12px; }
  .client-body #toast { bottom:calc(88px + env(safe-area-inset-bottom)); }
  .modal,.platform-body dialog { border-radius:20px; }
  @supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
    .client-shell:not(.purchase-shell) .client-nav,.buyer-page .purchase-shell .client-nav {
      background:rgb(255 255 255 / 82%);
      -webkit-backdrop-filter:blur(20px) saturate(155%);
      backdrop-filter:blur(20px) saturate(155%);
    }
  }
}

/* Accessibility and older WebViews keep the same actions with solid, immediate feedback. */
@media(prefers-reduced-transparency:reduce), (prefers-contrast:more), (update:slow) {
  .ui-touch-glint { display:none; }
  .topbar,.client-header,.modal,.inventory-more-menu,.platform-body dialog,
  .client-shell:not(.purchase-shell) .client-nav,.buyer-page .purchase-shell .client-nav {
    background:#fff; -webkit-backdrop-filter:none; backdrop-filter:none;
  }
  .sidebar { background:#202824; -webkit-backdrop-filter:none; backdrop-filter:none; }
  .overlay,.platform-body dialog::backdrop { -webkit-backdrop-filter:none; backdrop-filter:none; }
}
@media(prefers-reduced-motion:reduce), (update:slow) {
  .ui-touch-glint { display:none; }
  .button,.icon-button,.link-button,.nav button,.platform-body button,.inventory-more>summary,
  .inventory-more>summary svg,.field input,.field select,.field textarea,.input,.platform-body input,.platform-body select,
  #toast,.platform-body #notice,tbody tr,.purchase-card,.activity-card,.stat,.platform-body .system {
    transition:none; animation:none;
  }
  .button:not(:disabled):active,.icon-button:not(:disabled):active,.link-button:not(:disabled):active,
  .nav button:not(:disabled):active,.platform-body button:not(:disabled):active,.inventory-more>summary:active { transform:none; }
  button.ui-busy::after { animation:none; }
  #toast,.platform-body #notice { transform:translate(-50%,0); }
}
@media(forced-colors:active) {
  .ui-touch-glint { display:none; }
  .topbar,.client-header,.modal,.inventory-more-menu,.platform-body dialog,
  .client-shell:not(.purchase-shell) .client-nav,.buyer-page .purchase-shell .client-nav { background:Canvas; color:CanvasText; -webkit-backdrop-filter:none; backdrop-filter:none; }
  .button,.platform-body button { background-image:none; box-shadow:none; }
}
