:root {
  --bg: #f5f1e8;
  --bg-accent: #e9deca;
  --panel: rgba(255, 252, 247, 0.88);
  --line: rgba(68, 54, 39, 0.12);
  --text: #221b16;
  --muted: #6f6255;
  --brand: #b34d1f;
  --brand-dark: #7a2f12;
  --ink-soft: #f8f4ed;
  --success: #206a43;
  --error: #a12e24;
  --shadow: 0 20px 60px rgba(66, 44, 26, 0.1);
  --shadow-soft: 0 12px 30px rgba(66, 44, 26, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --workspace-panel-height: calc(100dvh - 220px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 26%),
    radial-gradient(circle at right 12%, rgba(179, 77, 31, 0.08), transparent 20%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-accent) 100%);
}

img,
svg,
canvas {
  max-width: 100%;
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 38px) clamp(12px, 2.5vw, 16px) clamp(32px, 5vw, 64px);
}

.page-shell > * {
  min-width: 0;
}

.product-page {
  display: grid;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.82;
}

.product-topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.product-topbar h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(1.65rem, 2.4vw, 2.35rem);
  line-height: 1.06;
  letter-spacing: 0.01em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(68, 54, 39, 0.08);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(66, 44, 26, 0.06);
}

.hero {
  margin-bottom: 18px;
}

.lead {
  margin: 8px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(68, 54, 39, 0.1);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.logout-button {
  font: inherit;
}

.nav-link:hover {
  transform: translateY(-1px);
}

.nav-link.active {
  border-color: rgba(179, 77, 31, 0.4);
  color: var(--brand-dark);
  box-shadow: 0 14px 34px rgba(179, 77, 31, 0.12);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.muted {
  color: var(--muted);
}

.upload-form {
  margin-top: 20px;
}

.search-form {
  margin: 0;
}

.field {
  display: block;
  margin: 0;
}

.field span {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.field-hint {
  margin: 8px 2px 0;
  font-size: 0.84rem;
}

.field input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
}

.field input:focus {
  outline: none;
  border-color: rgba(179, 77, 31, 0.45);
  box-shadow: 0 0 0 4px rgba(179, 77, 31, 0.08);
}

.field select {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  color: var(--text);
}

.field select:focus {
  outline: none;
  border-color: rgba(179, 77, 31, 0.45);
  box-shadow: 0 0 0 4px rgba(179, 77, 31, 0.08);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.search-shell {
  padding: 18px 20px;
  border: 1px solid rgba(68, 54, 39, 0.1);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(249, 241, 228, 0.92)),
    repeating-linear-gradient(
      -45deg,
      rgba(179, 77, 31, 0.025),
      rgba(179, 77, 31, 0.025) 10px,
      transparent 10px,
      transparent 20px
    );
  box-shadow: var(--shadow);
}

.search-form-hero .field span {
  margin-bottom: 10px;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}

.search-row-hero {
  grid-template-columns: minmax(0, 1fr) 130px;
}

.status-inline {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 210px;
  padding: 24px;
  border: 2px dashed rgba(163, 75, 34, 0.35);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 245, 236, 0.8)),
    repeating-linear-gradient(
      -45deg,
      rgba(163, 75, 34, 0.03),
      rgba(163, 75, 34, 0.03) 10px,
      transparent 10px,
      transparent 20px
    );
  text-align: center;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.dropzone:hover,
.dropzone.dragover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 10px 28px rgba(163, 75, 34, 0.12);
}

.dropzone-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.dropzone-subtitle {
  color: var(--muted);
}

.file-list,
.result-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
}

.file-item div {
  display: grid;
  gap: 4px;
}

.file-item.empty {
  justify-content: center;
  color: var(--muted);
}

.actions {
  margin-top: 18px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.secondary-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border: 1px solid rgba(84, 57, 34, 0.14);
}

.slot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(32, 106, 67, 0.12);
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  align-self: center;
}

.image-slot-header > .slot-badge {
  display: inline-flex;
  margin: 0;
}

.ghost-button {
  padding: 10px 16px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 600;
}

.message.info {
  background: rgba(163, 75, 34, 0.1);
  color: var(--brand-dark);
}

.message.success {
  background: rgba(32, 106, 67, 0.12);
  color: var(--success);
}

.message.error {
  background: rgba(161, 46, 36, 0.12);
  color: var(--error);
}

.message.hidden {
  display: none;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}

.login-panel {
  display: grid;
  gap: 22px;
  width: min(100%, 520px);
  padding: 28px;
}

.login-copy h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.04;
}

.login-form {
  display: grid;
  gap: 16px;
}

.result-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.result-card h3 {
  margin: 0 0 12px;
}

.result-card p {
  margin: 8px 0 0;
  line-height: 1.6;
  word-break: break-all;
}

.result-card a {
  color: var(--brand-dark);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.analytics-page {
  display: grid;
  gap: 18px;
  width: 100%;
  min-width: 0;
}

.map-page {
  display: grid;
  gap: 20px;
  width: min(100%, 1540px);
  min-width: 0;
  margin: 0 auto;
}

.map-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.6fr);
  gap: 18px;
  align-items: stretch;
  overflow: hidden;
  padding: 30px;
  background:
    radial-gradient(circle at top right, rgba(122, 47, 18, 0.18), transparent 28%),
    radial-gradient(circle at left 15%, rgba(32, 106, 67, 0.12), transparent 22%),
    linear-gradient(135deg, rgba(255, 252, 247, 0.98), rgba(242, 232, 214, 0.92));
}

