/*
 * MSJD global UI system v1
 * Presentation only. Loaded after all feature styles so business modules keep
 * their existing DOM, events, state, API contracts, and execution behavior.
 */

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("outfit-latin-wght-normal.woff2") format("woff2-variations");
}

body.ui-system-v1 {
  --ui-canvas: #f2f5f2;
  --ui-canvas-strong: #e9eeea;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f7f9f7;
  --ui-surface-tint: #edf4f0;
  --ui-ink: #17211f;
  --ui-ink-soft: #33413e;
  --ui-muted: #687773;
  --ui-faint: #91a09b;
  --ui-line: #d8e0dc;
  --ui-line-soft: #e9eeeb;
  --ui-accent: #137f70;
  --ui-accent-strong: #0b5e54;
  --ui-accent-soft: #dceee8;
  --ui-warm: #d9a53a;
  --ui-danger: #ae3e38;
  --ui-sidebar: #101a18;
  --ui-sidebar-soft: #182522;
  --ui-radius: 10px;
  --ui-radius-sm: 7px;
  --ui-shadow: 0 14px 34px rgba(25, 44, 39, 0.07);
  --ui-shadow-soft: 0 5px 16px rgba(25, 44, 39, 0.055);
  --bg: var(--ui-canvas);
  --surface: var(--ui-surface);
  --surface-soft: var(--ui-surface-soft);
  --surface-tint: var(--ui-surface-tint);
  --ink: var(--ui-ink);
  --muted: var(--ui-muted);
  --line: var(--ui-line);
  --line-soft: var(--ui-line-soft);
  --accent: var(--ui-accent);
  --accent-strong: var(--ui-accent-strong);
  --radius-card: var(--ui-radius);
  --radius-control: var(--ui-radius-sm);
  min-width: 320px;
  overflow-x: hidden;
  background: var(--ui-canvas);
  color: var(--ui-ink);
  font-family: "Outfit", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.ui-system-v1 *,
body.ui-system-v1 *::before,
body.ui-system-v1 *::after {
  box-sizing: border-box;
}

body.ui-system-v1 :is(button, input, select, textarea) {
  font: inherit;
}

body.ui-system-v1 :is(button, [role="button"], a, input, select, textarea):focus-visible {
  outline: 3px solid rgba(19, 127, 112, 0.3);
  outline-offset: 2px;
}

body.ui-system-v1 .skip-link {
  left: 16px;
  top: 12px;
  z-index: 200;
  border-radius: 6px;
  background: var(--ui-sidebar);
  font-weight: 700;
}

/* Authentication remains the original form and behavior, with a quieter shell. */
body.ui-system-v1 .auth-screen {
  background:
    linear-gradient(122deg, rgba(16, 26, 24, 0.96) 0 42%, rgba(16, 26, 24, 0.72) 42.1% 51%, transparent 51.1%),
    linear-gradient(145deg, #d9e7e1, #f4f6f3 54%, #e7ece8);
}

body.ui-system-v1 .login-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 34px 90px rgba(10, 26, 22, 0.2);
}

body.ui-system-v1 .login-card > button {
  border: 1px solid var(--ui-accent-strong);
  background: var(--ui-accent-strong);
  color: #ffffff;
}

/* Global application frame. */
body.ui-system-v1 .shell,
body.ui-system-v1 .shell.sidebar-collapsed {
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100dvh;
  height: 100dvh;
  background: var(--ui-canvas);
}

body.ui-system-v1 .sidebar {
  position: relative;
  isolation: isolate;
  gap: 10px;
  overflow: hidden;
  padding: 15px 12px 12px;
  border-right: 0;
  background: var(--ui-sidebar);
  box-shadow: 10px 0 28px rgba(10, 25, 21, 0.12);
}

body.ui-system-v1 .sidebar::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -126px;
  right: -148px;
  width: 270px;
  height: 270px;
  border: 1px solid rgba(100, 205, 181, 0.14);
  background: linear-gradient(145deg, rgba(26, 137, 119, 0.26), rgba(26, 137, 119, 0));
  transform: rotate(23deg);
}

