﻿:root {
  --ios-bg: #f5f5f7;
  --ios-surface: rgba(255, 255, 255, 0.82);
  --ios-surface-solid: #ffffff;
  --ios-elevated: rgba(255, 255, 255, 0.94);
  --ios-text: #111827;
  --ios-muted: #6b7280;
  --ios-faint: #9ca3af;
  --ios-blue: #007aff;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-orange: #ff9500;
  --ios-yellow: #ffd60a;
  --ios-line: rgba(17, 24, 39, 0.10);
  --ios-line-strong: rgba(17, 24, 39, 0.16);
  --ios-shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
  --ios-soft-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
  --ios-radius-lg: 28px;
  --ios-radius: 20px;
  --ios-radius-sm: 14px;
  --ios-font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  letter-spacing: 0;
}

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

body {
  background:
    radial-gradient(circle at 8% -8%, rgba(255, 214, 10, 0.26), transparent 28%),
    radial-gradient(circle at 96% 4%, rgba(0, 122, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--ios-bg) 38%, #eef1f6 100%) !important;
  color: var(--ios-text) !important;
  font-family: var(--ios-font) !important;
  padding-left: 86px;
}

button,
input,
select,
textarea {
  font-family: var(--ios-font) !important;
}

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

p,
.muted,
.status,
.eyebrow {
  color: var(--ios-muted) !important;
}

.shell,
.promotion-page,
.page-wrapper {
  max-width: 1440px !important;
}

.app-sidebar {
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0 28px 28px 0;
  box-shadow: 18px 0 48px rgba(15, 23, 42, 0.18);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: calc(100vh - 24px);
  left: 12px;
  overflow: hidden;
  padding: 14px 10px;
  position: fixed;
  top: 12px;
  transition: width 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
  width: 62px;
  z-index: 1000;
}

.app-sidebar:hover,
.app-sidebar:focus-within {
  background: rgba(15, 23, 42, 0.94);
  box-shadow: 24px 0 70px rgba(15, 23, 42, 0.26);
  width: 226px;
}

.app-sidebar a {
  color: inherit;
  text-decoration: none;
}

.app-sidebar-brand,
.app-nav-item {
  align-items: center;
  border-radius: 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: 40px 1fr;
  min-height: 48px;
  padding: 4px;
  white-space: nowrap;
}

.app-sidebar-brand {
  margin-bottom: 4px;
}

.app-sidebar-logo,
.app-nav-icon {
  align-items: center;
  display: inline-flex;
  flex: 0 0 40px;
  font-weight: 950;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.app-sidebar-logo {
  background: linear-gradient(145deg, #fff174 0%, #ffd60a 58%, #ffc400 100%);
  border-radius: 15px;
  color: #101827;
  box-shadow: 0 12px 24px rgba(255, 214, 10, 0.28);
}

.app-sidebar-title,
.app-nav-label {
  min-width: 140px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-sidebar:hover .app-sidebar-title,
.app-sidebar:hover .app-nav-label,
.app-sidebar:focus-within .app-sidebar-title,
.app-sidebar:focus-within .app-nav-label {
  opacity: 1;
  transform: translateX(0);
}

.app-sidebar-title strong,
.app-sidebar-title small {
  display: block;
}

.app-sidebar-title strong {
  font-size: 18px;
  letter-spacing: 0;
}

.app-sidebar-title small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  margin-top: 2px;
}

.app-sidebar-nav {
  display: grid;
  gap: 8px;
}

.app-nav-item {
  color: rgba(255, 255, 255, 0.78) !important;
  font-weight: 850;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.app-nav-item:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff !important;
  transform: translateX(2px);
}

.app-nav-item.active {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.94), rgba(80, 160, 255, 0.78));
  color: #ffffff !important;
  box-shadow: 0 14px 30px rgba(0, 122, 255, 0.30);
}

.app-nav-icon {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  color: #ffffff;
}

.app-nav-item.active .app-nav-icon {
  background: rgba(255, 255, 255, 0.22);
}

.shell {
  padding: 36px 22px 64px !important;
}

.account-badge {
  background: var(--ios-surface) !important;
  border: 1px solid var(--ios-line) !important;
  border-radius: 24px !important;
  box-shadow: var(--ios-soft-shadow) !important;
  backdrop-filter: blur(22px) saturate(1.4);
}

.account-badge span,
.account-badge small {
  color: var(--ios-muted) !important;
}

.account-badge strong {
  color: var(--ios-text) !important;
}

.card,
.metric,
.panel,
.control-card,
.preview-card,
.tabs-card,
.utility-bar,
.quick-actions,
.auto-coverage,
.campaign-drawer,
.search-row,
.table-wrap,
.modal-card,
.locked-card,
.account {
  background: var(--ios-surface) !important;
  border: 1px solid var(--ios-line) !important;
  border-radius: var(--ios-radius-lg) !important;
  box-shadow: var(--ios-soft-shadow) !important;
  backdrop-filter: blur(22px) saturate(1.4);
}

.ios-hero,
.hero,
.topbar {
  background: transparent !important;
}

.brand,
.brand-mark,
.logo-mark {
  background: linear-gradient(145deg, #fff174 0%, #ffd60a 52%, #ffc400 100%) !important;
  border: 1px solid rgba(17, 24, 39, 0.08) !important;
  border-radius: 22px !important;
  box-shadow: 0 18px 38px rgba(255, 214, 10, 0.28) !important;
  color: #111827 !important;
  font-weight: 950 !important;
}

.brand {
  border-radius: 24px !important;
  height: 64px !important;
  width: 64px !important;
}

.ios-hero h1,
.hero h1,
.topbar h1 {
  font-size: clamp(30px, 4vw, 48px) !important;
  font-weight: 900 !important;
  line-height: 0.96 !important;
}

.eyebrow {
  display: inline-flex !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase;
}

button,
.link-button,
.primary-link,
.back-link {
  align-items: center;
  border: 0 !important;
  border-radius: 999px !important;
  display: inline-flex;
  font-weight: 850 !important;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

button:hover,
.link-button:hover,
.primary-link:hover,
.back-link:hover {
  transform: translateY(-1px);
}

button:active,
.link-button:active,
.primary-link:active,
.back-link:active {
  transform: translateY(0);
}

.primary,
.primary-button,
.create-button,
button.primary,
button[type="submit"].primary {
  background: linear-gradient(180deg, #168bff 0%, var(--ios-blue) 100%) !important;
  box-shadow: 0 12px 28px rgba(0, 122, 255, 0.22) !important;
  color: #ffffff !important;
}

.secondary,
.ghost,
.plain-action,
.secondary-create-button,
.filter-button,
.home-link,
.back-link,
.cancel-button {
  background: rgba(0, 122, 255, 0.09) !important;
  color: #0066d6 !important;
  text-decoration: none !important;
}

.danger,
.cancel-danger,
button.danger {
  background: rgba(255, 59, 48, 0.10) !important;
  color: #c3221f !important;
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.84) !important;
  border: 1px solid var(--ios-line-strong) !important;
  border-radius: 16px !important;
  min-height: 46px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 122, 255, 0.72) !important;
  box-shadow: 0 0 0 5px rgba(0, 122, 255, 0.14) !important;
}

label {
  color: #374151 !important;
  font-size: 13px !important;
  font-weight: 850 !important;
}

.tabs,
.ios-segmented,
.tabs-card {
  background: rgba(118, 118, 128, 0.10) !important;
  border-radius: 18px !important;
  padding: 6px !important;
}

.tabs button,
.tab-button,
.tab {
  border-radius: 14px !important;
}

.tabs button.active,
.tab-button.active,
.tab.active {
  background: var(--ios-elevated) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.10) !important;
  color: var(--ios-text) !important;
}

.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.metric {
  padding: 22px !important;
}

.metric strong {
  font-size: 36px !important;
  font-weight: 900 !important;
}

.pill,
.badge,
.status-badge {
  align-items: center;
  border-radius: 999px !important;
  display: inline-flex;
  font-size: 12px !important;
  font-weight: 850 !important;
  min-height: 26px;
  padding: 4px 10px !important;
}

.pill.success,
.badge.success,
.badge.active,
.badge.ok,
.badge.valid,
.badge.publish_success,
.badge.success {
  background: rgba(52, 199, 89, 0.14) !important;
  color: #10893e !important;
}

.pill.failed,
.pill.publish_failed,
.badge.failed,
.badge.error,
.badge.disabled,
.badge.expired {
  background: rgba(255, 59, 48, 0.12) !important;
  color: #c3221f !important;
}

.pill.running,
.pill.queued,
.badge.running,
.badge.warning,
.badge.queued,
.badge.retrying,
.badge.expiring {
  background: rgba(255, 149, 0, 0.14) !important;
  color: #a15c00 !important;
}

.item,
.ios-list-item,
.status-tile,
.promotion-card,
.coverage-row,
.job-row,
.source-card,
.tool-card,
.draft-editor,
.warning {
  border: 1px solid var(--ios-line) !important;
  border-radius: 20px !important;
}

.item,
.ios-list-item,
.status-tile {
  background: rgba(255, 255, 255, 0.72) !important;
}

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

.error-text,
.message-error {
  color: #c3221f !important;
}

.empty,
.empty-state {
  color: var(--ios-muted) !important;
}

.status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.status-tile {
  padding: 14px;
}

.status-tile strong,
.status-tile span {
  display: block;
}

.status-tile span {
  color: var(--ios-muted);
  margin-top: 4px;
}

table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

th {
  background: rgba(118, 118, 128, 0.10) !important;
  color: #374151 !important;
  font-size: 13px !important;
  font-weight: 850 !important;
}

td,
th {
  border-color: var(--ios-line) !important;
}

.modal {
  backdrop-filter: blur(14px);
}

.modal-card {
  max-height: min(86vh, 820px);
  overflow: auto;
}

@media (max-width: 920px) {
  .grid,
  .workspace,
  .create-shipment-workspace,
  .stats {
    grid-template-columns: 1fr !important;
  }

  .control-card {
    position: static !important;
  }

  .account-badge {
    left: 98px !important;
    right: 12px !important;
    top: 12px !important;
  }
}

/* macOS global polish v12 */
:root {
  --mac-bg-1: #fbfbfd;
  --mac-bg-2: #eef3f9;
  --mac-glass: rgba(255, 255, 255, 0.72);
  --mac-glass-strong: rgba(255, 255, 255, 0.88);
  --mac-stroke: rgba(29, 29, 31, 0.10);
  --mac-stroke-strong: rgba(29, 29, 31, 0.16);
  --mac-text: #1d1d1f;
  --mac-muted: #6e6e73;
  --mac-blue: #007aff;
  --mac-blue-soft: rgba(0, 122, 255, 0.12);
  --mac-red: #ff3b30;
  --mac-green: #34c759;
  --mac-radius-xl: 30px;
  --mac-radius-lg: 22px;
  --mac-radius-md: 16px;
  --mac-shadow: 0 24px 70px rgba(31, 35, 44, 0.12), 0 8px 24px rgba(31, 35, 44, 0.06);
  --mac-shadow-soft: 0 14px 40px rgba(31, 35, 44, 0.08);
  --mac-ease: cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-reduced-motion: no-preference) {
  body {
    animation: macPageIn 520ms var(--mac-ease) both;
  }

  .control-card,
  .preview-card,
  .quick-batch-card,
  .card,
  .panel,
  .order-control-panel,
  .analytics-card,
  .inventory-card,
  .promotion-card,
  .admin-card,
  .tabs-card,
  .hero {
    animation: macFloatIn 560ms var(--mac-ease) both;
  }

  button,
  .tab-button,
  .app-nav-item,
  .back-link,
  a.button,
  .secondary,
  .primary,
  .danger,
  .ghost {
    transition: transform 180ms var(--mac-ease), box-shadow 180ms var(--mac-ease), background 180ms var(--mac-ease), border-color 180ms var(--mac-ease), opacity 180ms var(--mac-ease) !important;
  }

  tr,
  td,
  th,
  input,
  select,
  textarea {
    transition: background 160ms var(--mac-ease), box-shadow 160ms var(--mac-ease), border-color 160ms var(--mac-ease), transform 160ms var(--mac-ease) !important;
  }
}

@keyframes macPageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes macFloatIn {
  from { opacity: 0; transform: translateY(10px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 10% -10%, rgba(255, 214, 10, .30), transparent 30%),
    radial-gradient(circle at 94% 0%, rgba(0, 122, 255, .20), transparent 32%),
    radial-gradient(circle at 42% 104%, rgba(52, 199, 89, .11), transparent 30%),
    linear-gradient(180deg, var(--mac-bg-1) 0%, var(--mac-bg-2) 100%) !important;
  color: var(--mac-text) !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif !important;
  min-height: 100vh;
}

body::before {
  background-image: linear-gradient(rgba(255,255,255,.36) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.30) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  inset: 0;
  opacity: .22;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

::selection {
  background: rgba(0, 122, 255, .20);
}

::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(60, 60, 67, .28);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(60, 60, 67, .42);
  border: 3px solid transparent;
  background-clip: padding-box;
}

.page-wrapper,
.shell,
.promotion-page,
.admin-page,
.inventory-page {
  position: relative;
}

.hero,
.tabs-card,
.control-card,
.preview-card,
.quick-batch-card,
.card,
.panel,
.order-control-panel,
.analytics-card,
.chart-card,
.inventory-card,
.promotion-card,
.admin-card,
.account-badge,
.store-badge,
.order-store-badge,
.modal-card,
.table-shell,
.guide-card,
.status-tile,
.metric-card,
.summary-card {
  background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(255,255,255,.62)) !important;
  border: 1px solid var(--mac-stroke) !important;
  border-radius: var(--mac-radius-xl) !important;
  box-shadow: var(--mac-shadow-soft) !important;
  backdrop-filter: blur(26px) saturate(1.35) !important;
  -webkit-backdrop-filter: blur(26px) saturate(1.35) !important;
}

.control-card,
.preview-card,
.quick-batch-card,
.card,
.panel,
.order-control-panel,
.analytics-card,
.inventory-card,
.promotion-card,
.admin-card {
  overflow: hidden;
}

.card-title h2,
.hero h1,
h1,
h2,
h3 {
  color: var(--mac-text) !important;
  letter-spacing: -0.035em;
}

.hero h1 {
  font-weight: 900 !important;
}

.eyebrow {
  color: rgba(60, 60, 67, .72) !important;
  letter-spacing: .08em !important;
}

button,
.button,
.back-link,
a.button,
.primary,
.secondary,
.danger,
.ghost,
.tab-button {
  border: 1px solid rgba(255,255,255,.72) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 24px rgba(31,35,44,.07), inset 0 1px 0 rgba(255,255,255,.72) !important;
  cursor: pointer;
  min-height: 42px;
}

button:hover,
.button:hover,
.back-link:hover,
a.button:hover,
.tab-button:hover {
  box-shadow: 0 14px 32px rgba(31,35,44,.12), inset 0 1px 0 rgba(255,255,255,.86) !important;
  transform: translateY(-1px);
}

button:active,
.button:active,
.back-link:active,
a.button:active,
.tab-button:active {
  transform: translateY(0) scale(.985);
}

.primary,
button.primary {
  background: linear-gradient(180deg, #0a84ff, #0071e3) !important;
  color: #fff !important;
}

.secondary,
button.secondary,
.back-link,
.ghost,
button.ghost {
  background: rgba(242, 248, 255, .78) !important;
  color: #0066cc !important;
}

.danger,
button.danger {
  background: rgba(255, 59, 48, .11) !important;
  color: #d70015 !important;
}

.tab-button {
  background: rgba(255,255,255,.68) !important;
  color: rgba(29,29,31,.78) !important;
  font-weight: 850 !important;
}

.tab-button.active {
  background: rgba(255,255,255,.96) !important;
  color: var(--mac-text) !important;
  box-shadow: 0 16px 36px rgba(31,35,44,.10), inset 0 1px 0 rgba(255,255,255,.92) !important;
}

input,
select,
textarea,
[contenteditable="true"] {
  background: rgba(255,255,255,.70) !important;
  border-color: var(--mac-stroke) !important;
  border-radius: var(--mac-radius-md) !important;
  color: var(--mac-text) !important;
  outline: none !important;
}

input:focus,
select:focus,
textarea:focus,
[contenteditable="true"]:focus {
  background: rgba(255,255,255,.92) !important;
  border-color: rgba(0, 122, 255, .42) !important;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, .12), inset 0 1px 0 rgba(255,255,255,.9) !important;
}

.table-shell {
  border-radius: 22px !important;
}

table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

th {
  background: rgba(118, 118, 128, .10) !important;
  color: rgba(60, 60, 67, .86) !important;
  font-weight: 850 !important;
}

td,
th {
  border-color: rgba(60, 60, 67, .12) !important;
}

tbody tr:hover td {
  background: rgba(0, 122, 255, .045) !important;
}

.quick-batch-cell:focus {
  background: rgba(255,255,255,.92) !important;
  box-shadow: inset 0 0 0 1px rgba(0,122,255,.46), 0 0 0 4px rgba(0,122,255,.10) !important;
}

.quick-batch-cell.selected {
  background: rgba(0,122,255,.10) !important;
  box-shadow: inset 0 0 0 1px rgba(0,122,255,.24) !important;
}

.quick-batch-cell.selection-anchor {
  background: rgba(0,122,255,.14) !important;
  box-shadow: inset 0 0 0 1.5px rgba(0,122,255,.58), 0 0 0 4px rgba(0,122,255,.08) !important;
}

.app-sidebar {
  background: rgba(28, 32, 40, .78) !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  box-shadow: 18px 0 44px rgba(31,35,44,.18) !important;
  backdrop-filter: blur(28px) saturate(1.35) !important;
  -webkit-backdrop-filter: blur(28px) saturate(1.35) !important;
}

.app-nav-item.active {
  background: rgba(10,132,255,.92) !important;
  box-shadow: 0 16px 30px rgba(10,132,255,.30) !important;
}

.brand-mark,
.app-sidebar-logo {
  box-shadow: 0 14px 32px rgba(255, 214, 10, .24), inset 0 1px 0 rgba(255,255,255,.62) !important;
}

.status,
.batch-mini-status,
.badge,
.tag,
.pill {
  border-radius: 999px !important;
}

.batch-mini-status,
.badge,
.tag,
.pill {
  background: rgba(0,122,255,.10) !important;
  color: #0066cc !important;
  border: 1px solid rgba(0,122,255,.10) !important;
}

.modal {
  background: rgba(245,245,247,.46) !important;
  backdrop-filter: blur(22px) saturate(1.2) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.2) !important;
}

.modal-card {
  box-shadow: var(--mac-shadow) !important;
}

.label-preview {
  background: rgba(248,250,252,.66) !important;
  border-color: rgba(0,122,255,.16) !important;
}

.box-label,
.product-label,
.old-box-preview,
.new-box-preview,
.product-pdf-preview {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  animation: none !important;
}

@media (max-width: 920px) {
  body {
    padding-left: 0 !important;
  }

  .app-sidebar {
    bottom: 12px !important;
    flex-direction: row !important;
    height: 64px !important;
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    width: auto !important;
  }

  .app-sidebar:hover,
  .app-sidebar:focus-within {
    width: auto !important;
  }

  .app-sidebar-title,
  .app-nav-label {
    display: none !important;
  }

  .app-sidebar-nav {
    display: flex !important;
    flex: 1;
    justify-content: space-around;
    margin: 0 !important;
  }

  .page-wrapper,
  .shell,
  .promotion-page,
  .admin-page,
  .inventory-page {
    margin-left: 0 !important;
    padding-bottom: 96px !important;
  }
}