.map-hero-copy h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.02;
}

.map-hero-side {
  display: grid;
  align-content: end;
  gap: 6px;
  padding: 22px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.6);
}

.map-filter-panel,
.map-table-panel {
  padding: 24px;
}

.map-filter-header {
  margin-bottom: 18px;
}

.map-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(180px, 0.8fr)) auto;
  gap: 14px;
  align-items: end;
}

.map-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.map-summary-card {
  min-height: 132px;
  padding: 18px;
}

.map-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.map-summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  line-height: 1.05;
}

.map-summary-card p {
  margin: 12px 0 0;
  line-height: 1.45;
}

.map-canvas-panel {
  position: relative;
  padding: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(122, 47, 18, 0.08), transparent 24%),
    radial-gradient(circle at left center, rgba(32, 106, 67, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(245, 237, 227, 0.94));
}

.map-canvas-header {
  align-items: start;
}

.map-canvas-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.map-back-button.hidden {
  display: none;
}

.map-back-button,
.map-metric-toggle-button,
.map-fullscreen-button {
  min-height: 38px;
  padding: 0 16px;
}

.map-canvas-panel:fullscreen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100vw;
  height: 100vh;
  max-width: none;
  margin: 0;
  padding: 18px 18px 20px;
  border-radius: 0;
  background:
    radial-gradient(circle at top right, rgba(122, 47, 18, 0.12), transparent 24%),
    radial-gradient(circle at left center, rgba(32, 106, 67, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(255, 253, 249, 0.99), rgba(243, 235, 225, 0.97));
}

.map-canvas-panel:fullscreen .map-chart {
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
}

.map-canvas-float {
  position: absolute;
  right: 26px;
  z-index: 6;
}

.map-canvas-float-top-right {
  top: 26px;
}

.map-canvas-float-bottom-right {
  bottom: 28px;
}

.map-canvas-control-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
  padding: 0;
}

.map-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  color: rgba(42, 31, 22, 0.92);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid rgba(91, 70, 47, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(247, 238, 225, 0.78), rgba(235, 244, 236, 0.72));
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(68, 54, 39, 0.12);
}

.map-inline-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #7a4a1d;
}

.map-back-button,
.map-metric-toggle-button {
  border: 1px solid rgba(91, 70, 47, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(252, 243, 232, 0.86), rgba(243, 231, 214, 0.76));
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 30px rgba(68, 54, 39, 0.14);
}

.map-back-button:hover,
.map-metric-toggle-button:hover,
.map-inline-toggle:hover {
  border-color: rgba(122, 74, 29, 0.28);
  box-shadow: 0 16px 34px rgba(68, 54, 39, 0.16);
}

.map-fullscreen-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  margin-top: 4px;
  border: 1px solid rgba(57, 76, 62, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(231, 242, 233, 0.82), rgba(217, 231, 221, 0.72));
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 30px rgba(35, 58, 42, 0.16);
}

.map-fullscreen-button:hover {
  border-color: rgba(32, 106, 67, 0.34);
  box-shadow: 0 16px 34px rgba(35, 58, 42, 0.2);
}

.map-fullscreen-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-fullscreen-button.is-active {
  color: #154d2f;
  border-color: rgba(21, 77, 47, 0.3);
  background: linear-gradient(135deg, rgba(216, 238, 221, 0.9), rgba(194, 227, 205, 0.82));
}

.map-chart {
  width: 100%;
  height: 700px;
  margin-top: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 26%),
    linear-gradient(180deg, rgba(255, 251, 247, 0.96), rgba(246, 239, 229, 0.9));
  border: 1px solid rgba(68, 54, 39, 0.06);
}

.map-ranking-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
}

.map-ranking-panel {
  padding: 24px;
  overflow: hidden;
}

.map-ranking-panel-province {
  background:
    radial-gradient(circle at top left, rgba(122, 47, 18, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 251, 247, 0.98), rgba(246, 235, 223, 0.94));
}

.map-ranking-panel-city {
  background:
    radial-gradient(circle at top right, rgba(32, 106, 67, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(251, 254, 250, 0.98), rgba(236, 244, 238, 0.94));
}

.map-ranking-header {
  align-items: start;
}

.map-ranking-accent {
  display: grid;
  gap: 4px;
  min-width: 108px;
  padding: 12px 14px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  text-align: right;
}

.map-ranking-accent strong {
  font-size: 1rem;
}

.map-ranking-accent span {
  color: var(--muted);
  font-size: 0.78rem;
}

.map-ranking-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.map-ranking-list-province {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.map-ranking-list-city {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.map-sales-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.map-sales-header {
  align-items: end;
}

.map-sales-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px)) auto;
  gap: 14px;
  align-items: end;
}

.map-sales-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.map-sales-summary-card {
  padding: 16px 18px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.map-sales-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.map-sales-summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.55rem;
  line-height: 1.05;
}

.map-sales-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.map-sales-chart-shell {
  min-width: 0;
}

.map-sales-chart {
  height: 420px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 26%),
    linear-gradient(180deg, rgba(251, 254, 250, 0.98), rgba(240, 245, 241, 0.94));
}

.map-sales-ranking {
  min-width: 0;
}

.map-sales-ranking-list {
  margin-top: 18px;
}

.map-ranking-item,
.map-ranking-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 15px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(66, 44, 26, 0.05);
}