body.ui-system-v1 .sidebar .brand {
  min-height: 62px;
  gap: 10px;
  margin: 0 2px;
  padding: 2px 5px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

body.ui-system-v1 .sidebar .brand-logo {
  width: 44px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

body.ui-system-v1 .sidebar .brand strong {
  color: #f5f8f6;
  font-size: 15px;
  font-weight: 730;
  letter-spacing: 0.01em;
}

body.ui-system-v1 .sidebar .brand small {
  color: #92a39e;
  font-size: 10.5px;
  letter-spacing: 0.055em;
}

body.ui-system-v1 .sidebar nav {
  gap: 2px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1px 2px 6px;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  scrollbar-width: thin;
}

body.ui-system-v1 .sidebar nav::-webkit-scrollbar {
  width: 5px;
}

body.ui-system-v1 .sidebar nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

body.ui-system-v1 .nav-group-label {
  margin: 12px 10px 4px;
  color: #71837d;
  font-size: 9.5px;
  font-weight: 730;
  letter-spacing: 0.13em;
}

body.ui-system-v1 .sidebar .nav {
  position: relative;
  min-height: 35px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 10px 8px 25px;
  background: transparent;
  color: #b9c6c2;
  font-size: 12.5px;
  font-weight: 560;
  letter-spacing: 0.005em;
  box-shadow: none;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

body.ui-system-v1 .sidebar .nav::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 5px;
  height: 5px;
  border: 1px solid #667a73;
  border-radius: 50%;
  transform: translateY(-50%);
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

body.ui-system-v1 .sidebar .nav:hover {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

body.ui-system-v1 .sidebar .nav.active,
body.ui-system-v1 .sidebar .nav[aria-current="page"] {
  border-color: rgba(91, 203, 178, 0.16);
  background: linear-gradient(90deg, rgba(28, 133, 116, 0.46), rgba(28, 133, 116, 0.16));
  color: #ffffff;
  box-shadow: inset 3px 0 0 #54c6ad;
  font-weight: 680;
}

body.ui-system-v1 .sidebar .nav.active::before,
body.ui-system-v1 .sidebar .nav[aria-current="page"]::before {
  border-color: #72d5bd;
  background: #72d5bd;
  transform: translateY(-50%) scale(1.16);
}

body.ui-system-v1 .sidebar-toggle {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: #aebdb8;
  box-shadow: none;
}

body.ui-system-v1 .shell.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

body.ui-system-v1 .shell.sidebar-collapsed .sidebar .nav {
  padding-inline: 10px;
}

body.ui-system-v1 .shell.sidebar-collapsed .sidebar .nav::before {
  display: none;
}

body.ui-system-v1 .main {
  min-width: 0;
  padding: 0 22px 36px;
  background:
    linear-gradient(90deg, rgba(20, 91, 79, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(20, 91, 79, 0.025) 1px, transparent 1px),
    var(--ui-canvas);
  background-size: 28px 28px;
  scrollbar-color: #bcc8c3 transparent;
  scrollbar-width: thin;
}

body.ui-system-v1 .topbar {
  position: sticky;
  top: 0;
  z-index: 34;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 86px;
  margin: 0 -22px 16px;
  padding: 15px 22px 13px;
  border: 0;
  border-bottom: 1px solid rgba(205, 216, 211, 0.92);
  background: rgba(248, 250, 248, 0.94);
  box-shadow: 0 8px 22px rgba(26, 46, 40, 0.035);
  backdrop-filter: blur(16px) saturate(130%);
}

body.ui-system-v1 .topbar::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: clamp(88px, 12vw, 180px);
  height: 2px;
  background: linear-gradient(90deg, var(--ui-accent), rgba(19, 127, 112, 0));
}

body.ui-system-v1 .topbar > div:first-child {
  min-width: 0;
  max-width: 72rem;
  padding-left: 2px;
}

body.ui-system-v1 #view-title {
  display: inline-flex;
  max-width: 72rem;
  align-items: center;
  gap: 10px;
  overflow-wrap: anywhere;
  color: var(--ui-ink);
  font-size: clamp(23px, 2vw, 28px);
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.12;
  white-space: normal;
}

body.ui-system-v1 #view-title::after {
  content: "";
  flex: 0 0 auto;
  width: 31px;
  height: 22px;
  border: 1px solid rgba(17, 86, 73, 0.16);
  border-radius: 5px;
  background: url("/assets/logo.jpg") center / cover no-repeat;
  opacity: 0.84;
  transform: translateY(1px) rotate(-2deg);
}

body.ui-system-v1 .topbar p {
  max-width: 70ch;
  margin-top: 5px;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 470;
  letter-spacing: 0.012em;
  line-height: 1.45;
}

body.ui-system-v1 .topbar .actions {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

body.ui-system-v1 .topbar-date {
  color: var(--ui-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body.ui-system-v1 .pill,
body.ui-system-v1 .refresh-status {
  min-height: 32px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ui-ink-soft);
  box-shadow: none;
  font-size: 11px;
}

body.ui-system-v1 #health-pill {
  position: relative;
  padding-left: 25px;
}

body.ui-system-v1 #health-pill::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #31947a;
  box-shadow: 0 0 0 4px rgba(49, 148, 122, 0.1);
  transform: translateY(-50%);
}

body.ui-system-v1 :is(.icon-button, .secondary-button, .table-action, .collapse-toggle, form button, .date-presets button, .metric-toggle) {
  min-height: 35px;
  border: 1px solid var(--ui-line);
  border-radius: 7px;
  background: var(--ui-surface);
  color: var(--ui-ink-soft);
  box-shadow: none;
  font-weight: 650;
}

body.ui-system-v1 :is(.icon-button, .secondary-button, .table-action, .collapse-toggle, form button, .date-presets button, .metric-toggle):hover {
  border-color: #adc2ba;
  background: var(--ui-surface-soft);
  color: var(--ui-accent-strong);
}

/* Page and module rhythm. */
body.ui-system-v1 .view.active,
body.ui-system-v1 .main.view-switching .view.active {
  display: grid;
  grid-auto-flow: dense;
  gap: 14px;
  width: min(100%, 1760px);
  min-width: 0;
  margin-inline: auto;
  align-content: start;
}

body.ui-system-v1 .view.active > * {
  min-width: 0;
  max-width: 100%;
}

body.ui-system-v1 .panel,
body.ui-system-v1 :is(.task-hub-chapter, .store-analysis-section, .operation-ui-section) {
  min-width: 0;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-soft);
}

body.ui-system-v1 .panel {
  padding: 15px;
}

body.ui-system-v1 .panel > .panel-title:first-child {
  min-height: 48px;
  margin: -15px -15px 14px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--ui-line-soft);
  background: linear-gradient(90deg, var(--ui-surface-tint), rgba(247, 250, 248, 0.45));
  align-items: center;
}

