:root {
  --sidebar: #111827;
  --sidebar-muted: #94a3b8;
  --primary: #2563eb;
  --surface: #ffffff;
  --background: #f4f7fb;
  --line: #e2e8f0;
  --ink: #0f172a;
  --muted: #64748b;
  --success: #047857;
  --warning: #b45309;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

.app-shell { min-height: 100vh; }
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: var(--sidebar);
  z-index: 20;
}
.sidebar-brand { padding: 24px 20px 18px; border-bottom: 1px solid #243044; }
.brand-link, .auth-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.brand-link strong, .auth-brand strong { display: block; font-size: 18px; }
.brand-link small, .auth-brand small {
  display: block;
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: 10px;
  letter-spacing: .12em;
}
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 10px;
}
.sidebar-nav { flex: 1; min-height: 0; padding: 18px 12px; overflow-y: auto; }
.nav-section-label {
  padding: 0 10px 8px;
  color: var(--sidebar-muted);
  font-size: 11px;
  letter-spacing: .08em;
}
.sidebar-link {
  display: flex;
  gap: 11px;
  align-items: center;
  margin: 3px 0;
  padding: 11px 12px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
}
.sidebar-link:hover, .sidebar-link.active { color: #fff; background: #243044; }
.sidebar-sub-link {
  position: relative;
  gap: 7px;
  margin: 0 0 7px 34px;
  padding: 7px 10px;
  color: #94a3b8;
  font-size: 12px;
}
.sidebar-sub-link::before {
  position: absolute;
  top: -7px;
  bottom: 0;
  left: -18px;
  width: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, .32);
  border-left: 1px solid rgba(148, 163, 184, .32);
  border-bottom-left-radius: 7px;
  content: "";
}
.sidebar-sub-link i { font-size: 10px; }
.sidebar-sub-link:hover,
.sidebar-sub-link.active { color: #dbeafe; background: rgba(37, 99, 235, .18); }
.nav-step {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  color: #bfdbfe;
  background: rgba(37, 99, 235, .22);
  border: 1px solid rgba(147, 197, 253, .28);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
}
.sidebar-link.active .nav-step { color: #fff; background: var(--primary); border-color: var(--primary); }
.sidebar-link .nav-count {
  margin-left: auto;
  padding: 1px 7px;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  font-size: 11px;
}
.sidebar-link .nav-count-warning { background: #d97706; }
.nav-disclosure {
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, .16);
}
.nav-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 12px;
  list-style: none;
}
.nav-disclosure summary::-webkit-details-marker { display: none; }
.nav-disclosure summary span { display: flex; gap: 9px; align-items: center; }
.nav-disclosure summary > i { transition: transform .18s ease; }
.nav-disclosure[open] summary > i { transform: rotate(180deg); }
.nav-disclosure > p { margin: -2px 10px 7px; color: #64748b; font-size: 10px; }
.nav-disclosure .sidebar-link { margin-left: 6px; padding-block: 9px; font-size: 13px; }
.sidebar-footer { padding: 14px; }
.sidebar-help {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
  padding: 9px 11px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
}
.sidebar-help:hover, .sidebar-help.active { color: #fff; background: #243044; }
.scope-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  color: #cbd5e1;
  background: #1e293b;
  border-radius: 9px;
}
.scope-card small, .scope-card strong { display: block; }
.scope-card small { color: var(--sidebar-muted); font-size: 10px; }
.scope-card strong { font-size: 13px; }

.app-main { min-height: 100vh; margin-left: 236px; }
.app-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.page-heading h1 { margin: 2px 0 0; font-size: 22px; }
.breadcrumb-line {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
}
.header-actions { display: flex; gap: 10px; align-items: center; }
.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  font-weight: 700;
}
.app-content { padding: 24px 28px 40px; }

.content-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(15, 23, 42, .04);
}
.content-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.content-card-header h2 { margin: 0; font-size: 17px; }
.content-card-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.import-upload-card .form-label { margin-bottom: 6px; font-weight: 650; }
.import-upload-card .form-text { margin-top: 5px; line-height: 1.5; }
.import-upload-card .has-error .form-control,
.import-upload-card .has-error .form-select,
.import-upload-card .has-error .searchable-select-input { border-color: #dc3545; }
.import-format-note {
  padding: 11px 13px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.55;
}
.import-format-note strong { display: block; margin-bottom: 2px; color: #1e293b; }
.import-format-note span { display: block; }
.import-format-note.is-success { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.import-format-note.is-warning { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.import-history-table th { white-space: nowrap; }
.import-history-table td { vertical-align: middle; }
.import-file-name {
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}
.table { font-size: 13px; }
.table thead th {
  padding: 11px 14px;
  color: #475569;
  background: #f8fafc;
  border-bottom-color: var(--line);
  white-space: nowrap;
}

.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}
.audit-search-field { grid-column: span 2; }
.audit-filter-actions { display: flex; gap: 8px; }
.audit-log-table td { max-width: 320px; vertical-align: top; }
.audit-log-table code { font-size: 11px; overflow-wrap: anywhere; }
.audit-metadata {
  max-width: 420px;
  max-height: 220px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  color: #334155;
  background: #f8fafc;
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 768px) {
  .audit-search-field { grid-column: span 1; }
}
.table tbody td { padding: 12px 14px; vertical-align: middle; }

.metric-card, .mini-stat {
  height: 100%;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.metric-card small, .mini-stat small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.metric-card strong, .mini-stat strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.mini-stat strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; }
.mini-stat.success strong { color: var(--success); }
.mini-stat.warning strong { color: var(--warning); }
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.status-success { color: #065f46; background: #d1fae5; }
.status-warning { color: #92400e; background: #fef3c7; }
.status-danger { color: #991b1b; background: #fee2e2; }
.status-neutral { color: #334155; background: #e2e8f0; }
.message-stack {
  position: sticky;
  top: 12px;
  z-index: 15;
}
.monthly-table-scroll { max-height: 360px; overflow-y: auto; }

.weekly-review-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.weekly-source-status { align-items: center; }
.weekly-country-block { padding: 1.25rem 1.5rem 0; }
.weekly-country-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  margin-bottom: .75rem;
}
.weekly-country-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: 1.1rem;
}
.weekly-country-heading span {
  padding: .18rem .55rem;
  border-radius: 999px;
  color: var(--muted);
  background: #f1f5f9;
  font-size: .75rem;
  font-weight: 700;
}
.weekly-product-table { min-width: 1060px; }
.weekly-product-table th:first-child,
.weekly-product-table td:first-child { min-width: 180px; }
.weekly-product-table th:not(:first-child),
.weekly-product-table td:not(:first-child) { min-width: 142px; }
.weekly-sales-cell { display: grid; gap: .2rem; white-space: nowrap; }
.weekly-sales-cell span { color: var(--muted); font-size: .86rem; }
.weekly-sales-total strong,
.weekly-sales-total span { color: var(--primary); }
.weekly-report-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .7rem 1.25rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.weekly-country-heading h2 {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.weekly-country-heading h2 span {
  padding: .18rem .55rem;
  border-radius: 999px;
  color: var(--muted);
  background: #f1f5f9;
  font-size: .75rem;
}
.weekly-country-yoy { display: flex; gap: 1.5rem; }
.weekly-country-yoy > div { display: grid; gap: .2rem; text-align: right; }
.weekly-country-yoy small { color: var(--muted); }
.weekly-country-yoy strong { font-size: 1.05rem; }
.weekly-yoy-table { min-width: 920px; }
.weekly-yoy-table th:not(:first-child),
.weekly-yoy-table td:not(:first-child) { min-width: 185px; }
.weekly-yoy-table th small {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
}
.weekly-metric-line {
  display: grid;
  grid-template-columns: 42px minmax(72px, 1fr) auto;
  align-items: baseline;
  gap: .35rem;
  white-space: nowrap;
}
.weekly-metric-line + .weekly-metric-line { margin-top: .45rem; }
.weekly-metric-line span { color: var(--muted); font-size: .75rem; }
.weekly-metric-line strong { font-size: .9rem; }
.weekly-metric-line em { font-size: .78rem; font-style: normal; font-weight: 700; }
.weekly-total-cell { background: #f8fafc !important; }
.trend-up { color: #dc2626 !important; }
.trend-down { color: #059669 !important; }
.trend-neutral { color: var(--muted) !important; }

/* Primary operations workspace */
.operations-hero {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 28px 30px;
  color: #fff;
  background: linear-gradient(135deg, #172554 0%, #1d4ed8 62%, #2563eb 100%);
  border-radius: 16px;
  box-shadow: 0 16px 38px rgba(30, 64, 175, .16);
}
.operations-hero > div { max-width: 820px; }
.operations-kicker { color: #bfdbfe; font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.operations-hero h2 { margin: 8px 0 10px; font-size: clamp(25px, 3vw, 34px); }
.operations-hero p { margin: 0; color: #dbeafe; line-height: 1.75; }
.operations-hero .btn { flex: 0 0 auto; }
.operations-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.operations-step {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px 12px;
  min-height: 190px;
  padding: 20px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 5px 18px rgba(15, 23, 42, .035);
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.operations-step:hover {
  color: var(--ink);
  border-color: #93c5fd;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .10);
  transform: translateY(-2px);
}
.operations-step-number {
  position: absolute;
  top: 14px;
  right: 15px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
}
.operations-step > i {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 11px;
  font-size: 20px;
}
.operations-step strong { display: block; margin: 1px 0 6px; font-size: 16px; }
.operations-step p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.operations-step > small {
  grid-column: 1 / -1;
  align-self: end;
  padding-top: 12px;
  color: #475569;
  border-top: 1px solid #eef2f7;
}
.operations-checks { display: grid; }
.operations-checks > a {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 17px 20px;
  color: inherit;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.operations-checks > a:last-child { border-bottom: 0; }
.operations-checks > a:hover { background: #f8fafc; }
.operations-checks i { font-size: 19px; }
.operations-checks strong, .operations-checks small { display: block; }
.operations-checks small { margin-top: 3px; color: var(--muted); }
.operations-sources { display: grid; gap: 0; padding: 4px 20px; }
.operations-sources > div { padding: 15px 0; border-bottom: 1px solid var(--line); }
.operations-sources > div:last-child { border-bottom: 0; }
.operations-sources span, .operations-sources strong, .operations-sources small { display: block; }
.operations-sources span { color: var(--primary); font-size: 11px; font-weight: 800; }
.operations-sources strong { margin: 4px 0; font-size: 14px; }
.operations-sources small { color: var(--muted); line-height: 1.55; }
.process-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.process-strip > div { display: flex; gap: 11px; align-items: center; min-width: 0; }
.process-strip b {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  font-size: 12px;
}
.process-strip strong, .process-strip small { display: block; }
.process-strip strong { font-size: 13px; }
.process-strip small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.process-strip > i { color: #94a3b8; }
.rule-note {
  height: 100%;
  padding: 13px 15px;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}
.rule-note strong, .rule-note span { display: block; }
.rule-note span { margin-top: 4px; font-size: 12px; line-height: 1.65; }

/* In-product usage guide */
.guide-hero {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 18%, rgba(147, 197, 253, .36), transparent 24%),
    linear-gradient(135deg, #172554 0%, #1d4ed8 58%, #2563eb 100%);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(30, 64, 175, .18);
}
.guide-hero > div:first-child { max-width: 800px; }
.guide-hero h2 { margin: 9px 0 10px; font-size: clamp(24px, 3vw, 34px); }
.guide-hero p { margin: 0; color: #dbeafe; line-height: 1.75; }
.guide-kicker {
  display: inline-flex;
  padding: 4px 10px;
  color: #dbeafe;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  font-size: 12px;
}
.guide-hero-actions { display: flex; flex-shrink: 0; gap: 10px; }
.guide-jump {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.guide-jump-compact { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.guide-jump a {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 10px 8px;
  color: #334155;
  text-align: center;
  text-decoration: none;
  border-right: 1px solid var(--line);
}
.guide-jump a:last-child { border-right: 0; }
.guide-jump a:hover { color: var(--primary); background: #eff6ff; }
.guide-jump i { color: var(--primary); font-size: 17px; }
.guide-jump span { font-size: 13px; }
.guide-section {
  scroll-margin-top: 18px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .035);
}
.guide-section-heading {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.guide-section-heading > div { display: flex; gap: 12px; align-items: center; }
.guide-section-heading span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.guide-section-heading h2 { margin: 0; font-size: 20px; }
.guide-section-heading p {
  max-width: 520px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-align: right;
}
.guide-checklist { display: grid; gap: 10px; }
.guide-checklist > div {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 9px;
  line-height: 1.6;
}
.guide-checklist i { margin-top: 1px; color: var(--success); font-size: 18px; }
.guide-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.guide-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 10px;
  align-items: center;
  min-height: 76px;
  padding: 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.guide-step b {
  grid-row: 1 / 3;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  font-size: 13px;
}
.guide-step span { font-size: 14px; font-weight: 700; }
.guide-step small { color: var(--muted); }
.guide-subtitle { margin: 0 0 12px; font-size: 16px; }
.guide-list { margin: 0; padding-left: 22px; }
.guide-list li { margin-bottom: 11px; padding-left: 4px; line-height: 1.7; }
.guide-list li:last-child { margin-bottom: 0; }
.guide-callout {
  height: 100%;
  padding: 17px 18px;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  border-radius: 9px;
}
.guide-callout.warning { color: #78350f; background: #fffbeb; border-color: #fde68a; border-left-color: #d97706; }
.guide-callout.danger { color: #7f1d1d; background: #fef2f2; border-color: #fecaca; border-left-color: #dc2626; }
.guide-callout strong { display: block; margin-bottom: 5px; }
.guide-callout p { margin: 0; line-height: 1.7; }
.guide-table { border: 1px solid var(--line); }
.guide-table td { min-width: 140px; line-height: 1.55; }
.guide-rule-card {
  height: 100%;
  padding: 19px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.guide-rule-card > span {
  display: inline-block;
  padding: 3px 8px;
  color: #334155;
  background: #e2e8f0;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
}
.guide-rule-card.success { background: #f0fdf4; border-color: #bbf7d0; }
.guide-rule-card.success > span { color: #065f46; background: #d1fae5; }
.guide-rule-card h3 { margin: 12px 0 7px; font-size: 17px; }
.guide-rule-card p { margin: 0 0 10px; color: #475569; line-height: 1.7; }
.guide-rule-card small { color: var(--muted); }
.guide-chain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(240px, 1.15fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
.guide-chain-sources { display: grid; gap: 10px; }
.guide-chain-sources > div,
.guide-chain-bridge,
.guide-chain-result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.guide-chain-sources > div {
  position: relative;
  padding-left: 48px;
  background: #f8fafc;
}
.guide-chain-sources i {
  position: absolute;
  left: 16px;
  color: var(--primary);
  font-size: 22px;
}
.guide-chain small,
.guide-chain span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.guide-chain-bridge { gap: 7px; color: #fff; background: #1d4ed8; border-color: #1d4ed8; }
.guide-chain-bridge small { color: #bfdbfe; }
.guide-chain-bridge code { color: #fff; font-size: 12px; }
.guide-chain-result { gap: 6px; background: #f0fdf4; border-color: #bbf7d0; }
.guide-chain-result strong { color: #065f46; }
.guide-chain-arrow { align-self: center; color: #94a3b8; font-size: 22px; }
.guide-details {
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.guide-details summary { cursor: pointer; font-weight: 700; }
.guide-details span {
  padding: 5px 9px;
  color: #334155;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}
.guide-resolution-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}
.guide-resolution-flow > div {
  min-height: 96px;
  padding: 17px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.guide-resolution-flow b, .guide-resolution-flow span { display: block; }
.guide-resolution-flow b { margin-bottom: 7px; }
.guide-resolution-flow span { color: var(--muted); font-size: 13px; line-height: 1.55; }
.guide-resolution-flow > i { color: #94a3b8; font-size: 21px; }
.guide-formulas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.guide-formulas > div {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 14px 16px;
  background: #0f172a;
  border-radius: 9px;
}
.guide-formulas span { flex: 0 0 auto; color: #bfdbfe; font-weight: 700; }
.guide-formulas code { color: #f8fafc; text-align: right; }
.guide-accordion .accordion-button { font-weight: 700; }
.guide-accordion .accordion-body { color: #475569; line-height: 1.75; }

.auth-body { min-height: 100vh; background: #eaf0fa; }
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .13);
}
.auth-card .auth-brand { margin-bottom: 24px; color: var(--ink); }
.auth-card h1 { margin-bottom: 22px; font-size: 24px; }

/* Apple-inspired workspace
 * Scoped to the master-data and advertising-import workspaces so existing
 * screens keep their current Bootstrap and application styling.
 */
.apple-workspace {
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-ink: #1d1d1f;
  --apple-secondary: #6e6e73;
  --apple-tertiary: #6e6e73;
  --apple-canvas: #f5f5f7;
  --apple-surface: rgba(255, 255, 255, .94);
  --apple-line: rgba(0, 0, 0, .09);
  --apple-line-strong: rgba(0, 0, 0, .15);
  --apple-success: #248a3d;
  --apple-warning: #b25000;
  --apple-danger: #d70015;
  --apple-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 36px rgba(0, 0, 0, .055);
  min-height: calc(100vh - 138px);
  margin: -24px -28px -40px;
  padding: 32px 32px 64px;
  color: var(--apple-ink);
  background: var(--apple-canvas);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.apple-workspace .apple-hero {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  justify-content: space-between;
  max-width: 1480px;
  margin: 0 auto 22px;
  padding: 6px 2px 2px;
}
.apple-workspace .apple-hero-copy { min-width: 0; max-width: 860px; }
.apple-workspace .apple-eyebrow {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--apple-blue);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
}
.apple-workspace .apple-hero h1,
.apple-workspace .apple-hero h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.16;
}
.apple-workspace .apple-hero p {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--apple-secondary);
  font-size: 15px;
  line-height: 1.65;
}
.apple-workspace .apple-hero-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
}

.apple-workspace .apple-stat-strip {
  display: flex;
  max-width: 1480px;
  gap: 8px;
  margin: 0 auto 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.apple-workspace .apple-stat-strip::-webkit-scrollbar { display: none; }
.apple-workspace .apple-stat-pill {
  display: inline-flex;
  min-height: 36px;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  padding: 7px 12px;
  color: var(--apple-secondary);
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--apple-line);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .025);
  font-size: 12px;
  white-space: nowrap;
}
.apple-workspace .apple-stat-pill strong {
  color: var(--apple-ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.apple-workspace .apple-stat-pill.success strong { color: var(--apple-success); }
.apple-workspace .apple-stat-pill.warning strong { color: var(--apple-warning); }
.apple-workspace .apple-stat-pill.danger strong { color: var(--apple-danger); }

.apple-workspace .apple-content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}
.apple-workspace .apple-card {
  overflow: hidden;
  background: var(--apple-surface);
  border: 1px solid var(--apple-line);
  border-radius: 20px;
  box-shadow: var(--apple-shadow);
  backdrop-filter: saturate(150%) blur(18px);
}
.apple-workspace .apple-card + .apple-card { margin-top: 18px; }
.apple-workspace .apple-card-header {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--apple-line);
}
.apple-workspace .apple-card-header h2,
.apple-workspace .apple-card-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.015em;
}
.apple-workspace .apple-card-header p {
  margin: 4px 0 0;
  color: var(--apple-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.apple-workspace .apple-card-body { padding: 22px; }
.apple-workspace .apple-card-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 22px;
  background: rgba(245, 245, 247, .7);
  border-top: 1px solid var(--apple-line);
}
.apple-workspace .apple-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.apple-workspace .apple-segmented-tabs {
  display: flex;
  max-width: 1480px;
  gap: 3px;
  margin: 0 auto 18px;
  padding: 4px;
  overflow-x: auto;
  background: rgba(118, 118, 128, .12);
  border-radius: 12px;
  scrollbar-width: none;
}
.apple-workspace .apple-segmented-tabs::-webkit-scrollbar { display: none; }
.apple-workspace .apple-segment,
.apple-workspace .apple-segmented-tabs .nav-link {
  min-height: 36px;
  flex: 1 0 auto;
  padding: 8px 15px;
  color: var(--apple-secondary);
  background: transparent;
  border: 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 550;
  line-height: 20px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.apple-workspace .apple-segment:hover,
.apple-workspace .apple-segmented-tabs .nav-link:hover { color: var(--apple-ink); }
.apple-workspace .apple-segment.active,
.apple-workspace .apple-segment[aria-selected="true"],
.apple-workspace .apple-segmented-tabs .nav-link.active {
  color: var(--apple-ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .13);
}

.apple-workspace .form-label,
.apple-workspace .apple-field-label {
  margin-bottom: 7px;
  color: var(--apple-ink);
  font-size: 13px;
  font-weight: 600;
}
.apple-workspace .form-control,
.apple-workspace .form-select,
.apple-workspace .apple-control {
  min-height: 44px;
  padding: 9px 12px;
  color: var(--apple-ink);
  background-color: rgba(255, 255, 255, .94);
  border: 1px solid var(--apple-line-strong);
  border-radius: 10px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .02);
  font-size: 14px;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.apple-workspace textarea.form-control,
.apple-workspace textarea.apple-control { min-height: 96px; }
.apple-workspace .form-control:focus,
.apple-workspace .form-select:focus,
.apple-workspace .apple-control:focus {
  background-color: #fff;
  border-color: rgba(0, 113, 227, .7);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .14);
  outline: 0;
}
.apple-workspace .form-text,
.apple-workspace .apple-field-help {
  margin-top: 6px;
  color: var(--apple-tertiary);
  font-size: 12px;
  line-height: 1.5;
}
.apple-workspace .btn {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}
.apple-workspace .apple-button-primary,
.apple-workspace .apple-button-secondary {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}
.apple-workspace .btn-primary,
.apple-workspace .apple-button-primary {
  color: #fff;
  background: var(--apple-blue);
  border-color: var(--apple-blue);
  box-shadow: 0 1px 2px rgba(0, 80, 168, .16);
}
.apple-workspace .btn-primary:hover,
.apple-workspace .apple-button-primary:hover {
  color: #fff;
  background: var(--apple-blue-hover);
  border-color: var(--apple-blue-hover);
}
.apple-workspace .btn-outline-secondary,
.apple-workspace .apple-button-secondary {
  color: var(--apple-ink);
  background: rgba(255, 255, 255, .8);
  border-color: var(--apple-line-strong);
}

.apple-workspace .apple-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}
.apple-workspace .apple-step {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 9px;
  align-items: center;
  min-width: 0;
  padding-right: 22px;
  color: var(--apple-tertiary);
}
.apple-workspace .apple-step::after {
  position: absolute;
  top: 15px;
  right: 8px;
  left: 42px;
  height: 1px;
  content: "";
  background: var(--apple-line-strong);
}
.apple-workspace .apple-step:last-child::after { display: none; }
.apple-workspace .apple-step-index {
  grid-row: 1 / 3;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  background: #e8e8ed;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.apple-workspace .apple-step strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.apple-workspace .apple-step small {
  overflow: hidden;
  color: var(--apple-tertiary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.apple-workspace .apple-step.active,
.apple-workspace .apple-step.complete { color: var(--apple-ink); }
.apple-workspace .apple-step.active .apple-step-index {
  color: #fff;
  background: var(--apple-blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .11);
}
.apple-workspace .apple-step.complete .apple-step-index { color: #fff; background: var(--apple-success); }
.apple-workspace .apple-step.complete::after { background: rgba(36, 138, 61, .38); }

.apple-workspace .apple-dropzone {
  position: relative;
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 28px;
  color: var(--apple-secondary);
  background: rgba(0, 113, 227, .025);
  border: 1px dashed rgba(0, 113, 227, .38);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.apple-workspace .apple-dropzone:hover,
.apple-workspace .apple-dropzone.is-dragging {
  background: rgba(0, 113, 227, .065);
  border-color: var(--apple-blue);
}
.apple-workspace .apple-dropzone:focus-within {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .14);
}
.apple-workspace .apple-dropzone.is-dragging { transform: scale(.997); }
.apple-workspace .apple-dropzone-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  place-items: center;
  color: var(--apple-blue);
  background: rgba(0, 113, 227, .1);
  border-radius: 14px;
  font-size: 22px;
}
.apple-workspace .apple-dropzone strong { display: block; color: var(--apple-ink); font-size: 15px; }
.apple-workspace .apple-dropzone p { margin: 6px 0 0; font-size: 13px; line-height: 1.55; }
.apple-workspace .apple-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.apple-workspace .apple-sticky-action {
  position: sticky;
  bottom: 16px;
  z-index: 12;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 12px 14px 12px 18px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--apple-line);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .12);
  backdrop-filter: saturate(180%) blur(22px);
}
.apple-workspace .apple-sticky-action p { margin: 0; color: var(--apple-secondary); font-size: 12px; }
.apple-workspace .apple-sticky-buttons { display: flex; flex: 0 0 auto; gap: 8px; }

.apple-workspace .apple-empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 42px 24px;
  color: var(--apple-secondary);
  text-align: center;
}
.apple-workspace .apple-empty-state-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 15px;
  place-items: center;
  color: var(--apple-tertiary);
  background: #f1f1f3;
  border-radius: 18px;
  font-size: 25px;
}
.apple-workspace .apple-empty-state h3 { margin: 0; color: var(--apple-ink); font-size: 17px; }
.apple-workspace .apple-empty-state p {
  max-width: 440px;
  margin: 7px auto 16px;
  font-size: 13px;
  line-height: 1.65;
}

.apple-workspace .apple-table-wrap { overflow-x: auto; }
.apple-workspace .apple-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13px; }
.apple-workspace .apple-table th {
  padding: 11px 14px;
  color: var(--apple-secondary);
  background: rgba(245, 245, 247, .72);
  border-bottom: 1px solid var(--apple-line);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
  text-align: left;
  white-space: nowrap;
}
.apple-workspace .apple-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--apple-line);
  vertical-align: middle;
}
.apple-workspace .apple-table tbody tr:last-child td { border-bottom: 0; }
.apple-workspace .apple-table tbody tr:hover { background: rgba(0, 113, 227, .025); }

/* Master data: compact library layout. */
.apple-master-workspace > .apple-card,
.apple-master-workspace > .apple-tab-content {
  width: 100%;
  max-width: 1480px;
  margin-right: auto;
  margin-left: auto;
}
.apple-master-workspace .apple-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.apple-master-workspace .apple-settings-hero,
.apple-import-workspace .apple-simple-hero {
  margin-bottom: 16px;
  padding-top: 0;
}
.apple-master-workspace .apple-settings-hero h2,
.apple-import-workspace .apple-simple-hero h2 {
  font-size: clamp(26px, 2.5vw, 34px);
}
.apple-master-workspace .apple-settings-hero p,
.apple-import-workspace .apple-simple-hero p {
  margin-top: 7px;
  line-height: 1.5;
}
.apple-master-workspace .apple-stat-strip {
  grid-column: 1 / -1;
  max-width: none;
  margin: 18px 0 0;
}
.apple-master-workspace .apple-stat-pill {
  min-width: 112px;
  justify-content: space-between;
  padding: 8px 14px;
}
.apple-master-workspace .apple-stat-pill strong { font-size: 16px; }
.apple-master-workspace .apple-import-card { margin-bottom: 18px; }
.apple-master-workspace .apple-import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr);
  gap: 20px;
  align-items: stretch;
}
.apple-master-workspace .apple-title-group {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: center;
}
.apple-master-workspace .apple-icon-tile {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--apple-blue);
  background: rgba(0, 113, 227, .1);
  border-radius: 12px;
  font-size: 18px;
}
.apple-master-workspace .apple-icon-tile.neutral {
  color: #58585d;
  background: #f0f0f2;
}
.apple-master-workspace .apple-text-action {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  color: var(--apple-blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.apple-master-workspace .apple-dropzone {
  min-height: 126px;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  justify-items: start;
  padding: 22px;
  text-align: left;
}
.apple-master-workspace .apple-dropzone-icon { margin: 0; }
.apple-master-workspace .apple-dropzone-copy small {
  display: block;
  margin-top: 5px;
  color: var(--apple-tertiary);
  font-size: 12px;
  line-height: 1.5;
}
.apple-master-workspace .apple-inline-action {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.apple-master-workspace .apple-safe-note {
  color: var(--apple-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.apple-master-workspace .apple-safe-note i { color: var(--apple-success); }
.apple-master-workspace .apple-disclosure,
.apple-import-workspace .apple-details {
  overflow: hidden;
  background: rgba(245, 245, 247, .75);
  border: 1px solid var(--apple-line);
  border-radius: 16px;
}
.apple-master-workspace .apple-disclosure { align-self: start; }
.apple-master-workspace .apple-disclosure summary,
.apple-import-workspace .apple-details summary {
  display: flex;
  min-height: 52px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  color: var(--apple-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.apple-master-workspace .apple-disclosure summary::-webkit-details-marker,
.apple-import-workspace .apple-details summary::-webkit-details-marker { display: none; }
.apple-master-workspace .apple-disclosure summary > i:last-child,
.apple-import-workspace .apple-details summary > i:last-child { transition: transform .18s ease; }
.apple-master-workspace .apple-disclosure[open] summary > i:last-child,
.apple-import-workspace .apple-details[open] summary > i:last-child { transform: rotate(180deg); }
.apple-master-workspace .apple-disclosure-body,
.apple-import-workspace .apple-details-content {
  padding: 0 16px 16px;
  color: var(--apple-secondary);
  font-size: 12px;
  line-height: 1.65;
}
.apple-master-workspace .apple-disclosure-body ol { margin: 8px 0; padding-left: 20px; }
.apple-master-workspace .apple-library-card { overflow: visible; }
.apple-master-workspace .apple-library-heading { border-bottom: 0; }
.apple-master-workspace .apple-library-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.apple-master-workspace .apple-status-pill { color: var(--apple-success); }
.apple-master-workspace .apple-segmented-shell {
  padding: 0 18px 16px;
  overflow: hidden;
}
.apple-master-workspace .apple-segmented-shell .apple-segmented-tabs {
  max-width: none;
  margin: 0;
}
.apple-master-workspace .apple-segmented .nav-link span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  place-items: center;
  color: var(--apple-tertiary);
  background: rgba(118, 118, 128, .1);
  border-radius: 999px;
  font-size: 11px;
}
.apple-master-workspace .apple-segmented .nav-link.active span {
  color: var(--apple-blue);
  background: rgba(0, 113, 227, .09);
}
.apple-master-workspace .apple-filter-bar {
  padding: 14px 18px;
  background: rgba(245, 245, 247, .72);
  border-top: 1px solid var(--apple-line);
  border-radius: 0 0 20px 20px;
}
.apple-master-workspace .apple-filter-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, .75fr) auto;
  gap: 10px;
  align-items: center;
}
.apple-master-workspace .apple-search-field {
  position: relative;
  display: block;
}
.apple-master-workspace .apple-search-field i {
  position: absolute;
  top: 50%;
  left: 13px;
  color: var(--apple-tertiary);
  transform: translateY(-50%);
  pointer-events: none;
}
.apple-master-workspace .apple-search-field input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px 9px 38px;
  background: #fff;
  border: 1px solid var(--apple-line-strong);
  border-radius: 10px;
  outline: none;
}
.apple-master-workspace .apple-search-field input:focus {
  border-color: rgba(0, 113, 227, .7);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .14);
}
.apple-master-workspace .apple-tab-content { margin-top: 18px; }
.apple-master-workspace .apple-tab-content .content-card {
  overflow: hidden;
  background: var(--apple-surface);
  border: 1px solid var(--apple-line);
  border-radius: 20px;
  box-shadow: var(--apple-shadow);
}
.apple-master-workspace .content-card-header {
  display: flex;
  min-height: 72px;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--apple-line);
}
.apple-master-workspace .content-card-header h2,
.apple-master-workspace .content-card-header h3 { margin: 0; font-size: 18px; }
.apple-master-workspace .content-card-header p {
  margin: 4px 0 0;
  color: var(--apple-secondary);
  font-size: 13px;
}
.apple-master-workspace .content-card .table { font-size: 13px; }
.apple-master-workspace .content-card .table > :not(caption) > * > * {
  padding: 13px 16px;
  border-color: var(--apple-line);
  vertical-align: middle;
}
.apple-master-workspace .content-card .table thead th {
  color: var(--apple-secondary);
  background: rgba(245, 245, 247, .72);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.apple-master-workspace .content-card .table tbody tr:hover { background: rgba(0, 113, 227, .025); }

/* Advertising import: one obvious path from scope to preview. */
.apple-import-workspace > .apple-hero,
.apple-import-workspace > .apple-steps,
.apple-import-workspace > .apple-card {
  width: 100%;
  max-width: 1320px;
  margin-right: auto;
  margin-left: auto;
}
.apple-import-workspace .apple-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
  padding: 15px 18px;
  background: rgba(255, 255, 255, .76);
  border: 1px solid var(--apple-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .025);
  list-style: none;
}
.apple-import-workspace .apple-steps .apple-step { padding: 0 26px 0 0; }
.apple-import-workspace .apple-step-number {
  grid-row: 1 / 3;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--apple-tertiary);
  background: #e8e8ed;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.apple-import-workspace .apple-step.is-active { color: var(--apple-ink); }
.apple-import-workspace .apple-step.is-active .apple-step-number {
  color: #fff;
  background: var(--apple-blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .1);
}
.apple-import-workspace .apple-flow-section {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 34px;
  padding: 28px;
  border-top: 1px solid var(--apple-line);
}
.apple-import-workspace .apple-flow-section:first-of-type { border-top: 0; }
.apple-import-workspace .apple-flow-label {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: flex-start;
}
.apple-import-workspace .apple-flow-index {
  flex: 0 0 auto;
  color: var(--apple-blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}
.apple-import-workspace .apple-flow-label h3 { margin: 0; font-size: 16px; font-weight: 650; }
.apple-import-workspace .apple-flow-label p {
  margin: 5px 0 0;
  color: var(--apple-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.apple-import-workspace .apple-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.apple-import-workspace .apple-simple-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--apple-line);
}
.apple-import-workspace .apple-simple-fields .apple-status-note {
  grid-column: 1 / -1;
  margin-top: 0;
}
.apple-import-workspace .apple-simple-upload { padding: 22px 28px 26px; }
.apple-import-workspace .apple-field.has-error .form-control,
.apple-import-workspace .apple-field.has-error .form-select,
.apple-import-workspace .apple-dropzone.has-error { border-color: rgba(215, 0, 21, .55); }
.apple-import-workspace .apple-status-note {
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--apple-secondary);
  background: #f5f5f7;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
}
.apple-import-workspace .apple-status-note.is-success {
  color: #176c2f;
  background: rgba(36, 138, 61, .08);
}
.apple-import-workspace .apple-status-note.is-warning {
  color: var(--apple-warning);
  background: rgba(178, 80, 0, .08);
}
.apple-import-workspace .apple-dropzone {
  min-height: 132px;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  justify-items: start;
  padding: 24px;
  text-align: left;
}
.apple-import-workspace .apple-dropzone-icon { margin: 0; }
.apple-import-workspace .apple-dropzone-copy span {
  display: block;
  margin-top: 5px;
  color: var(--apple-tertiary);
  font-size: 12px;
}
.apple-import-workspace .apple-submit-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.apple-import-workspace .apple-submit-row > span {
  color: var(--apple-secondary);
  font-size: 12px;
}
.apple-import-workspace .apple-submit-row > span i { color: var(--apple-success); }
.apple-import-workspace .apple-form-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 20px 28px 0;
  border-radius: 12px;
}
.apple-import-workspace .apple-details { margin-top: 18px; }
.apple-import-workspace .apple-details-content { padding: 0 18px 18px; }
.apple-import-workspace .apple-history-card { margin-top: 18px; }
.apple-import-workspace .apple-status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 9px;
  color: var(--apple-secondary);
  background: #f1f1f3;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.apple-import-workspace .apple-status-preview {
  color: #7a4b00;
  background: rgba(178, 80, 0, .1);
}
.apple-import-workspace .apple-status-completed {
  color: #176c2f;
  background: rgba(36, 138, 61, .1);
}
.apple-import-workspace .apple-status-failed {
  color: #a50012;
  background: rgba(215, 0, 21, .09);
}
.apple-import-workspace .apple-file-name {
  display: block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.apple-import-workspace .apple-inline-warning {
  margin-top: 12px;
  padding: 11px 13px;
  color: var(--apple-warning);
  background: rgba(178, 80, 0, .08);
  border-radius: 10px;
  font-size: 12px;
}
.apple-import-workspace .apple-empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  place-items: center;
  color: var(--apple-tertiary);
  background: #f1f1f3;
  border-radius: 18px;
  font-size: 24px;
}
.apple-import-workspace .apple-empty-state strong { color: var(--apple-ink); font-size: 16px; }

@media (max-width: 1200px) {
  .operations-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .apple-workspace { padding: 28px 24px 56px; }
  .apple-workspace .apple-card-grid { grid-template-columns: 1fr; }
  .apple-workspace .apple-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 0; }
  .apple-workspace .apple-stepper .apple-step:nth-child(2)::after { display: none; }
  .apple-master-workspace .apple-import-grid { grid-template-columns: 1fr; }
  .apple-import-workspace .apple-flow-section { grid-template-columns: 210px minmax(0, 1fr); gap: 24px; }
  .apple-import-workspace .apple-simple-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .apple-workspace {
    min-height: auto;
    margin: -16px -16px -40px;
    padding: 22px 16px 42px;
  }
  .apple-workspace .apple-hero { align-items: flex-start; flex-direction: column; gap: 16px; }
  .apple-workspace .apple-hero h1,
  .apple-workspace .apple-hero h2 { font-size: 28px; }
  .apple-workspace .apple-hero-actions { width: 100%; }
  .apple-workspace .apple-hero-actions .btn { flex: 1; }
  .apple-workspace .apple-card { border-radius: 16px; }
  .apple-workspace .apple-card-header { align-items: flex-start; flex-direction: column; padding: 18px; }
  .apple-workspace .apple-card-body { padding: 18px; }
  .apple-workspace .apple-card-footer { align-items: stretch; flex-direction: column; padding: 14px 18px; }
  .apple-workspace .apple-card-footer .btn { width: 100%; }
  .apple-workspace .apple-segmented-tabs { justify-content: flex-start; }
  .apple-workspace .apple-segment,
  .apple-workspace .apple-segmented-tabs .nav-link { flex: 0 0 auto; }
  .apple-workspace .apple-stepper { grid-template-columns: 1fr; gap: 14px; }
  .apple-workspace .apple-step { padding-right: 0; }
  .apple-workspace .apple-step::after { display: none; }
  .apple-workspace .apple-step strong,
  .apple-workspace .apple-step small { white-space: normal; }
  .apple-workspace .apple-dropzone { min-height: 168px; padding: 22px 16px; }
  .apple-workspace .apple-sticky-action { align-items: stretch; flex-direction: column; bottom: 8px; }
  .apple-workspace .apple-sticky-buttons { width: 100%; }
  .apple-workspace .apple-sticky-buttons .btn { flex: 1; }
  .apple-master-workspace .apple-hero { grid-template-columns: 1fr; }
  .apple-master-workspace .apple-hero-actions { margin-top: 4px; }
  .apple-master-workspace .apple-library-stats { width: 100%; }
  .apple-master-workspace .apple-stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    display: grid;
  }
  .apple-master-workspace .apple-stat-pill { min-width: 0; }
  .apple-master-workspace .apple-inline-action,
  .apple-import-workspace .apple-submit-row { align-items: stretch; flex-direction: column; }
  .apple-master-workspace .apple-inline-action .btn,
  .apple-import-workspace .apple-submit-row .btn { width: 100%; }
  .apple-master-workspace .apple-segmented-shell { padding: 0 14px 14px; }
  .apple-master-workspace .apple-filter-form { grid-template-columns: 1fr; }
  .apple-master-workspace .content-card-header { align-items: flex-start; flex-direction: column; }
  .apple-import-workspace .apple-steps { grid-template-columns: 1fr; gap: 14px; }
  .apple-import-workspace .apple-steps .apple-step { padding-right: 0; }
  .apple-import-workspace .apple-flow-section { grid-template-columns: 1fr; gap: 18px; padding: 22px 18px; }
  .apple-import-workspace .apple-form-grid { grid-template-columns: 1fr; }
  .apple-import-workspace .apple-simple-fields { grid-template-columns: 1fr; padding: 20px 18px 16px; }
  .apple-import-workspace .apple-simple-upload { padding: 18px; }
  .apple-import-workspace .apple-form-alert { margin: 18px 18px 0; }
}

@media (max-width: 900px) {
  .apple-workspace { margin: -16px -16px -40px; }
  .app-sidebar { position: static; width: 100%; }
  .app-shell { display: block; }
  .sidebar-nav { display: grid; grid-template-columns: repeat(2, 1fr); }
  .nav-disclosure { grid-column: 1 / -1; }
  .nav-section-label, .sidebar-footer { display: none; }
  .app-main { margin-left: 0; }
  .app-header { padding: 13px 16px; }
  .app-content { padding: 16px; }
  .guide-hero { align-items: flex-start; flex-direction: column; }
  .guide-jump { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guide-jump a:nth-child(3n) { border-right: 0; }
  .guide-jump a:nth-child(-n + 6) { border-bottom: 1px solid var(--line); }
  .guide-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-section-heading { display: block; }
  .guide-section-heading p { margin: 10px 0 0 50px; text-align: left; }
  .guide-chain { grid-template-columns: 1fr; }
  .guide-chain-arrow { transform: rotate(90deg); justify-self: center; }
  .guide-resolution-flow { grid-template-columns: 1fr; }
  .guide-resolution-flow > i { transform: rotate(90deg); justify-self: center; }
  .guide-formulas { grid-template-columns: 1fr; }
  .process-strip { grid-template-columns: 1fr 1fr; }
  .weekly-review-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-strip > i { display: none; }
}

@media (max-width: 560px) {
  .operations-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .operations-flow { grid-template-columns: 1fr; }
  .operations-step { min-height: 170px; }
  .process-strip { grid-template-columns: 1fr; }
  .guide-hero, .guide-section { padding: 18px; }
  .guide-hero-actions { width: 100%; flex-direction: column; }
  .guide-hero-actions .btn { width: 100%; }
  .guide-flow { grid-template-columns: 1fr; }
  .guide-section-heading p { margin-left: 0; }
  .guide-formulas > div { align-items: flex-start; flex-direction: column; }
  .guide-formulas code { text-align: left; }
  .weekly-review-strip { grid-template-columns: 1fr; }
}

.monthly-kpi-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(126px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.monthly-summary-card {
  min-width: 126px;
  min-height: 74px;
  padding: 11px 12px;
}
.monthly-summary-card small {
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.monthly-summary-card strong {
  overflow: hidden;
  margin-top: 6px;
  font-size: clamp(15px, 1.05vw, 18px);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analysis-scope-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
}
.analysis-scope-note > i { color: #2563eb; font-size: 16px; }
.metric-card-calculated {
  background: linear-gradient(145deg, #ffffff, #f5f3ff);
  border-color: #ddd6fe;
}
.metric-card-calculated strong { color: #5b21b6; }
.estimate-marker {
  margin-left: 2px;
  color: #dc2626;
  font-weight: 900;
}
.analysis-result-card { overflow: hidden; }
.analysis-result-header {
  align-items: center;
  gap: 18px;
}
.analysis-result-header-compact { padding-top: 13px; padding-bottom: 13px; }
.analysis-result-header-compact h2 { margin-bottom: 0; }
.analysis-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}
.analysis-legend span {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.legend-sales { color: #1d4ed8; background: #dbeafe; }
.legend-income { color: #047857; background: #d1fae5; }
.legend-cost { color: #c2410c; background: #ffedd5; }
.legend-profit { color: #0369a1; background: #e0f2fe; }
.legend-ratio { color: #6d28d9; background: #ede9fe; }
.analysis-table-wrap {
  max-height: min(70vh, 760px);
  overflow: scroll;
  scrollbar-color: #94a3b8 #e2e8f0;
  scrollbar-width: auto;
  scrollbar-gutter: stable;
}
.analysis-table-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
.analysis-table-wrap::-webkit-scrollbar-track { background: #e2e8f0; }
.analysis-table-wrap::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border: 2px solid #e2e8f0;
  border-radius: 999px;
}
.analysis-scrollbar {
  padding: 8px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #dbe3ee;
}
.analysis-scrollbar[hidden] { display: none; }
.analysis-scrollbar-track {
  position: relative;
  height: 16px;
  overflow: hidden;
  background: #dbe3ee;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgb(15 23 42 / 12%);
  cursor: pointer;
  touch-action: none;
}
.analysis-scrollbar-track:focus-visible {
  outline: 3px solid rgb(37 99 235 / 24%);
  outline-offset: 2px;
}
.analysis-scrollbar-thumb {
  position: absolute;
  top: 2px;
  left: 0;
  height: 10px;
  min-width: 52px;
  background: #64748b;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 25%);
  cursor: grab;
  will-change: transform, width;
}
.analysis-scrollbar-thumb:hover { background: #475569; }
.analysis-scrollbar-thumb.is-dragging {
  background: #2563eb;
  cursor: grabbing;
}
.analysis-notes-stack { display: grid; gap: 10px; }
.analysis-notes-stack .alert { padding: 12px 14px; font-size: 13px; }
.analysis-formula-notes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.analysis-formula-notes span {
  padding: 10px 12px;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.45;
}
.analysis-formula-notes strong { display: block; margin-bottom: 2px; color: #334155; }
.sortable-analysis-table {
  min-width: 1900px;
  font-variant-numeric: tabular-nums;
}
.sortable-analysis-table thead th {
  padding: 0;
  vertical-align: middle;
}
.analysis-group-row th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 36px;
  background: #f8fafc;
}
.analysis-group {
  padding: 5px 8px 0 !important;
  text-align: left;
}
.analysis-group span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  color: #fff;
  border-radius: 5px 5px 0 0;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .02em;
}
.analysis-group small {
  margin-left: 8px;
  color: #64748b;
  font-size: 11px;
  font-weight: 650;
}
.analysis-group-sales { border-bottom: 2px solid #3b82f6 !important; }
.analysis-group-sales span { background: #2563eb; }
.analysis-group-income { border-bottom: 2px solid #10b981 !important; }
.analysis-group-income span { background: #059669; }
.analysis-group-cost { border-bottom: 2px solid #f97316 !important; }
.analysis-group-cost span { background: #ea580c; }
.analysis-group-profit { border-bottom: 2px solid #0ea5e9 !important; }
.analysis-group-profit span { background: #0284c7; }
.analysis-group-ratio { border-bottom: 2px solid #8b5cf6 !important; }
.analysis-group-ratio span { background: #7c3aed; }
.analysis-dimension-header {
  position: sticky !important;
  top: 0;
  left: 0;
  z-index: 9 !important;
  min-width: 230px;
  padding: 0 16px !important;
  color: #334155;
  background: #f8fafc !important;
  border-right: 1px solid #cbd5e1 !important;
  text-align: left;
}
.analysis-column-row th {
  position: sticky;
  top: 36px;
  z-index: 4;
  min-width: 116px;
  background: #fff;
  box-shadow: inset 0 -1px 0 #cbd5e1;
}
.analysis-column-row .column-sales { background: #f8fbff; }
.analysis-column-row .column-income { background: #f7fdfb; }
.analysis-column-row .column-cost { background: #fffaf6; }
.analysis-column-row .column-profit { background: #f7fcff; }
.analysis-column-row .column-ratio { background: #faf8ff; }
.analysis-column-row th:nth-child(5),
.analysis-column-row th:nth-child(14),
.analysis-column-row th:nth-child(15),
.sortable-analysis-table tbody td:nth-child(6),
.sortable-analysis-table tbody td:nth-child(15),
.sortable-analysis-table tbody td:nth-child(16) {
  border-left: 2px solid #dbe3ee;
}
.table-sort-button {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 11px 12px;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.table-sort-button i {
  color: #8e8e93;
  font-size: 12px;
}
.table-sort-button .metric-help {
  display: inline-flex;
  color: #64748b;
  cursor: help;
}
.table-sort-button .metric-help i { font-size: 13px; }
.table-sort-button:hover {
  color: #0a58ca;
  background: rgba(13, 110, 253, .045);
}
.table-sort-button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid rgba(13, 110, 253, .55);
  outline-offset: -3px;
}
.sortable-analysis-table th[aria-sort="ascending"] .table-sort-button,
.sortable-analysis-table th[aria-sort="descending"] .table-sort-button {
  color: #0a58ca;
  background: rgba(13, 110, 253, .065);
}
.sortable-analysis-table th[aria-sort="ascending"] .table-sort-button i,
.sortable-analysis-table th[aria-sort="descending"] .table-sort-button i {
  color: #0a58ca;
}
.sortable-analysis-table tbody td {
  min-width: 116px;
  white-space: nowrap;
  text-align: right;
}
.sortable-analysis-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 230px;
  max-width: 270px;
  color: #0f172a;
  background: #fff;
  border-right: 1px solid #cbd5e1;
  text-align: left;
}
.sortable-analysis-table tbody tr:hover td { background: #f8fafc; }
.sortable-analysis-table tbody tr:hover td:first-child { background: #f8fafc; }
.analysis-product-name {
  margin-top: 2px;
  color: #334155;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  white-space: normal;
}
.analysis-emphasis { color: #0f172a; font-weight: 700; }
.analysis-data-missing {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}
.analysis-basis-badge {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.4;
  vertical-align: 1px;
}
.basis-settlement { color: #047857; background: #d1fae5; }
.basis-partial { color: #9a3412; background: #ffedd5; }
.basis-estimate { color: #92400e; background: #fef3c7; }
.basis-none { color: #64748b; background: #e2e8f0; }
.analysis-profit-value { color: #0369a1; font-weight: 800; }
.analysis-final-metric {
  color: #5b21b6;
  background: #faf8ff !important;
}
.metric-final { color: #5b21b6; }
.dimension-primary,
.dimension-secondary {
  display: block;
}
.dimension-primary {
  max-width: 260px;
  color: #1d1d1f;
  line-height: 1.35;
}
.dimension-secondary {
  margin-top: 4px;
  color: #6e6e73;
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 1200px) {
  .analysis-result-header { align-items: flex-start; flex-direction: column; }
  .analysis-legend { justify-content: flex-start; }
}

@media (max-width: 768px) {
  .monthly-kpi-grid { grid-template-columns: repeat(9, minmax(126px, 1fr)); }
  .analysis-formula-notes { grid-template-columns: 1fr; }
}

@media print {
  .app-sidebar, .app-header, .btn, form { display: none !important; }
  .app-main { margin: 0; }
  .app-content { padding: 0; }
  .content-card, .metric-card { box-shadow: none; }
  .guide-hero { color: #0f172a; background: #fff; border: 1px solid var(--line); box-shadow: none; }
  .guide-hero p { color: #475569; }
  .guide-jump { display: none; }
  .guide-section { break-inside: avoid; box-shadow: none; }
}
/* Independent master-data management pages */
.settings-workspace {
    display: grid;
    gap: 24px;
    max-width: 1500px;
    margin: 0 auto;
}

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

.settings-hero-note {
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(390px, 100%);
    padding: 14px 16px;
    color: #334155;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 16px;
}

.settings-hero-note > i { color: #2563eb; font-size: 1.35rem; }
.settings-hero-note div { display: grid; gap: 2px; }
.settings-hero-note span { color: #64748b; font-size: .82rem; }

.settings-group { display: grid; gap: 12px; }
.settings-group-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.settings-group-heading h2 { margin: 0; color: #475569; font-size: .92rem; font-weight: 700; letter-spacing: .06em; }
.settings-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.settings-nav-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 118px;
    padding: 20px;
    color: inherit;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .045);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.settings-nav-card:hover {
    color: inherit;
    border-color: #93c5fd;
    box-shadow: 0 12px 32px rgba(37, 99, 235, .09);
    transform: translateY(-2px);
}

.settings-card-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    color: #2563eb;
    background: #eff6ff;
    border-radius: 14px;
    font-size: 1.2rem;
}

.settings-card-copy { display: grid; gap: 6px; min-width: 0; }
.settings-card-copy strong { color: #0f172a; font-size: 1rem; }
.settings-card-copy small { color: #64748b; line-height: 1.55; }
.settings-card-meta { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 10px; text-align: right; }
.settings-card-meta b { color: #0f172a; font-size: 1.35rem; }
.settings-card-meta small { grid-column: 1; color: #94a3b8; white-space: nowrap; }
.settings-card-meta i { grid-column: 2; grid-row: 1 / span 2; color: #94a3b8; }

.settings-legacy-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
}

.settings-legacy-note > div { display: flex; align-items: center; gap: 12px; }
.settings-legacy-note > div > i { color: #2563eb; font-size: 1.35rem; }
.settings-legacy-note span { display: grid; gap: 2px; }
.settings-legacy-note small { color: #64748b; }

.settings-breadcrumb { display: flex; align-items: center; gap: 12px; color: #94a3b8; font-size: .88rem; }
.settings-breadcrumb a { color: #475569; text-decoration: none; }
.settings-breadcrumb a:hover { color: #2563eb; }

.settings-list-card {
    overflow: hidden;
    border: 1px solid #dce5f0;
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .06);
}
.settings-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    border-bottom: 1px solid #e2e8f0;
}
.settings-title-block { display: flex; align-items: center; gap: 14px; min-width: 0; }
.settings-title-block h2, .settings-editor-heading h2 { margin: 0 0 4px; color: #0f172a; font-size: 1.22rem; }
.settings-title-block p, .settings-editor-heading p { margin: 0; color: #64748b; }
.settings-header-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.settings-refresh-panel {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 24px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
}
.settings-refresh-panel > div { display: grid; gap: 3px; }
.settings-refresh-panel span { color: #64748b; font-size: .86rem; }

.settings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    background: #fbfdff;
    border-bottom: 1px solid #e2e8f0;
}
.settings-search-form { display: flex; align-items: center; gap: 8px; width: min(850px, 100%); }
.settings-listing-filter-form { width: min(1240px, 100%); }
.settings-search-form > i { color: #94a3b8; }
.settings-search-form .btn { white-space: nowrap; }
.settings-result-count { color: #64748b; font-size: .86rem; white-space: nowrap; }
.settings-page-size { display: flex; align-items: center; gap: 7px; margin: 0; color: #64748b; font-size: .84rem; white-space: nowrap; }
.settings-page-size .form-select { width: 102px; min-height: 38px; padding-top: .375rem; padding-bottom: .375rem; }

.settings-owner-toolbar { display: block; }
.settings-owner-filter-form {
    display: grid;
    gap: 12px;
    width: 100%;
}
.settings-owner-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.settings-owner-filter-grid > i { display: none; }
.settings-owner-filter-grid .settings-filter-select,
.settings-owner-filter-grid > .searchable-select,
.settings-owner-filter-grid input[type="search"] {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: none;
}
.settings-owner-filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}
.settings-owner-filter-actions .settings-result-count { margin-right: auto; }

.settings-listing-toolbar { display: block; }
.settings-listing-toolbar .settings-listing-filter-form {
    display: grid;
    gap: 12px;
    width: 100%;
}
.settings-listing-filter-grid {
    display: grid;
    grid-template-columns: minmax(180px, .75fr) minmax(240px, 1fr) minmax(360px, 2fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.settings-listing-filter-grid > i { display: none; }
.settings-listing-filter-grid .settings-filter-select,
.settings-listing-filter-grid > .searchable-select,
.settings-listing-filter-grid input[type="search"] {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: none;
}
.settings-listing-filter-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}
.settings-listing-filter-actions .settings-result-count { margin-right: auto; }

.settings-table th { padding: 13px 18px; color: #64748b; background: #f5f8fc; font-size: .76rem; font-weight: 750; letter-spacing: .03em; white-space: nowrap; }
.settings-table td { padding: 13px 18px; color: #334155; vertical-align: middle; border-color: #edf2f7; }
.settings-table tbody tr { transition: background-color .15s ease; }
.settings-table tbody tr:hover { background: #f8fbff; }
.settings-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 190px; }
.settings-row-actions form { margin: 0; }
.settings-empty-state { height: 220px; text-align: center; color: #94a3b8 !important; }
.settings-empty-state i, .settings-empty-state strong, .settings-empty-state span { display: block; margin: 5px auto; }
.settings-empty-state i { font-size: 1.8rem; }
.settings-empty-state strong { color: #475569; }
.settings-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 16px 24px; color: #64748b; background: #fbfdff; border-top: 1px solid #e2e8f0; }
.settings-pagination > :last-child { justify-self: end; }
.settings-page-numbers { display: flex; align-items: center; justify-content: center; gap: 4px; }
.settings-page-numbers a, .settings-page-numbers span { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; color: #64748b; text-decoration: none; border-radius: 10px; }
.settings-page-numbers a:hover { color: #1d4ed8; background: #eff6ff; }
.settings-page-numbers .active { color: #fff; background: #2563eb; box-shadow: 0 5px 14px rgba(37, 99, 235, .22); }

.product-identity { display: flex; align-items: center; gap: 12px; min-width: 235px; }
.product-identity > div { display: grid; gap: 3px; min-width: 0; }
.product-identity strong { color: #0f172a; font-size: .93rem; overflow-wrap: anywhere; }
.product-identity small { color: #94a3b8; font-size: .72rem; }
.product-thumb { width: 52px; height: 52px; flex: 0 0 52px; object-fit: cover; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 13px; }
.product-thumb-empty { display: inline-grid; place-items: center; color: #94a3b8; font-size: 1.1rem; }
.product-name { color: #334155; font-weight: 650; }
.status-muted { color: #64748b; background: #e2e8f0; }
.product-image-preview { display: inline-grid; gap: 7px; margin-bottom: 14px; color: #64748b; font-size: .8rem; }
.product-image-preview img { width: 132px; height: 132px; object-fit: cover; background: #f8fafc; border: 1px solid #dbe3ec; border-radius: 18px; box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }

.product-detail-workspace { max-width: 1440px; }
.product-detail-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 24px; }
.product-detail-image { width: 112px; height: 112px; object-fit: cover; background: #f8fafc; border: 1px solid #dbe3ec; border-radius: 22px; }
.product-detail-image-empty { display: inline-grid; place-items: center; color: #94a3b8; font-size: 1.8rem; }
.product-detail-title { min-width: 0; }
.product-detail-title h2 { margin: 10px 0 4px; color: #0f172a; font-size: 1.65rem; overflow-wrap: anywhere; }
.product-detail-title p { margin: 0; color: #64748b; font-size: 1rem; }
.product-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.product-detail-card { overflow: hidden; }
.product-detail-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.product-detail-card-heading h2 { margin: 0 0 4px; color: #0f172a; font-size: 1.15rem; }
.product-detail-card-heading p { margin: 0; color: #64748b; font-size: .86rem; }
.product-detail-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.product-detail-meta-grid > div { min-width: 0; padding: 18px 22px; border-right: 1px solid #edf2f7; border-bottom: 1px solid #edf2f7; }
.product-detail-meta-grid dt, .product-source-field-grid dt { margin-bottom: 6px; color: #64748b; font-size: .76rem; font-weight: 700; }
.product-detail-meta-grid dd, .product-source-field-grid dd { margin: 0; color: #0f172a; font-size: .92rem; overflow-wrap: anywhere; }
.product-source-sheet { border-bottom: 1px solid #e2e8f0; }
.product-source-sheet:last-child { border-bottom: 0; }
.product-source-sheet > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; color: #1e3a8a; background: #f8fbff; cursor: pointer; font-weight: 750; list-style: none; }
.product-source-sheet > summary::-webkit-details-marker { display: none; }
.product-source-sheet > summary span { display: flex; align-items: center; gap: 9px; }
.product-source-sheet > summary small { color: #64748b; font-weight: 600; }
.product-source-sheet-body { display: grid; gap: 16px; padding: 18px 24px 24px; }
.product-source-row { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 16px; }
.product-source-row-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 15px; color: #334155; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.product-source-row-heading span { color: #64748b; font-size: .78rem; }
.product-source-field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.product-source-field-grid > div { min-width: 0; padding: 14px 16px; border-right: 1px solid #edf2f7; border-bottom: 1px solid #edf2f7; }
.product-source-field-grid small { display: block; margin-top: 7px; color: #64748b; font-size: .72rem; overflow-wrap: anywhere; }
.product-detail-empty { display: grid; justify-items: center; gap: 6px; padding: 52px 24px; color: #94a3b8; text-align: center; }
.product-detail-empty i { font-size: 1.8rem; }
.product-detail-empty strong { color: #475569; }

@media (max-width: 980px) {
    .product-detail-meta-grid, .product-source-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .product-detail-hero { grid-template-columns: auto minmax(0, 1fr); }
    .product-detail-actions { grid-column: 1 / -1; justify-content: stretch; }
    .product-detail-actions .btn { flex: 1; }
    .product-detail-meta-grid, .product-source-field-grid { grid-template-columns: 1fr; }
    .product-detail-card-heading { align-items: flex-start; flex-direction: column; }
}

.image-import-workspace { max-width: 1380px; }
.image-import-card { padding: 30px; }
.image-import-heading { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid #e2e8f0; }
.image-import-heading h2, .image-import-section-title h2, .image-import-result-header h2 { margin: 0 0 5px; color: #0f172a; font-size: 1.2rem; }
.image-import-heading p, .image-import-result-header p { max-width: 850px; margin: 0; color: #64748b; line-height: 1.6; }
.image-import-form { display: grid; gap: 12px; padding-top: 24px; }
.image-import-form input[type="file"] { min-height: 70px; padding: 19px; background: #f8fafc; border-style: dashed; }
.image-import-form input[type="file"]::file-selector-button { margin: -9px 16px -9px -9px; padding: 10px 16px; color: #1d4ed8; background: #eaf2ff; border: 0; border-radius: 10px; font-weight: 700; }
.image-import-form > .btn { justify-self: start; min-width: 180px; margin-top: 5px; }
.image-import-rules { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 6px 0; color: #475569; font-size: .88rem; }
.image-import-rules i { margin-right: 5px; color: #059669; }
.image-import-history { overflow: hidden; }
.image-import-section-title { display: flex; align-items: baseline; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.image-import-section-title span { color: #64748b; font-size: .84rem; }
.image-import-history th, .image-import-table th { padding: 12px 18px; color: #64748b; background: #f5f8fc; font-size: .76rem; white-space: nowrap; }
.image-import-history td, .image-import-table td { padding: 13px 18px; vertical-align: middle; border-color: #edf2f7; }
.image-import-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.image-import-stat { display: grid; gap: 5px; padding: 22px; }
.image-import-stat span { color: #64748b; font-size: .85rem; }
.image-import-stat strong { color: #0f172a; font-size: 2rem; line-height: 1; }
.image-import-stat small { color: #94a3b8; }
.image-import-stat.success strong { color: #047857; }
.image-import-stat.warning strong { color: #b45309; }
.image-import-result-card { overflow: hidden; }
.image-import-result-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid #e2e8f0; }
.image-import-apply-form { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.image-import-apply-form label { color: #475569; font-size: .88rem; white-space: nowrap; }
.image-import-apply-form input { margin-right: 5px; }
.image-import-applied-note { display: flex; gap: 10px; padding: 14px 24px; color: #065f46; background: #ecfdf5; border-bottom: 1px solid #a7f3d0; }
.image-import-applied-note span { color: #047857; }
.image-import-table-wrap { max-height: 640px; }
.image-import-table thead { position: sticky; top: 0; z-index: 1; }
.image-import-table small { display: block; margin-top: 3px; color: #64748b; }

.settings-form-workspace { max-width: 980px; }
.settings-editor-card { padding: 28px; }
.settings-editor-heading { display: flex; align-items: center; gap: 14px; padding-bottom: 22px; border-bottom: 1px solid #e2e8f0; }
.settings-editor-form { padding-top: 24px; }
.settings-editor-form input[type="file"] { min-height: 58px; padding: 14px; background: #f8fafc; border-style: dashed; }
.settings-editor-form input[type="file"]::file-selector-button { margin: -7px 14px -7px -7px; padding: 9px 14px; color: #1d4ed8; background: #eff6ff; border: 0; border-radius: 9px; font-weight: 650; }
.settings-editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2e8f0; }
.settings-delete-card { padding: 44px; text-align: center; }
.settings-danger-icon { display: inline-grid; place-items: center; width: 58px; height: 58px; margin-bottom: 16px; color: #dc2626; background: #fef2f2; border-radius: 18px; font-size: 1.5rem; }
.settings-delete-card h2 { color: #0f172a; font-size: 1.35rem; }
.settings-record-name { margin: 10px 0 22px; color: #475569; font-weight: 600; }

@media (max-width: 900px) {
    .settings-card-grid { grid-template-columns: 1fr; }
    .settings-hero, .settings-list-header, .settings-refresh-panel, .settings-toolbar { align-items: stretch; flex-direction: column; }
    .settings-header-actions { justify-content: flex-start; }
    .settings-search-form { width: 100%; }
    .settings-search-form { flex-wrap: wrap; }
    .settings-search-form input[type="search"] { min-width: 240px; flex: 1 1 100%; }
    .settings-pagination { grid-template-columns: 1fr 1fr; }
    .settings-page-numbers { grid-column: 1 / -1; grid-row: 1; }
    .image-import-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .image-import-result-header, .image-import-applied-note { align-items: stretch; flex-direction: column; }
    .image-import-apply-form { align-items: stretch; flex-direction: column; }
}

@media (max-width: 1200px) {
    .settings-listing-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-listing-filter-grid input[type="search"] { grid-column: 1 / -1; }
    .settings-owner-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-owner-filter-grid input[type="search"] { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    .settings-listing-filter-grid { grid-template-columns: 1fr; }
    .settings-listing-filter-grid input[type="search"] { grid-column: auto; }
    .settings-listing-filter-actions { align-items: stretch; flex-direction: column; }
    .settings-listing-filter-actions .settings-result-count { margin-right: 0; }
    .settings-listing-filter-actions .settings-page-size { justify-content: space-between; }
    .settings-listing-filter-actions .btn { width: 100%; }
    .settings-owner-filter-grid { grid-template-columns: 1fr; }
    .settings-owner-filter-grid input[type="search"] { grid-column: auto; }
    .settings-owner-filter-actions { align-items: stretch; flex-direction: column; }
    .settings-owner-filter-actions .settings-result-count { margin-right: 0; }
    .settings-owner-filter-actions .settings-page-size { justify-content: space-between; }
    .settings-owner-filter-actions .btn { width: 100%; }
}

@media (max-width: 620px) {
    .settings-nav-card { grid-template-columns: auto minmax(0, 1fr); }
    .settings-card-meta { grid-column: 2; justify-self: start; text-align: left; }
    .settings-legacy-note { align-items: stretch; flex-direction: column; }
}

/* Monthly exchange-rate workspace */
.rate-workspace {
    display: grid;
    gap: 18px;
    max-width: 1540px;
    margin: 0 auto;
}

.rate-intro-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 25px 28px;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 62%, #eef5ff 100%);
}
.rate-intro-card h2 { margin: 3px 0 7px; color: #0f172a; font-size: 1.35rem; }
.rate-intro-card p { margin: 0; color: #64748b; }
.rate-eyebrow { color: #2563eb; font-size: .72rem; font-weight: 800; letter-spacing: .14em; }

.rate-refresh-card {
    display: grid;
    grid-template-columns: auto minmax(300px, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-color: #bfdbfe;
    box-shadow: 0 10px 28px rgba(37, 99, 235, .06);
}
.rate-refresh-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #1d4ed8;
    background: #dbeafe;
    border-radius: 14px;
    font-size: 1.2rem;
}
.rate-refresh-copy { display: grid; gap: 3px; }
.rate-refresh-copy strong { color: #0f172a; }
.rate-refresh-copy span { color: #64748b; font-size: .86rem; }
.rate-refresh-form { display: flex; align-items: end; gap: 10px; }
.rate-refresh-form > div { display: grid; gap: 5px; }
.rate-refresh-form label, .rate-filter-field label { color: #64748b; font-size: .74rem; font-weight: 700; }
.rate-refresh-form .form-control { min-width: 174px; }
.rate-extra-picker { position: relative; align-self: end; }
.rate-extra-picker > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 12px;
    color: #1d4ed8;
    background: #fff;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    cursor: pointer;
    font-size: .84rem;
    font-weight: 700;
    list-style: none;
    white-space: nowrap;
}
.rate-extra-picker > summary::-webkit-details-marker { display: none; }
.rate-extra-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    width: 390px;
    padding: 15px;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .16);
}
.rate-extra-menu > strong, .rate-extra-menu > small { display: block; }
.rate-extra-menu > strong { color: #0f172a; font-size: .88rem; }
.rate-extra-menu > small { margin: 3px 0 11px; color: #64748b; line-height: 1.45; }
.rate-extra-menu > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; }
.rate-extra-menu > div > div label { display: flex; align-items: center; gap: 7px; color: #334155; font-size: .8rem; cursor: pointer; }
.rate-extra-menu input { accent-color: #2563eb; }

.rate-source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rate-source-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    min-height: 92px;
    padding: 17px 18px;
    color: inherit;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 7px 24px rgba(15, 23, 42, .045);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.rate-source-card:hover, .rate-source-card.active { color: inherit; border-color: #93c5fd; box-shadow: 0 10px 28px rgba(37, 99, 235, .1); transform: translateY(-1px); }
.rate-source-card.active { box-shadow: inset 0 0 0 1px #60a5fa, 0 10px 28px rgba(37, 99, 235, .1); }
.rate-source-card-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; font-size: 1.05rem; }
.rate-source-card > span:nth-child(2) { display: grid; gap: 4px; }
.rate-source-card strong { color: #0f172a; }
.rate-source-card small { color: #64748b; }
.rate-source-card > b { color: #0f172a; font-size: 1.45rem; }
.rate-source-card.rate-source-china .rate-source-card-icon { color: #047857; background: #ecfdf5; }
.rate-source-card.rate-source-europe .rate-source-card-icon { color: #1d4ed8; background: #eff6ff; }
.rate-source-card.rate-source-manual .rate-source-card-icon { color: #9a3412; background: #fff7ed; }

.rate-list-card { overflow: hidden; }
.rate-filter-bar {
    display: flex;
    align-items: end;
    gap: 10px;
    padding: 17px 20px;
    background: #fbfdff;
    border-bottom: 1px solid #e2e8f0;
}
.rate-filter-field { display: grid; gap: 5px; min-width: 170px; }
.rate-filter-search { width: min(280px, 100%); }
.rate-result-count { margin-left: auto; padding-bottom: 9px; color: #64748b; font-size: .85rem; white-space: nowrap; }

.rate-table th { padding: 12px 16px; color: #64748b; background: #f8fafc; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.rate-table td { padding: 15px 16px; color: #334155; vertical-align: middle; border-color: #edf2f7; }
.rate-table tbody tr:hover { background: #fbfdff; }
.rate-currency-code { display: inline-grid; place-items: center; min-width: 52px; padding: 7px 10px; color: #0f172a; background: #f1f5f9; border-radius: 9px; font-weight: 800; letter-spacing: .04em; }
.rate-number { display: block; color: #0f172a; font-size: 1.08rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rate-number + small { color: #94a3b8; font-size: .7rem; }
.rate-source-badge { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; font-size: .75rem; font-weight: 750; white-space: nowrap; }
.rate-source-badge.rate-source-china { color: #047857; background: #ecfdf5; }
.rate-source-badge.rate-source-europe { color: #1d4ed8; background: #eff6ff; }
.rate-source-badge.rate-source-manual { color: #9a3412; background: #fff7ed; }
.rate-method { display: block; color: #475569; font-size: .82rem; font-weight: 650; white-space: nowrap; }
.rate-details { margin-top: 4px; max-width: 390px; color: #64748b; font-size: .75rem; }
.rate-details summary { color: #2563eb; cursor: pointer; list-style-position: inside; }
.rate-details p { margin: 7px 0 0; padding: 8px 10px; line-height: 1.5; word-break: break-word; background: #f8fafc; border-radius: 8px; }
.rate-updated { color: #64748b; font-size: .8rem; white-space: nowrap; }
.rate-lock { display: block; margin-top: 4px; color: #94a3b8; font-size: .7rem; font-weight: 500; }
.rate-actions { min-width: 140px; text-align: right; white-space: nowrap; }
.rate-empty { height: 220px; color: #94a3b8 !important; text-align: center; }
.rate-empty i, .rate-empty strong, .rate-empty span { display: block; margin: 5px auto; }
.rate-empty i { font-size: 1.8rem; }
.rate-empty strong { color: #475569; }

@media (max-width: 1100px) {
    .rate-source-grid { grid-template-columns: 1fr; }
    .rate-refresh-card { grid-template-columns: auto 1fr; }
    .rate-refresh-form { grid-column: 1 / -1; padding-left: 60px; }
}

@media (max-width: 760px) {
    .rate-intro-card, .rate-filter-bar { align-items: stretch; flex-direction: column; }
    .rate-refresh-card { grid-template-columns: 1fr; }
    .rate-refresh-icon { display: none; }
    .rate-refresh-form { grid-column: auto; padding-left: 0; }
    .rate-refresh-form, .rate-filter-bar { align-items: stretch; flex-direction: column; }
    .rate-extra-picker { align-self: stretch; }
    .rate-extra-picker > summary { justify-content: center; }
    .rate-extra-menu { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
    .rate-filter-field, .rate-filter-search { width: 100%; }
    .rate-result-count { margin-left: 0; padding: 0; }
}

/* Global searchable single-select */
.content-card.searchable-select-overflow { overflow: visible; }
.searchable-select { position: relative; width: 100%; }
.searchable-native-select {
    position: absolute !important;
    left: 0;
    bottom: 0;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}
.searchable-select-input {
    padding-right: 38px;
    background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.searchable-select.open .searchable-select-input { border-color: #86b7fe; box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .15); }
.searchable-select-menu {
    display: none;
    position: absolute;
    z-index: 1080;
    top: calc(100% + 5px);
    left: 0;
    width: max(100%, 230px);
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .16);
}
.searchable-select.open .searchable-select-menu { display: grid; gap: 2px; }
.searchable-select-option {
    width: 100%;
    padding: 9px 10px;
    color: #1e293b;
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    text-align: left;
}
.searchable-select-option:hover, .searchable-select-option:focus { background: #eff6ff; outline: 0; }
.searchable-select-option.selected { color: #1d4ed8; background: #eff6ff; font-weight: 700; }
.searchable-select-empty { padding: 14px 10px; color: #94a3b8; text-align: center; }

/* Unified order ledger */
.order-ledger-filter { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 14px; align-items: end; }
.order-ledger-filter .form-label { margin-bottom: 5px; color: #475569; font-size: .8rem; font-weight: 750; }
.order-filter-search { grid-column: span 2; }
.order-filter-actions { display: flex; gap: 8px; align-items: center; }
.order-ledger-table th { color: #475569; background: #f8fafc; font-size: .78rem; white-space: nowrap; }
.order-ledger-table td { min-width: 110px; vertical-align: middle; }
.order-ledger-table td:nth-child(3), .order-ledger-table td:nth-child(4) { min-width: 210px; }
.order-ledger-table td strong, .order-ledger-table td small { display: block; }
.order-ledger-table td small { margin-top: 4px; color: #64748b; font-size: .75rem; }

@media (max-width: 1100px) {
    .order-ledger-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .order-ledger-filter { grid-template-columns: 1fr; }
    .order-filter-search { grid-column: auto; }
}

/* Operating overview dashboard */
.home-filter-card { overflow: visible; }
.home-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.home-filter-grid .form-label { margin-bottom: 5px; color: #475569; font-size: .78rem; font-weight: 750; }
.home-filter-action .btn { white-space: nowrap; }
.home-data-period {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 10px 16px;
  color: #475569;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  font-size: .78rem;
}
.home-data-period span { margin-left: auto; color: #94a3b8; }
.home-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.home-kpi {
  min-width: 0;
  padding: 17px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(15, 23, 42, .035);
}
.home-kpi span, .home-kpi strong, .home-kpi small { display: block; }
.home-kpi span { color: #64748b; font-size: .75rem; font-weight: 750; }
.home-kpi strong { margin: 7px 0 4px; color: #0f172a; font-size: clamp(1.35rem, 2vw, 1.8rem); font-variant-numeric: tabular-nums; }
.home-kpi small { overflow: hidden; color: #94a3b8; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.home-kpi-primary { color: #fff; background: linear-gradient(135deg, #1d4ed8, #2563eb); border-color: transparent; }
.home-kpi-primary span, .home-kpi-primary small { color: #dbeafe; }
.home-kpi-primary strong { color: #fff; }
.home-source-date { color: #94a3b8; font-size: .72rem; white-space: nowrap; }
.home-trend-list { display: grid; gap: 11px; max-height: 430px; overflow-y: auto; padding: 16px 20px 18px; }
.home-trend-row { display: grid; grid-template-columns: 42px minmax(100px, 1fr) 150px; gap: 12px; align-items: center; }
.home-trend-row time { color: #64748b; font-size: .73rem; font-variant-numeric: tabular-nums; }
.home-trend-bars { display: grid; gap: 4px; }
.home-trend-track { height: 6px; overflow: hidden; background: #edf2f7; border-radius: 99px; }
.home-trend-track span { display: block; min-width: 0; height: 100%; border-radius: inherit; }
.home-trend-sales { background: #2563eb; }
.home-trend-ads { background: #f59e0b; }
.home-trend-values strong, .home-trend-values small { display: block; text-align: right; }
.home-trend-values strong { color: #1e293b; font-size: .8rem; }
.home-trend-values small { color: #94a3b8; font-size: .68rem; }
.home-actions { display: grid; padding: 8px 18px; }
.home-actions a { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px; color: #334155; border-bottom: 1px solid #edf2f7; text-decoration: none; }
.home-actions a:hover { color: #1d4ed8; }
.home-actions span { display: flex; gap: 9px; align-items: center; font-size: .82rem; font-weight: 700; }
.home-actions i { color: #64748b; }
.home-actions strong { display: grid; min-width: 30px; height: 30px; place-items: center; color: #9a3412; background: #ffedd5; border-radius: 99px; }
.home-monthly-link { display: flex; align-items: center; justify-content: space-between; margin: 12px 18px 18px; padding: 15px; color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; text-decoration: none; }
.home-monthly-link strong, .home-monthly-link small { display: block; }
.home-monthly-link small { margin-top: 3px; color: #64748b; font-size: .7rem; }
.home-store-table td { vertical-align: middle; }
.home-store-table td strong, .home-store-table td small { display: block; }
.home-store-table td small { margin-top: 3px; color: #94a3b8; }

@media (max-width: 1280px) {
  .home-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .home-filter-grid, .home-kpi-grid { grid-template-columns: 1fr; }
  .home-data-period { align-items: flex-start; flex-direction: column; }
  .home-data-period span { margin-left: 0; }
  .home-trend-row { grid-template-columns: 40px minmax(80px, 1fr) 115px; gap: 8px; }
}

/* Global operation feedback */
.app-loading-overlay {
  position: fixed;
  z-index: 3000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .34);
  backdrop-filter: blur(2px);
}
.app-loading-overlay[hidden] { display: none; }
.app-loading-panel {
  display: grid;
  width: min(390px, 100%);
  justify-items: center;
  gap: 13px;
  padding: 28px 30px 24px;
  color: #0f172a;
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  text-align: center;
}
.app-loading-panel .spinner-border { width: 2.5rem; height: 2.5rem; }
.app-loading-panel strong { font-size: 1rem; }
.app-loading-panel small { color: #64748b; font-size: .75rem; }
.app-loading-progress { width: 100%; height: 7px; background: #e2e8f0; }
.app-loading-progress .progress-bar { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.app-action-loading { pointer-events: none; opacity: .78; }
.app-action-loading > .bi,
.app-action-loading > .spinner-border { display: none; }
.app-action-loading::before {
  display: inline-block;
  width: .9rem;
  height: .9rem;
  margin-right: .45rem;
  vertical-align: -.12rem;
  content: "";
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: app-action-spin .65s linear infinite;
}
@keyframes app-action-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .app-action-loading::before,
  .app-loading-progress .progress-bar,
  .app-loading-panel .spinner-border { animation-duration: 1.5s; }
}