.map-ranking-item {
  width: 100%;
  color: var(--text);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.map-ranking-item:hover {
  transform: translateY(-2px);
  border-color: rgba(179, 77, 31, 0.24);
  box-shadow: 0 16px 32px rgba(122, 47, 18, 0.08);
}

.map-ranking-item.is-active {
  border-color: rgba(179, 77, 31, 0.38);
  background:
    linear-gradient(135deg, rgba(255, 245, 236, 0.98), rgba(249, 235, 220, 0.94));
  box-shadow: 0 18px 36px rgba(122, 47, 18, 0.1);
}

.map-ranking-index {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(179, 77, 31, 0.16), rgba(122, 47, 18, 0.08));
  color: var(--brand-dark);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.map-ranking-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.map-ranking-copy strong,
.map-ranking-copy small {
  display: block;
}

.map-ranking-copy strong {
  font-size: 0.98rem;
  line-height: 1.25;
}

.map-ranking-copy small {
  color: var(--muted);
  line-height: 1.45;
}

.map-table-header {
  align-items: end;
}

.map-customer-table th,
.map-customer-table td {
  white-space: nowrap;
}

.customer-page {
  display: grid;
  gap: 20px;
  width: min(100%, 1500px);
  min-width: 0;
  margin: 0 auto;
}

.page-shell.customer-page {
  max-width: 1500px;
}

.customer-page > section,
.customer-page > nav {
  width: 100%;
  min-width: 0;
}

.customer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
  gap: 18px;
  align-items: stretch;
  overflow: hidden;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(32, 106, 67, 0.14), transparent 28%),
    radial-gradient(circle at left center, rgba(179, 77, 31, 0.08), transparent 24%),
    linear-gradient(135deg, rgba(255, 253, 249, 0.98), rgba(244, 236, 223, 0.92));
}

.customer-hero-copy h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.02;
}

.customer-hero-side {
  display: grid;
  align-content: end;
  gap: 6px;
  padding: 22px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
}

.customer-filter-header {
  margin-bottom: 18px;
}

.customer-filter-panel {
  padding: 24px;
}

.customer-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.8fr) minmax(180px, 0.8fr) auto;
  gap: 14px;
  align-items: end;
}

.customer-sync-button {
  white-space: nowrap;
}

.customer-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.customer-filter-button {
  min-width: 88px;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
}

.customer-data-panel {
  min-width: 0;
  overflow: hidden;
  padding: 24px;
}

.customer-data-header {
  align-items: end;
  gap: 18px;
}

.customer-data-copy {
  min-width: 0;
}

.customer-table-tip {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.customer-table-wrap {
  margin-top: 18px;
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  -webkit-overflow-scrolling: touch;
}

.customer-table {
  min-width: 1240px;
}

.customer-table td {
  vertical-align: top;
}

.customer-table th:first-child,
.customer-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: rgba(255, 252, 247, 0.98);
}

.customer-table thead th:first-child {
  z-index: 4;
  background: rgba(179, 77, 31, 0.12);
}

.customer-table th:last-child,
.customer-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: -10px 0 18px rgba(66, 44, 26, 0.05);
}

.customer-table thead th:last-child {
  z-index: 5;
  background: rgba(179, 77, 31, 0.12);
}

.customer-cell-code {
  white-space: nowrap;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.86rem;
}

.customer-cell-name {
  min-width: 240px;
}

.customer-edit-input,
.customer-owner-select {
  width: 100%;
  min-width: 96px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-size: 0.88rem;
}

.customer-edit-input:focus,
.customer-owner-select:focus {
  outline: none;
  border-color: rgba(179, 77, 31, 0.45);
  box-shadow: 0 0 0 4px rgba(179, 77, 31, 0.08);
}

.customer-region-info {
  min-width: 180px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.88rem;
}

.customer-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.customer-status-badge.is-enabled {
  background: rgba(32, 106, 67, 0.12);
  color: var(--success);
}

.customer-status-badge.is-disabled {
  background: rgba(68, 54, 39, 0.12);
  color: var(--muted);
}

.customer-row-disabled td {
  background: rgba(68, 54, 39, 0.02);
}

.customer-row-disabled .customer-cell-name,
.customer-row-disabled .customer-cell-code,
.customer-row-disabled .customer-region-info {
  color: var(--muted);
}

.customer-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.customer-row-actions button,
.customer-filter-actions button {
  white-space: nowrap;
}

.customer-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1;
}

.customer-reset-row-button {
  background: rgba(255, 255, 255, 0.72);
}

.customer-save-row-button {
  background: rgba(179, 77, 31, 0.14);
  color: var(--brand-dark);
}

.customer-toggle-row-button {
  min-width: 52px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
  background: rgba(68, 54, 39, 0.08);
  color: var(--text);
}

.customer-table th:nth-child(4),
.customer-table td:nth-child(4) {
  min-width: 96px;
}

.customer-table th:nth-child(5),
.customer-table td:nth-child(5),
.customer-table th:nth-child(6),
.customer-table td:nth-child(6),
.customer-table th:nth-child(7),
.customer-table td:nth-child(7) {
  min-width: 108px;
}

.customer-table th:nth-child(8),
.customer-table td:nth-child(8) {
  min-width: 160px;
}

.customer-table th:nth-child(9),
.customer-table td:nth-child(9) {
  min-width: 180px;
}

.customer-table th:nth-child(10),
.customer-table td:nth-child(10) {
  min-width: 126px;
}

.analytics-page > section,
.analytics-page > div {
  min-width: 0;
}