body.ui-system-v1 .panel > .panel-title:first-child h2,
body.ui-system-v1 .panel > .panel-title:first-child h3 {
  position: relative;
  padding-left: 12px;
  color: var(--ui-ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

body.ui-system-v1 .panel > .panel-title:first-child h2::before,
body.ui-system-v1 .panel > .panel-title:first-child h3::before {
  content: "";
  position: absolute;
  top: 0.16em;
  bottom: 0.16em;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--ui-accent);
}

body.ui-system-v1 :is(.panel-title span, .panel-title p, .muted, small) {
  color: var(--ui-muted);
}

body.ui-system-v1 :is(.panel-title span, .panel-title p) {
  font-size: 11.5px;
  line-height: 1.45;
}

body.ui-system-v1 :is(.module-command-strip, .op-command-strip, .marketing-command-strip) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-soft);
}

body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card) {
  min-width: 0;
  min-height: 88px;
  border: 0;
  border-right: 1px solid var(--ui-line-soft);
  border-radius: 0;
  padding: 12px 14px;
  background: var(--ui-surface);
  box-shadow: none;
  transform: none;
}

body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card):nth-child(even) {
  background: var(--ui-surface-soft);
}

body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card):hover {
  background: var(--ui-surface-tint);
  transform: none;
}

body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card) strong {
  color: var(--ui-ink);
  font-size: clamp(17px, 1.6vw, 22px);
  font-weight: 690;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card) :is(span, p) {
  color: var(--ui-muted);
  font-size: 11px;
  line-height: 1.4;
}

body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  grid-auto-flow: dense;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-soft);
}

body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row):has(> :nth-child(3):last-child) {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row):has(> :nth-child(3):last-child) > :first-child {
  grid-column: span 6;
}

body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row):has(> :nth-child(3):last-child) > :not(:first-child) {
  grid-column: span 3;
}

body.ui-system-v1 :is(.metric, .live-metric, .marketing-summary-card) {
  min-width: 0;
  min-height: 84px;
  border: 0;
  border-right: 1px solid var(--ui-line-soft);
  border-radius: 0;
  padding: 12px 14px;
  background: transparent;
  box-shadow: none;
}

body.ui-system-v1 :is(.metric, .live-metric, .marketing-summary-card):nth-child(even) {
  background: var(--ui-surface-soft);
}

