/* Astryx Airy/Editorial Mobile H5 UI - 浪石进销存系统 */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-background-body);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-text-primary);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.ax-mobile-shell {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--color-background-body);
}

/* Sticky Frosted Top Bar */
.ax-m-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0;
  background: rgba(245, 245, 244, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--color-border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ax-m-topbar-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 500;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.ax-m-back,
.ax-m-top-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--color-background-surface);
  border: 1px solid var(--color-border-hairline);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Main Page Gutters & 1:3:5 Spacing Rhythm */
.ax-m-page {
  padding: 16px 20px 104px;
}

.ax-m-page.has-actionbar {
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}

.ax-m-large-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 18px;
}

.ax-m-eyebrow {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-tertiary);
  margin-bottom: 4px;
}

.ax-m-title {
  margin: 0;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-text-primary);
}

.ax-m-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 0 10px;
  padding: 0 2px;
}

.ax-m-section-title {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.ax-m-section-meta {
  font-size: 12.5px;
  color: var(--color-text-tertiary);
}

/* Surfaces & Grouped Lists (Space precedes containment) */
.ax-m-card {
  background: var(--color-background-surface);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--color-border-hairline);
}

.ax-m-grouped {
  background: var(--color-background-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border-hairline);
  overflow: hidden;
  margin-bottom: 14px;
}

.ax-m-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-hairline);
  transition: background-color 0.14s ease;
}

.ax-m-list-row:last-child {
  border-bottom: 0;
}

.ax-m-list-row.is-interactive:active {
  background: var(--color-overlay-hover);
}

.ax-m-row-main {
  flex: 1;
  min-width: 0;
}

.ax-m-row-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.4;
}

.ax-m-row-sub {
  font-size: 13px;
  color: var(--color-text-tertiary);
  margin-top: 3px;
  line-height: 1.45;
}

.ax-m-kv-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border-hairline);
  font-size: 14px;
}

.ax-m-kv-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ax-m-kv-row:first-child {
  padding-top: 0;
}

.ax-m-kv-label {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

.ax-m-kv-value {
  color: var(--color-text-primary);
  text-align: right;
  word-break: break-word;
}

/* Inputs & Controls (16px prevents iOS auto-zoom, 44px touch target) */
.ax-m-field {
  margin-bottom: 14px;
}

.ax-m-field:last-child {
  margin-bottom: 0;
}

.ax-m-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.ax-m-optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}

.ax-m-input,
.ax-m-select,
.ax-m-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: var(--radius-control);
  border: 1px solid var(--color-border-control);
  background: var(--color-background-body);
  color: var(--color-text-primary);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ax-m-textarea {
  min-height: 82px;
  resize: none;
}

.ax-m-input:focus,
.ax-m-select:focus,
.ax-m-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-background-surface);
}

/* Searchable Select Widget */
.ax-m-ss-wrap {
  position: relative;
}

.ax-m-ss-list {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
  background: var(--color-background-surface);
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-med);
  z-index: 40;
}

.ax-m-ss-list.is-open {
  display: block;
}

.ax-m-ss-item {
  padding: 11px 13px;
  font-size: 14.5px;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-hairline);
  cursor: pointer;
}

.ax-m-ss-item:last-child {
  border-bottom: 0;
}

.ax-m-ss-item:active {
  background: var(--color-background-muted);
}

.ax-m-ss-empty {
  padding: 12px 13px;
  font-size: 13.5px;
  color: var(--color-text-tertiary);
}

/* Buttons (Single Focal Accent CTA) */
.ax-m-btn-primary {
  width: 100%;
  min-height: 46px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 15.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.16s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.ax-m-btn-primary:active {
  transform: scale(0.985);
  background: var(--color-accent-hover);
}

.ax-m-btn-primary:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.ax-m-btn-secondary {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--color-border-control);
  border-radius: var(--radius-control);
  background: var(--color-background-surface);
  color: var(--color-text-primary);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ax-m-btn-danger-ghost {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid rgba(201, 48, 58, 0.25);
  border-radius: var(--radius-control);
  background: var(--color-error-bg);
  color: var(--color-error);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* Fixed Bottom Action Bar (Secondary immersive pages) */
.ax-m-actionbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--color-border-hairline);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 60;
}

.ax-m-actionbar-summary {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--color-text-secondary);
}

.ax-m-actionbar .ax-m-btn-primary {
  width: auto;
  min-width: 132px;
  padding: 11px 22px;
}

/* Global Bottom 4-Tab Bar (Top-level views ONLY) */
.ax-m-tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--color-border-hairline);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 60;
}

.ax-m-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 4px;
  border-radius: var(--radius-inner);
  color: var(--color-text-tertiary);
  font-size: 11.5px;
  font-weight: 500;
}

.ax-m-tab.is-active {
  color: var(--color-text-primary);
  font-weight: 600;
}

.ax-m-tab-badge {
  position: absolute;
  top: 2px;
  right: 18%;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-error);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

/* Pagination */
.ax-m-pager {
  margin: 18px 0;
  display: flex;
  justify-content: center;
}

.ax-m-pager ul.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ax-m-pager ul.pagination li a,
.ax-m-pager ul.pagination li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--color-border-hairline);
  background: var(--color-background-surface);
  color: var(--color-text-secondary);
  font-size: 13.5px;
}

.ax-m-pager ul.pagination li.active span,
.ax-m-pager ul.pagination li.active a {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
}

.ax-m-pager ul.pagination li.disabled span {
  opacity: 0.45;
}

/* Empty State & Feedback Banner */
.ax-m-empty {
  background: var(--color-background-surface);
  border: 1px solid var(--color-border-hairline);
  border-radius: var(--radius-card);
  padding: 36px 20px;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 14px;
}

.ax-m-msg {
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: var(--radius-control);
  font-size: 13.5px;
  display: none;
}

.ax-m-msg.is-error {
  display: block;
  background: var(--color-error-bg);
  color: var(--color-error);
}

.ax-m-msg.is-success {
  display: block;
  background: var(--color-success-bg);
  color: var(--color-success);
}