.analytics-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
  gap: 18px;
  align-items: stretch;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(179, 77, 31, 0.16), transparent 28%),
    radial-gradient(circle at left center, rgba(32, 106, 67, 0.1), transparent 24%),
    linear-gradient(135deg, rgba(255, 253, 249, 0.98), rgba(244, 236, 223, 0.92));
}

.analytics-hero-copy h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.analytics-lead {
  max-width: 760px;
}

.analytics-hero-side {
  display: grid;
  align-content: end;
  gap: 4px;
  padding: 22px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
}

.hero-metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.hero-metric-value {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1;
}

.analytics-filter-panel {
  overflow: visible;
}

.analytics-filter-header {
  margin-bottom: 18px;
}

.analytics-filters {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.analytics-summary-card {
  min-height: 134px;
  padding: 18px;
  border-radius: 18px;
  box-shadow: none;
}

.analytics-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.analytics-summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  line-height: 1.05;
}

.analytics-summary-card p {
  margin: 12px 0 0;
  line-height: 1.45;
}

.manager-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.analytics-ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.skeleton-card,
.skeleton-row td {
  position: relative;
  overflow: hidden;
}

.skeleton-line,
.skeleton-chip {
  display: block;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(68, 54, 39, 0.08) 0%,
    rgba(255, 255, 255, 0.65) 50%,
    rgba(68, 54, 39, 0.08) 100%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.25s linear infinite;
}

.skeleton-line-short {
  width: 34%;
  min-width: 84px;
  height: 12px;
}

.skeleton-line-medium {
  width: 58%;
  min-width: 120px;
  height: 18px;
}

.skeleton-line-long {
  width: 82%;
  min-width: 180px;
  height: 12px;
}

.skeleton-chip {
  width: 96px;
  height: 28px;
}

.skeleton-row td {
  padding: 14px 12px;
}

.analytics-page.is-ready .analytics-summary-card,
.analytics-page.is-ready .manager-summary-card,
.analytics-page.is-ready .rank-customer-item,
.analytics-page.is-ready .franchise-card,
.analytics-page.is-ready .risk-radar-item,
.analytics-page.is-ready .inventory-aging-card,
.analytics-page.is-ready .schema-dimension-card {
  animation: panel-enter 360ms ease both;
}

.manager-summary-card {
  padding: 16px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: none;
}

.manager-summary-head,
.manager-summary-metrics,
.manager-risk-legend {
  display: grid;
  gap: 10px;
}

.manager-summary-head strong {
  font-size: 1.05rem;
}

.manager-summary-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.manager-summary-metrics div {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(68, 54, 39, 0.06);
}

.manager-summary-metrics span,
.manager-risk-legend span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.manager-summary-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.manager-risk-bar {
  display: flex;
  overflow: hidden;
  height: 12px;
  margin-top: 16px;
  border-radius: 999px;
  background: rgba(68, 54, 39, 0.08);
}

.manager-risk-bar span {
  display: block;
  height: 100%;
}

.manager-risk-high {
  background: #a12e24;
}

.manager-risk-mid {
  background: #d57f4a;
}

.manager-risk-low {
  background: #206a43;
}

.manager-risk-legend {
  margin-top: 14px;
}

.rank-customer-list {
  display: grid;
  gap: 12px;
}

.risk-radar-list,
.rank-customer-list {
  align-content: start;
}

.rank-customer-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.rank-customer-index {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-weight: 700;
}

.rank-customer-index.is-best {
  background: rgba(32, 106, 67, 0.12);
  color: var(--success);
}

.rank-customer-index.is-worst {
  background: rgba(161, 46, 36, 0.12);
  color: var(--error);
}

.rank-customer-content {
  min-width: 0;
}

.rank-customer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.rank-customer-head p {
  margin: 6px 0 0;
}

.rank-customer-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.rank-customer-metrics span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(68, 54, 39, 0.06);
  font-size: 0.82rem;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -20% 0;
  }
}

@keyframes panel-enter {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.analytics-data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  width: 100%;
  min-width: 0;
}

.franchise-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.franchise-card {
  padding: 16px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
}

.franchise-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.franchise-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.franchise-card-head p {
  margin: 6px 0 0;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.risk-badge.is-high {
  background: rgba(161, 46, 36, 0.12);
  color: var(--error);
}

.risk-badge.is-mid {
  background: rgba(179, 77, 31, 0.12);
  color: var(--brand-dark);
}

.risk-badge.is-low {
  background: rgba(32, 106, 67, 0.12);
  color: var(--success);
}

.franchise-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.franchise-stat-grid div {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(68, 54, 39, 0.06);
}

.franchise-stat-grid span,
.finance-line span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.franchise-stat-grid strong,
.finance-line strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.franchise-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.franchise-meta-list span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(68, 54, 39, 0.06);
  font-size: 0.82rem;
}

.franchise-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(68, 54, 39, 0.04);
  color: var(--muted);
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(179, 77, 31, 0.08);
  color: var(--brand-dark);
  font-size: 0.82rem;
}

.risk-radar-list,
.inventory-aging-list,
.schema-dimension-grid {
  display: grid;
  gap: 12px;
}

.risk-radar-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.risk-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(179, 77, 31, 0.1);
  color: var(--brand-dark);
  font-weight: 700;
}

.risk-content strong,
.inventory-aging-head strong,
.schema-dimension-card h3 {
  display: block;
}

.risk-content p {
  margin: 6px 0 0;
}