body.ui-system-v1 :is(.metric, .live-metric, .marketing-summary-card) strong {
  color: var(--ui-ink);
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 690;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

/* Horizontal accordion treatment for every known page-level tab row. */
body.ui-system-v1 :is(
  .module-subnav,
  .product-center-subnav,
  .product-image-helper-subnav,
  .task-perspective-tabs,
  .task-personal-tabs,
  .database-subnav,
  .marketing-subnav,
  .operation-ui-tabs,
  [role="tablist"]
) {
  display: flex;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  padding: 3px;
  background: #e9eeeb;
  box-shadow: none;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

body.ui-system-v1 :is(
  .module-subnav,
  .product-center-subnav,
  .product-image-helper-subnav,
  .task-perspective-tabs,
  .task-personal-tabs,
  .database-subnav,
  .marketing-subnav,
  .operation-ui-tabs,
  [role="tablist"]
)::-webkit-scrollbar {
  display: none;
}

body.ui-system-v1 :is(
  .module-subnav,
  .product-center-subnav,
  .product-image-helper-subnav,
  .task-perspective-tabs,
  .task-personal-tabs,
  .database-subnav,
  .marketing-subnav,
  .operation-ui-tabs,
  [role="tablist"]
) > button {
  flex: 0 0 auto;
  min-width: max-content;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 13px;
  background: transparent;
  color: var(--ui-muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 610;
  scroll-snap-align: start;
  white-space: nowrap;
}

body.ui-system-v1 :is(
  .module-subnav,
  .product-center-subnav,
  .product-image-helper-subnav,
  .task-perspective-tabs,
  .task-personal-tabs,
  .database-subnav,
  .marketing-subnav,
  .operation-ui-tabs,
  [role="tablist"]
) > button:is(.active, [aria-selected="true"]) {
  padding-inline: 21px;
  background: var(--ui-surface);
  color: var(--ui-accent-strong);
  box-shadow: 0 2px 8px rgba(25, 49, 42, 0.09);
  font-weight: 700;
}

/* Controls and data surfaces. */
body.ui-system-v1 :is(.filter-grid, .form-grid, .detail-grid) {
  gap: 9px;
}

body.ui-system-v1 :is(.filter-item, .form-field, label:has(> input), label:has(> select), label:has(> textarea)) {
  color: var(--ui-muted);
  font-size: 11.5px;
  font-weight: 610;
}

body.ui-system-v1 :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .multi-select-trigger) {
  min-height: 38px;
  border: 1px solid #cbd6d1;
  border-radius: 7px;
  background: var(--ui-surface);
  color: var(--ui-ink);
  box-shadow: inset 0 1px 0 rgba(19, 52, 43, 0.025);
}

body.ui-system-v1 :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .multi-select-trigger):hover {
  border-color: #aebfb8;
}

body.ui-system-v1 :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .multi-select-trigger):focus {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px rgba(19, 127, 112, 0.11);
}

body.ui-system-v1 .table {
  position: relative;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: none;
  scrollbar-color: #bdc9c4 #f1f4f2;
  scrollbar-width: thin;
}

body.ui-system-v1 .table table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