.risk-progress {
  margin-top: 10px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(68, 54, 39, 0.08);
}

.risk-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d57f4a, #206a43);
}

.risk-side {
  min-width: 68px;
  text-align: right;
}

.risk-caption {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.inventory-aging-card,
.schema-dimension-card {
  padding: 15px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.inventory-aging-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.aging-bar {
  display: flex;
  overflow: hidden;
  height: 12px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(68, 54, 39, 0.08);
}

.aging-bar span {
  display: block;
  height: 100%;
}

.aging-fresh {
  background: #206a43;
}

.aging-mid {
  background: #d1983c;
}

.aging-risk {
  background: #a12e24;
}

.aging-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.finance-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-top: 12px;
}

.schema-table-name {
  margin: 0;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.schema-dimension-card h3 {
  margin: 10px 0 0;
  font-size: 1rem;
}

.schema-dimension-card .muted {
  margin: 10px 0 0;
  line-height: 1.6;
}

.analytics-table th,
.analytics-table td {
  white-space: nowrap;
}

.panel-list,
.panel-upload {
  height: max(620px, var(--workspace-panel-height));
}

.panel-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-upload {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.product-list {
  display: grid;
  flex: 1;
  align-content: start;
  overflow-y: auto;
  gap: 14px;
  margin-top: 18px;
  padding-right: 4px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.pagination.hidden {
  display: none;
}

.pagination-info {
  min-width: 110px;
  color: var(--muted);
  text-align: center;
  font-size: 0.94rem;
}

.product-card {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 242, 232, 0.92));
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.product-card.active {
  border-color: rgba(179, 77, 31, 0.42);
  box-shadow: 0 14px 34px rgba(179, 77, 31, 0.14);
}

.product-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.product-card-stock-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-card-stock-total {
  white-space: nowrap;
}

.product-card strong {
  font-size: 0.98rem;
  line-height: 1.35;
}

.selected-product {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(179, 77, 31, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 241, 230, 0.9));
  box-shadow: var(--shadow-soft);
}

.upload-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.selected-product.empty,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
}

.selected-product h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.selected-product p {
  margin: 5px 0 0;
  line-height: 1.45;
  font-size: 0.93rem;
}

.stock-list {
  display: grid;
  gap: 10px;
}

.stock-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.stock-table-wrap-wide {
  max-width: 100%;
}

.stock-table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
}

.stock-table th,
.stock-table td {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.92rem;
}

.stock-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--brand-dark);
  font-weight: 700;
  background: rgba(179, 77, 31, 0.08);
  border-bottom: 1px solid rgba(68, 54, 39, 0.08);
  white-space: nowrap;
}

.stock-table tbody td {
  border-top: 1px solid rgba(68, 54, 39, 0.06);
  vertical-align: middle;
}

.stock-table tbody tr:first-child td {
  border-top: none;
}

.stock-table tfoot td {
  font-weight: 700;
  background: rgba(68, 54, 39, 0.05);
  border-top: 1px solid rgba(68, 54, 39, 0.08);
}

.stock-table-pivot {
  min-width: 640px;
}

.stock-table-pivot th,
.stock-table-pivot td {
  text-align: center;
}

.stock-table-pivot th:nth-child(1),
.stock-table-pivot td:nth-child(1),
.stock-table-pivot th:nth-child(2),
.stock-table-pivot td:nth-child(2) {
  text-align: left;
}

.stock-table-customer {
  min-width: 180px;
  font-weight: 600;
  background: rgba(255, 248, 241, 0.72);
  vertical-align: top;
  padding-top: 14px;
}

.stock-table-customer-placeholder {
  min-width: 180px;
  background: rgba(255, 248, 241, 0.38);
}

.stock-table-summary {
  text-align: left;
}

.stock-table-total {
  font-weight: 700;
}

.stock-table-empty {
  color: var(--muted);
}

.stock-empty {
  margin: 0;
  color: var(--muted);
}

.stock-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 24px;
  margin-left: 4px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(179, 77, 31, 0.1);
  color: var(--brand-dark);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.stock-trigger:hover {
  transform: translateY(-1px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 27, 22, 0.36);
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100% - 28px));
  max-height: min(78vh, 860px);
  margin: 6vh auto 0;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 241, 231, 0.95));
  box-shadow: 0 26px 70px rgba(34, 27, 22, 0.18);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-stock-list {
  flex: 1;
  min-height: 0;
  margin-top: 0;
  overflow: auto;
  padding-right: 4px;
}

.image-slot-list {
  display: grid;
  flex: 1;
  align-content: start;
  overflow-y: auto;
  gap: 14px;
  margin-top: 18px;
  min-height: 0;
  padding-right: 4px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.image-slot-card {
  display: block;
  padding: 16px;
  border: 1px solid rgba(68, 54, 39, 0.08);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 242, 233, 0.88));
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.image-slot-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.image-slot-header strong,
.image-slot-header span {
  display: block;
}

.image-slot-header span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.image-slot-dropzone {
  display: grid;
  place-items: center;
  gap: 10px;
  margin-top: 14px;
  min-height: 220px;
  padding: 18px;
  border: 2px dashed rgba(179, 77, 31, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.88), rgba(252, 244, 234, 0.9));
  text-align: center;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.image-slot-dropzone.dragover {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: rgba(255, 243, 233, 0.98);
  box-shadow: 0 10px 28px rgba(163, 75, 34, 0.12);
}

.image-slot-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(84, 57, 34, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.image-preview-button {
  position: relative;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: transparent;
  overflow: hidden;
}

.image-preview-button:hover .image-preview-hint {
  opacity: 1;
}

.image-preview-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 27, 22, 0.74);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1;
  opacity: 0.92;
}

.modal-image-dialog {
  width: min(1280px, calc(100% - 28px));
  height: min(92vh, 1080px);
  max-height: min(92vh, 1080px);
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.modal-image-close {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  background: rgba(34, 27, 22, 0.62);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  font-size: 1.5rem;
  line-height: 1;
}

.modal-image-body {
  display: grid;
  flex: 1;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.modal-image-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.modal-image-target {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: transparent;
}

.compact-hint {
  margin-top: 8px;
}

@media (max-width: 640px) {
  .page-shell {
    width: 100%;
    padding: 18px 12px 28px;
  }

  .product-topbar,
  .workspace-grid,
  .search-row,
  .search-row-hero {
    grid-template-columns: 1fr;
    display: grid;
  }

  .product-topbar,
  .panel-header-row,
  .modal-header,
  .file-item,
  .rank-customer-head,
  .franchise-card-head,
  .inventory-aging-head,
  .finance-line {
    align-items: flex-start;
  }

  .dropzone {
    min-height: 160px;
    padding: 18px 14px;
  }

  .dropzone-title {
    font-size: 1rem;
  }

  .image-slot-header {
    flex-direction: column;
  }

  .panel {
    padding: 16px;
  }

  .panel-list,
  .panel-upload {
    height: auto;
    min-height: 0;
  }

  .product-list,
  .image-slot-list,
  .modal-stock-list {
    overflow: visible;
  }

  .product-list,
  .image-slot-list {
    max-height: none;
    padding-right: 0;
  }

  .selected-product,
  .result-card,
  .file-item {
    padding: 14px;
  }

  .login-panel {
    padding: 20px;
  }

  button {
    width: 100%;
  }

  .actions,
  .map-filter-actions,
  .branch-filter-actions {
    width: 100%;
  }

  .pagination {
    flex-direction: column;
  }

  .pagination-info {
    min-width: 0;
  }

  .modal-dialog {
    width: calc(100% - 20px);
    max-height: min(88dvh, 860px);
    margin-top: 4dvh;
    padding: 16px;
    border-radius: 22px;
  }

  .modal-image-dialog {
    width: calc(100% - 12px);
    height: min(94dvh, 1080px);
    max-height: min(94dvh, 1080px);
  }

  .modal-image-close {
    top: 8px;
    left: 8px;
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 1100px) {
  .analytics-summary-grid,
  .manager-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .customer-hero,
  .customer-filters,
  .map-hero,
  .map-filters,
  .map-ranking-grid,
  .map-sales-grid,
  .analytics-ranking-grid,
  .analytics-data-grid,
  .analytics-hero,
  .analytics-filters {
    grid-template-columns: 1fr;
  }

  .customer-data-header {
    align-items: start;
  }

  .customer-table-tip {
    white-space: normal;
  }

  .page-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .customer-filters,
  .map-filters,
  .map-sales-filters,
  .page-nav,
  .map-summary-grid,
  .map-ranking-list-province,
  .map-sales-summary-grid,
  .analytics-summary-grid,
  .manager-summary-grid,
  .franchise-stat-grid {
    grid-template-columns: 1fr;
  }

  .page-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .customer-filter-actions,
  .customer-row-actions,
  .map-filter-actions,
  .branch-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .customer-hero,
  .map-hero,
  .analytics-hero,
  .customer-filter-panel,
  .customer-data-panel,
  .map-filter-panel,
  .map-table-panel,
  .map-canvas-panel,
  .map-ranking-panel,
  .map-sales-panel,
  .branch-filter-panel {
    padding: 18px;
  }

  .risk-radar-item,
  .inventory-aging-head,
  .finance-snapshot-head,
  .franchise-card-head,
  .rank-customer-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .risk-side {
    text-align: left;
  }

  .analytics-summary-grid {
    gap: 12px;
  }

  .map-hero-side,
  .customer-hero-side,
  .analytics-hero-side {
    padding: 18px;
  }

  .hero-metric-value {
    font-size: clamp(1.9rem, 9vw, 2.8rem);
  }

  .map-chart {
    height: min(62dvh, 500px);
  }

  .map-ranking-accent {
    justify-content: flex-start;
    text-align: left;
  }

  .map-canvas-header {
    gap: 12px;
  }

  .map-canvas-float {
    position: static;
    right: auto;
    margin-top: 14px;
  }

  .map-canvas-float-top-right,
  .map-canvas-float-bottom-right {
    top: auto;
    bottom: auto;
  }

  .map-canvas-control-stack {
  justify-content: flex-start;
  justify-items: start;
  }

  .customer-table th:last-child,
  .customer-table td:last-child {
    position: static;
    right: auto;
    z-index: auto;
    box-shadow: none;
  }

  .customer-table thead th:last-child {
    z-index: 1;
  }
}

@media (max-width: 560px) {
  .page-nav {
    gap: 8px;
  }

  .nav-link,
  .back-link {
    width: 100%;
    justify-content: center;
    padding: 0 14px;
  }

  .map-summary-grid,
  .map-sales-summary-grid,
  .analytics-summary-grid,
  .manager-summary-grid,
  .franchise-stat-grid,
  .branch-comparison-grid,
  .branch-profile-grid,
  .manager-summary-metrics {
    grid-template-columns: 1fr;
  }

  .map-ranking-list-city,
  .map-ranking-list-province,
  .franchise-card-grid {
    grid-template-columns: 1fr;
  }

  .map-sales-chart,
  .branch-trend-chart {
    height: min(46dvh, 320px);
  }

  .stock-table th,
  .stock-table td {
    padding: 9px 10px;
    font-size: 0.88rem;
  }

  .customer-table-tip,
  .field-hint,
  .status-inline,
  .lead,
  .muted {
    overflow-wrap: anywhere;
  }
}

.branch-analysis-page {
  display: grid;
  gap: 18px;
  width: min(100%, 1500px);
  min-width: 0;
  margin: 0 auto;
}

.branch-analysis-hero {
  align-items: stretch;
}

.branch-analysis-page > section,
.branch-analysis-page > div,
.branch-analysis-page > nav {
  width: 100%;
  min-width: 0;
}

.branch-analysis-hero .hero-metric-value {
  font-size: clamp(1.5rem, 2.1vw, 2rem);
}

.branch-filter-form {
  display: grid;
  grid-template-columns: minmax(360px, 2.1fr) repeat(3, minmax(160px, 1fr)) auto;
  gap: 16px;
  align-items: end;
}

.branch-filter-panel {
  position: relative;
  z-index: 20;
  overflow: visible;
}

.branch-filter-field-wide {
  min-width: 0;
}

.branch-filter-form .field-hint {
  display: none;
}

.branch-picker-shell {
  position: relative;
}

.branch-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(180, 148, 120, 0.2);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 18px 40px rgba(66, 44, 26, 0.12);
}

.branch-picker-dropdown.hidden {
  display: none;
}

.branch-picker-options {
  display: grid;
  gap: 6px;
}

.branch-picker-option {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.branch-picker-option:hover {
  background: rgba(179, 77, 31, 0.08);
}

.branch-picker-option.is-empty {
  color: var(--muted);
  cursor: default;
}

.supplier-analysis-page,
.single-supplier-page {
  display: grid;
  gap: 18px;
  width: min(100%, 1500px);
  min-width: 0;
  margin: 0 auto;
}

.supplier-analysis-page > section,
.supplier-analysis-page > div,
.supplier-analysis-page > nav,
.single-supplier-page > section,
.single-supplier-page > div,
.single-supplier-page > nav {
  width: 100%;
  min-width: 0;
}

.supplier-hero {
  background:
    radial-gradient(circle at top right, rgba(84, 130, 100, 0.24), transparent 34%),
    linear-gradient(135deg, rgba(255, 251, 241, 0.96), rgba(235, 244, 231, 0.92));
}

.product-analysis-page {
  display: grid;
  gap: 18px;
  width: min(100%, 1500px);
  min-width: 0;
  margin: 0 auto;
}

.product-analysis-page > section,
.product-analysis-page > div,
.product-analysis-page > nav {
  width: 100%;
  min-width: 0;
}

.product-analysis-hero {
  background:
    radial-gradient(circle at top right, rgba(52, 110, 86, 0.24), transparent 34%),
    radial-gradient(circle at left 12%, rgba(204, 148, 62, 0.14), transparent 22%),
    linear-gradient(135deg, rgba(255, 252, 244, 0.98), rgba(231, 241, 235, 0.94));
}

.product-analysis-hero .hero-metric-value {
  font-size: clamp(1.45rem, 2.1vw, 2rem);
}

.product-analysis-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.product-analysis-main-grid > * {
  min-width: 0;
}

.product-dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.product-triple-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.product-analysis-table td:first-child {
  min-width: 190px;
}

.product-analysis-card-list {
  display: grid;
  gap: 12px;
}

.product-analysis-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(85, 111, 90, 0.12);
  box-shadow: 0 12px 26px rgba(48, 67, 54, 0.08);
}

.product-analysis-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.product-analysis-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.product-analysis-card-head strong,
.product-analysis-card-head span {
  display: block;
}

.product-analysis-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.recommendation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(109, 108, 100, 0.12);
  color: #545148;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.recommendation-badge.urgent {
  background: rgba(30, 122, 88, 0.14);
  color: #186348;
}

.recommendation-badge.positive {
  background: rgba(76, 139, 114, 0.14);
  color: #2d6a54;
}

.recommendation-badge.watch {
  background: rgba(192, 138, 58, 0.14);
  color: #99671d;
}

.recommendation-badge.danger {
  background: rgba(180, 77, 56, 0.14);
  color: #9a3c29;
}

.supplier-hero .hero-metric-value {
  font-size: clamp(1.45rem, 2.1vw, 2rem);
}

.supplier-filter-form {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) repeat(2, minmax(160px, 1fr)) auto;
  gap: 16px;
  align-items: end;
}