body.ui-system-v1 .table th,
body.ui-system-v1 .table td {
  height: 42px;
  border-bottom: 1px solid var(--ui-line-soft);
  padding: 9px 11px;
  color: var(--ui-ink-soft);
  font-size: 12px;
  line-height: 1.45;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

body.ui-system-v1 .table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3f0;
  color: #53635e;
  font-size: 11px;
  font-weight: 710;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

body.ui-system-v1 .table tbody tr:hover td {
  background: #f1f7f4;
}

body.ui-system-v1 .table tbody tr:last-child td {
  border-bottom: 0;
}

body.ui-system-v1 .table.ui-wide-data-table {
  background:
    linear-gradient(90deg, var(--ui-surface) 30%, rgba(255, 255, 255, 0)) left center / 32px 100% no-repeat local,
    linear-gradient(270deg, var(--ui-surface) 30%, rgba(255, 255, 255, 0)) right center / 32px 100% no-repeat local,
    linear-gradient(90deg, rgba(20, 56, 47, 0.1), rgba(20, 56, 47, 0)) left center / 16px 100% no-repeat scroll,
    linear-gradient(270deg, rgba(20, 56, 47, 0.1), rgba(20, 56, 47, 0)) right center / 16px 100% no-repeat scroll,
    var(--ui-surface);
}

body.ui-system-v1 :is(.empty, .empty-state, .no-data) {
  border: 1px dashed #bdcbc6;
  border-radius: 8px;
  background: var(--ui-surface-soft);
  color: var(--ui-muted);
}

body.ui-system-v1 :is(.badge, .status, [class*="status-"]) {
  font-variant-numeric: tabular-nums;
}

/* Decorative remote image URLs from older themes are intentionally neutralized. */
body.ui-system-v1 :is(.task-hero, .task-card-image) {
  background-image:
    linear-gradient(132deg, rgba(13, 94, 81, 0.92), rgba(25, 50, 45, 0.84)),
    linear-gradient(35deg, #1e5f54, #101a18);
}

/* Wide-screen chapter rail; script supplies links and GSAP pinning only. */
body.ui-system-v1 .ui-context-rail {
  position: absolute;
  top: 104px;
  right: 10px;
  z-index: 28;
  display: none;
  width: 116px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--ui-shadow);
  backdrop-filter: blur(12px);
}

body.ui-system-v1 .ui-context-rail strong {
  display: block;
  margin: 2px 5px 7px;
  color: var(--ui-faint);
  font-size: 9.5px;
  font-weight: 720;
  letter-spacing: 0.12em;
}

body.ui-system-v1 .ui-context-rail button {
  display: block;
  width: 100%;
  min-height: 30px;
  overflow: hidden;
  border: 0;
  border-left: 2px solid var(--ui-line);
  border-radius: 0;
  padding: 5px 7px;
  background: transparent;
  color: var(--ui-muted);
  box-shadow: none;
  font-size: 10.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.ui-system-v1 .ui-context-rail button:hover,
body.ui-system-v1 .ui-context-rail button.is-current {
  border-left-color: var(--ui-accent);
  color: var(--ui-accent-strong);
}

@media (min-width: 1680px) {
  body.ui-system-v1.ui-has-context-rail .main {
    padding-right: 142px;
  }

  body.ui-system-v1.ui-has-context-rail .ui-context-rail {
    display: block;
  }
}

/* Compact desktop / tablet landscape: preserve the desktop information model. */
@media (min-width: 921px) and (max-width: 1279px) {
  body.ui-system-v1 .shell,
  body.ui-system-v1 .shell.sidebar-collapsed {
    grid-template-columns: 176px minmax(0, 1fr);
  }

  body.ui-system-v1 .sidebar {
    padding-inline: 9px;
  }

  body.ui-system-v1 .sidebar .brand {
    gap: 7px;
    padding-inline: 3px;
  }

  body.ui-system-v1 .sidebar .brand-logo {
    width: 37px;
    height: 30px;
  }

  body.ui-system-v1 .sidebar .brand strong {
    font-size: 13px;
  }

  body.ui-system-v1 .sidebar .brand small {
    font-size: 9px;
  }

  body.ui-system-v1 .sidebar .nav {
    padding-right: 7px;
    padding-left: 23px;
    font-size: 11.5px;
  }

  body.ui-system-v1 .sidebar .nav::before {
    left: 10px;
  }

  body.ui-system-v1 .main {
    padding-inline: 16px;
  }

  body.ui-system-v1 .main :is(button, input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    min-height: 40px;
  }

  body.ui-system-v1 #database-view .database-subnav > button,
  body.ui-system-v1 #storeAnalysis-view .store-analysis-batch-trigger,
  body.ui-system-v1 #storeAnalysis-view .store-analysis-filter-actions #store-analysis-run-btn,
  body.ui-system-v1 #storeAnalysis-view .store-analysis-cockpit-actions button {
    min-height: 40px !important;
    height: auto !important;
  }

  body.ui-system-v1 .topbar .icon-button {
    width: 40px;
    min-width: 40px;
  }

  body.ui-system-v1 .topbar {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  body.ui-system-v1 :is(.module-command-strip, .op-command-strip, .marketing-command-strip),
  body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row) {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row):has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row):has(> :nth-child(3):last-child) > * {
    grid-column: auto;
  }

  body.ui-system-v1 .shell.sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

/* Phone and tablet portrait: efficient, readable, one-hand workbench. */
@media (max-width: 920px) {
  body.ui-system-v1,
  body.ui-system-v1.apple-mobile-enabled {
    --ui-radius: 10px;
    min-width: 320px;
    background: #edf1ee;
    color: var(--ui-ink);
    font-family: "Outfit", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .main,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered .main {
    min-width: 0;
    padding: 0 10px calc(96px + env(safe-area-inset-bottom, 0px));
    background: transparent;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered .topbar {
    position: sticky;
    top: 0;
    z-index: 36;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 78px;
    margin: 0 -10px 11px;
    padding: calc(11px + env(safe-area-inset-top, 0px)) 11px 10px;
    align-items: end;
    border: 0;
    border-bottom: 1px solid rgba(197, 209, 203, 0.82);
    border-radius: 0;
    background: rgba(245, 248, 245, 0.92);
    box-shadow: 0 7px 20px rgba(29, 48, 42, 0.055);
    backdrop-filter: blur(18px) saturate(130%);
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar::after,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered .topbar::after {
    display: none;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar > div:first-child {
    min-width: 0;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered #view-title,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered #view-title {
    display: block;
    overflow: hidden;
    color: var(--ui-ink);
    font-size: clamp(21px, 6.2vw, 25px);
    font-weight: 710;
    letter-spacing: -0.035em;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ui-system-v1 #view-title::after {
    display: none;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar p,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered .topbar p {
    display: -webkit-box;
    max-width: 62vw;
    margin-top: 4px;
    overflow: hidden;
    color: var(--ui-muted);
    font-size: 10.5px;
    font-weight: 490;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  /* Mobile status/actions behave as a small snap carousel. */
  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar .actions {
    display: flex;
    gap: 6px;
    max-width: 132px;
    overflow-x: auto;
    justify-content: flex-start;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar .actions::-webkit-scrollbar {
    display: none;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar .actions > * {
    flex: 0 0 auto;
    scroll-snap-align: end;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered :is(#refresh-btn, #health-pill),
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered :is(#refresh-btn, #health-pill) {
    min-height: 44px;
    border: 1px solid #cfdbd5;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: none;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered #refresh-btn,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered #refresh-btn {
    width: 44px;
    min-width: 44px;
    color: var(--ui-accent-strong);
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered #health-pill,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered #health-pill {
    width: auto !important;
    min-width: 70px !important;
    max-width: 88px !important;
    height: 44px !important;
    min-height: 44px !important;
    overflow: hidden !important;
    padding: 0 9px 0 23px !important;
    color: var(--ui-ink-soft) !important;
    font-size: 10px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered #health-pill::before {
    left: 9px;
    width: 6px;
    height: 6px;
  }

  body.ui-system-v1 .view.active,
  body.ui-system-v1 .main.view-switching .view.active {
    gap: 10px;
    width: 100%;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .panel,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered .panel {
    margin-bottom: 0;
    border: 1px solid #d4ded9;
    border-radius: var(--ui-radius);
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 5px 16px rgba(27, 47, 40, 0.045);
    backdrop-filter: none;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .panel > .panel-title:first-child,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered .panel > .panel-title:first-child {
    min-height: 46px;
    margin: -12px -12px 11px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--ui-line-soft);
    border-radius: var(--ui-radius) var(--ui-radius) 0 0;
    background: var(--ui-surface-soft);
  }

  body.ui-system-v1 :is(.panel-title span, .panel-title p, .muted, small) {
    font-size: max(11px, 0.7rem);
    line-height: 1.45;
  }

  body.ui-system-v1 :is(.module-command-strip, .op-command-strip, .marketing-command-strip) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1px;
    border-radius: var(--ui-radius);
    background: var(--ui-line-soft);
  }

  body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card),
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered :is(.module-command-card, .op-command-card, .marketing-command-card) {
    min-height: 82px;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 11px 12px;
    background: var(--ui-surface) !important;
    box-shadow: none !important;
  }

  body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row),
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered :is(.metrics, .live-metrics, .marketing-summary-row) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1px !important;
    border-radius: var(--ui-radius);
    background: var(--ui-line-soft);
  }

  body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row):has(> :nth-child(3):last-child) > :first-child {
    grid-column: span 2;
  }

  body.ui-system-v1 :is(.metrics, .live-metrics, .marketing-summary-row):has(> :nth-child(3):last-child) > :not(:first-child) {
    grid-column: span 1;
  }

  body.ui-system-v1 :is(.metric, .live-metric, .marketing-summary-card),
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered :is(.metric, .live-metric, .marketing-summary-card) {
    min-height: 78px;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 10px 11px;
    background: var(--ui-surface) !important;
    box-shadow: none !important;
  }

  body.ui-system-v1 :is(.metric, .live-metric, .marketing-summary-card) strong {
    font-size: clamp(18px, 5.5vw, 23px);
  }

  body.ui-system-v1 :is(
    .module-subnav,
    .product-center-subnav,
    .product-image-helper-subnav,
    .task-perspective-tabs,
    .task-personal-tabs,
    .database-subnav,
    .marketing-subnav,
    .operation-ui-tabs,
    [role="tablist"]
  ) {
    gap: 2px !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: 8px !important;
    padding: 3px !important;
    background: #e6ece8 !important;
  }

  body.ui-system-v1 :is(
    .module-subnav,
    .product-center-subnav,
    .product-image-helper-subnav,
    .task-perspective-tabs,
    .task-personal-tabs,
    .database-subnav,
    .marketing-subnav,
    .operation-ui-tabs,
    [role="tablist"]
  ) > button {
    min-height: 42px;
    border-radius: 6px !important;
    padding-inline: 12px;
    background: transparent !important;
    color: var(--ui-muted) !important;
    box-shadow: none !important;
    font-size: 12px;
  }

  body.ui-system-v1 :is(
    .module-subnav,
    .product-center-subnav,
    .product-image-helper-subnav,
    .task-perspective-tabs,
    .task-personal-tabs,
    .database-subnav,
    .marketing-subnav,
    .operation-ui-tabs,
    [role="tablist"]
  ) > button:is(.active, [aria-selected="true"]) {
    padding-inline: 20px;
    background: var(--ui-surface) !important;
    color: var(--ui-accent-strong) !important;
    box-shadow: 0 2px 7px rgba(28, 50, 43, 0.1) !important;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered :is(button, [role="button"], input:not([type="checkbox"]):not([type="radio"]), select, textarea, .multi-select-trigger) {
    min-height: 44px;
  }

  body.ui-system-v1 #database-view .database-subnav > button,
  body.ui-system-v1 #storeAnalysis-view .store-analysis-batch-trigger,
  body.ui-system-v1 #storeAnalysis-view .store-analysis-filter-actions #store-analysis-run-btn,
  body.ui-system-v1 #storeAnalysis-view .store-analysis-cockpit-actions button {
    min-height: 44px !important;
    height: auto !important;
  }

  body.ui-system-v1 .table {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }

  body.ui-system-v1 .table th,
  body.ui-system-v1 .table td {
    min-width: 92px;
    height: 44px;
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.45;
  }

  body.ui-system-v1 .table th {
    font-size: 11px;
  }

  /* Tables with six or fewer regular columns become readable record cards. */
  body.ui-system-v1 .table.ui-mobile-card-table {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  body.ui-system-v1 .table.ui-mobile-card-table table {
    min-width: 0;
  }

  body.ui-system-v1 .table.ui-mobile-card-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  body.ui-system-v1 .table.ui-mobile-card-table tbody {
    display: grid;
    gap: 9px;
  }

  body.ui-system-v1 .table.ui-mobile-card-table tbody tr:not(.ui-colspan-row) {
    display: grid;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: var(--ui-surface);
    box-shadow: 0 3px 12px rgba(30, 52, 45, 0.04);
  }

  body.ui-system-v1 .table.ui-mobile-card-table tbody tr:not(.ui-colspan-row) > td {
    display: grid;
    grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    height: auto;
    min-height: 42px;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--ui-line-soft);
    padding: 9px 10px;
    background: transparent;
    overflow-wrap: anywhere;
  }

  body.ui-system-v1 .table.ui-mobile-card-table tbody tr:not(.ui-colspan-row) > td:last-child {
    border-bottom: 0;
  }

  body.ui-system-v1 .table.ui-mobile-card-table td::before {
    content: attr(data-label);
    color: var(--ui-muted);
    font-size: 10.5px;
    font-weight: 680;
    line-height: 1.3;
  }

  body.ui-system-v1 .table.ui-mobile-card-table .ui-colspan-row td {
    display: block;
    min-width: 0;
    border: 0;
    padding: 10px;
  }

  body.ui-system-v1 .mobile-bottom-nav,
  body.ui-system-v1.apple-mobile-enabled .mobile-bottom-nav {
    right: 8px;
    bottom: calc(7px + env(safe-area-inset-bottom, 0px));
    left: 8px;
    min-height: 66px;
    padding: 5px;
    border: 1px solid rgba(204, 216, 210, 0.94);
    border-radius: 15px;
    background: rgba(250, 252, 250, 0.96);
    box-shadow: 0 15px 38px rgba(18, 39, 32, 0.17);
    backdrop-filter: blur(18px) saturate(125%);
  }

  body.ui-system-v1 .mobile-bottom-item,
  body.ui-system-v1.apple-mobile-enabled .mobile-bottom-item {
    min-width: 0;
    min-height: 54px;
    border-radius: 10px;
    color: var(--ui-muted);
    font-size: 10px;
    font-weight: 610;
  }

  body.ui-system-v1 .mobile-bottom-item.active,
  body.ui-system-v1.apple-mobile-enabled .mobile-bottom-item.active {
    background: var(--ui-accent-soft);
    color: var(--ui-accent-strong);
  }

  body.ui-system-v1 .mobile-bottom-item.active::before,
  body.ui-system-v1.apple-mobile-enabled .mobile-bottom-item.active::before {
    background: transparent;
    box-shadow: none;
  }

  body.ui-system-v1 .mobile-module-sheet,
  body.ui-system-v1.apple-mobile-enabled .mobile-module-sheet,
  body.ui-system-v1.apple-mobile-enabled .mobile-module-layer.is-open .mobile-module-sheet {
    max-height: min(90dvh, 820px);
    border: 1px solid rgba(212, 222, 217, 0.96);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: rgba(246, 249, 246, 0.98);
    box-shadow: 0 -24px 62px rgba(15, 34, 28, 0.25);
    backdrop-filter: blur(20px) saturate(125%);
  }

  body.ui-system-v1 .mobile-module-item,
  body.ui-system-v1.apple-mobile-enabled .mobile-module-item {
    min-height: 52px;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: var(--ui-surface);
    color: var(--ui-ink);
    box-shadow: none;
    font-size: 12px;
  }

  body.ui-system-v1 .mobile-module-item.active,
  body.ui-system-v1.apple-mobile-enabled .mobile-module-item.active {
    border-color: rgba(19, 127, 112, 0.25);
    background: var(--ui-accent-soft);
    color: var(--ui-accent-strong);
  }

  body.ui-system-v1 .ui-context-rail {
    display: none !important;
  }
}

@media (max-width: 430px) {
  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar .actions {
    max-width: 122px;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered #health-pill,
  body.ui-system-v1.apple-mobile-enabled.mobile-workbench-enabled.ui-layered #health-pill {
    min-width: 66px !important;
    max-width: 72px !important;
    padding-right: 7px !important;
    font-size: 9.5px;
  }

  body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card),
  body.ui-system-v1 :is(.metric, .live-metric, .marketing-summary-card) {
    padding-inline: 9px;
  }

  body.ui-system-v1 :is(.module-command-card, .op-command-card, .marketing-command-card) strong,
  body.ui-system-v1 :is(.metric, .live-metric, .marketing-summary-card) strong {
    overflow-wrap: anywhere;
  }

  body.ui-system-v1 :is(.daily-refresh-stages, .daily-refresh-stage-grid) {
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)) !important;
  }
}

@media (max-width: 370px) {
  body.ui-system-v1.mobile-workbench-enabled.ui-layered .main {
    padding-inline: 8px;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar {
    margin-inline: -8px;
    padding-inline: 9px;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered #view-title {
    font-size: 20px;
  }

  body.ui-system-v1.mobile-workbench-enabled.ui-layered .topbar p {
    max-width: 56vw;
  }

  body.ui-system-v1 .mobile-bottom-item,
  body.ui-system-v1.apple-mobile-enabled .mobile-bottom-item {
    font-size: 9px;
  }

  body.ui-system-v1 :is(.filter-grid, .form-grid) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  body.ui-system-v1 :is(.topbar, .mobile-bottom-nav, .mobile-module-sheet, .ui-context-rail, .login-card) {
    background: var(--ui-surface) !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-contrast: more) {
  body.ui-system-v1 {
    --ui-line: #8f9c97;
    --ui-line-soft: #b7c1bd;
    --ui-muted: #45514d;
  }

  body.ui-system-v1 :is(button, input, select, textarea, .panel, .table, .mobile-bottom-nav, .mobile-module-sheet) {
    border-color: currentColor;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.ui-system-v1 *,
  body.ui-system-v1 *::before,
  body.ui-system-v1 *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body.ui-system-v1 .sidebar,
  body.ui-system-v1 .topbar .actions,
  body.ui-system-v1 .mobile-workbench,
  body.ui-system-v1 .ui-context-rail {
    display: none !important;
  }

  body.ui-system-v1 .shell,
  body.ui-system-v1 .shell.sidebar-collapsed {
    display: block;
    height: auto;
  }

  body.ui-system-v1 .main {
    height: auto;
    overflow: visible;
    padding: 0;
    background: #ffffff;
  }

  body.ui-system-v1 .panel,
  body.ui-system-v1 .table {
    break-inside: avoid;
    box-shadow: none;
  }
}