.supplier-filter-actions {
  display: flex;
  justify-content: flex-end;
}

.product-analysis-filter-form {
  grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(150px, 0.85fr)) minmax(96px, 0.6fr) auto;
  column-gap: 14px;
}

.product-analysis-keyword-field {
  max-width: 360px;
}

.product-analysis-filter-actions {
  align-self: end;
  white-space: nowrap;
}

.product-analysis-filter-actions button {
  width: auto;
  min-width: 124px;
}

.summary-card {
  min-height: 132px;
  padding: 18px;
  border: 1px solid rgba(55, 83, 66, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 14px 34px rgba(42, 61, 47, 0.08);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.35rem, 2.1vw, 1.95rem);
  line-height: 1.05;
}

.summary-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.supplier-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.supplier-main-grid > * {
  min-width: 0;
}

.supplier-table td:first-child {
  min-width: 180px;
}

.supplier-table strong {
  display: block;
}

.supplier-code-tag {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.supplier-risk-list {
  display: grid;
  gap: 10px;
}

.supplier-risk-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(99, 64, 35, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.supplier-risk-item strong,
.supplier-risk-item span,
.supplier-risk-metrics b {
  display: block;
}

.supplier-risk-item span,
.supplier-risk-metrics span {
  color: var(--muted);
  font-size: 0.86rem;
}

.supplier-risk-metrics {
  min-width: 96px;
  text-align: right;
}

.supplier-trend-chart {
  min-height: 360px;
  width: 100%;
}

.supplier-trend-chart .stock-table-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
}

.single-supplier-structure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.single-supplier-structure-card {
  display: grid;
  gap: 10px;
  min-height: 168px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(84, 130, 100, 0.14);
  box-shadow: 0 12px 28px rgba(42, 61, 47, 0.08);
}

.single-supplier-structure-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.single-supplier-structure-card strong {
  font-size: 1.25rem;
  line-height: 1.15;
}

.single-supplier-structure-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.single-supplier-structure-card em {
  margin-top: auto;
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.branch-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.branch-overview-grid,
.branch-ranking-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 24px;
}

.branch-overview-grid > *,
.branch-ranking-grid > *,
.branch-bottom-grid > *,
.branch-dimension-grid > * {
  min-width: 0;
}

.branch-bottom-grid {
  align-items: start;
}

.branch-dimension-grid {
  align-items: start;
}

.branch-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.branch-profile-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(180, 148, 120, 0.18);
}

.branch-profile-item span {
  font-size: 12px;
  color: var(--muted);
}

.branch-profile-item strong {
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.branch-insights-list {
  display: grid;
  gap: 12px;
}

.branch-insight-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 248, 240, 0.95), rgba(255, 255, 255, 0.85));
  border: 1px solid rgba(191, 144, 91, 0.18);
  color: var(--text-primary);
  line-height: 1.7;
}

.branch-trend-chart {
  width: 100%;
  height: 420px;
}

.branch-comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.branch-comparison-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(180, 148, 120, 0.16);
}

.branch-comparison-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.branch-comparison-card strong {
  font-size: 1.22rem;
  line-height: 1.2;
}

.branch-comparison-card em {
  font-style: normal;
  font-size: 0.86rem;
  font-weight: 700;
}

.branch-comparison-card .positive {
  color: var(--success);
}

.branch-comparison-card .negative {
  color: var(--error);
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--error);
}

.branch-data-table td,
.branch-data-table th {
  white-space: nowrap;
}

.comparison-metric-cell {
  display: grid;
  gap: 3px;
}

.comparison-metric-cell strong,
.comparison-metric-cell span,
.comparison-metric-cell em {
  font-style: normal;
}

.comparison-metric-cell strong {
  font-size: 0.95rem;
}

.comparison-metric-cell em,
.attribute-group-totals .positive,
.attribute-group-totals .negative,
.attribute-value-metrics .positive,
.attribute-value-metrics .negative {
  font-size: 0.8rem;
  font-weight: 700;
}

.product-code-tag {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.attribute-performance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.attribute-group-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(180, 148, 120, 0.16);
}

.attribute-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.attribute-group-head h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.attribute-group-totals {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: var(--muted);
  font-size: 0.82rem;
}

.attribute-value-list {
  display: grid;
  gap: 10px;
}

.attribute-value-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(250, 245, 238, 0.92);
  border: 1px solid rgba(180, 148, 120, 0.12);
}

.attribute-value-item strong {
  display: block;
  margin-bottom: 8px;
}

.attribute-value-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.aging-breakdown {
  display: grid;
  gap: 18px;
}

.aging-breakdown-bar {
  display: flex;
  overflow: hidden;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(214, 201, 190, 0.5);
}

.aging-breakdown-segment {
  height: 100%;
}

.aging-breakdown-segment.fresh {
  background: #4c9b7a;
}

.aging-breakdown-segment.mid {
  background: #d7a249;
}

.aging-breakdown-segment.risk {
  background: #b74a3d;
}

.aging-breakdown-list {
  display: grid;
  gap: 12px;
}

.aging-breakdown-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(180, 148, 120, 0.16);
}

.aging-breakdown-item strong,
.aging-breakdown-item span,
.aging-breakdown-item em {
  font-style: normal;
}

@media (max-width: 1180px) {
  .product-analysis-main-grid,
  .product-triple-grid,
  .product-dimension-grid,
  .supplier-filter-form,
  .supplier-main-grid,
  .branch-filter-form,
  .branch-overview-grid,
  .branch-ranking-grid {
    grid-template-columns: 1fr;
  }

  .supplier-filter-actions,
  .branch-filter-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .product-analysis-card-head,
  .supplier-filter-form,
  .branch-filter-form,
  .branch-profile-grid {
    grid-template-columns: 1fr;
  }

  .attribute-performance-grid,
  .single-supplier-structure-grid,
  .branch-comparison-grid,
  .attribute-group-head {
    grid-template-columns: 1fr;
  }

  .product-analysis-card-head {
    display: grid;
  }

  .attribute-group-totals {
    justify-items: start;
  }

  .branch-trend-chart {
    height: 320px;
  }

  .aging-breakdown-item {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
