/* Shoplytixs-inspired SaaS — flat, minimal, accent: #C1B8FF / #FED97B */

:root {
  --color-primary-accent: #C1B8FF;
  --color-secondary-accent: #FED97B;
  --color-bg-page: #F4F4F4;
  --color-surface: #FFFFFF;
  --color-text: #0D0C15;
  --color-text-muted: #888888;
  --color-border: rgba(0, 0, 0, 0.07);
  --color-border-strong: rgba(0, 0, 0, 0.12);
  --color-track: #F0F0F0;
  --color-zebra: #FAFAFA;
  --color-success-bg: #DCFCE7;
  --color-success-text: #16A34A;
  --color-danger-bg: #FEE2E2;
  --color-danger-text: #DC2626;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --space-unit: 8px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg-page);
  min-height: 100vh;
}

[x-cloak] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— App shell ——— */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar rail: wider with labels */
.sidebar-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 196px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: calc(var(--space-unit) * 2) 8px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  margin-bottom: calc(var(--space-unit) * 2);
  border-radius: var(--radius-sm);
  background: var(--color-text);
  text-decoration: none;
}

.sidebar-logo-mark {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-surface);
  line-height: 1;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-unit);
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: var(--color-bg-page);
  color: var(--color-text);
}

.sidebar-link.is-active {
  background: var(--color-text);
  color: var(--color-surface);
}

.sidebar-link.is-active svg {
  stroke: currentColor;
}

.sidebar-link-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding-top: var(--space-unit);
}

.sidebar-theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.sidebar-theme-btn:hover {
  background: var(--color-bg-page);
  color: var(--color-text);
}

.sidebar-link--bottom {
  margin-top: 4px;
}

/* Main column */
.app-main {
  flex: 1;
  margin-left: 196px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 360px) auto;
  align-items: center;
  gap: calc(var(--space-unit) * 2);
  min-height: 56px;
  padding: 0 calc(var(--space-unit) * 3);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.topbar-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.topbar-search-wrap {
  justify-self: end;
  width: 100%;
  max-width: 320px;
}

.topbar-search {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
  background: var(--color-bg-page);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m14 14-3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.topbar-search::placeholder {
  color: var(--color-text-muted);
}

.topbar-search:focus {
  outline: none;
  border-color: var(--color-border-strong);
  background-color: var(--color-surface);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--color-bg-page);
  color: var(--color-text);
}

.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--color-primary-accent);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
}

/* Content */
.content-scroll {
  flex: 1;
  background: var(--color-bg-page);
}

.content-area {
  padding: calc(var(--space-unit) * 3);
  max-width: 1400px;
}

.page-section {
  margin-bottom: calc(var(--space-unit) * 3);
}

.page-section:last-child {
  margin-bottom: 0;
}

.section-title {
  margin: 0 0 calc(var(--space-unit) * 2);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .sidebar-rail {
    width: 56px;
    align-items: center;
    padding: calc(var(--space-unit) * 2) 0;
  }

  .sidebar-logo {
    width: 40px;
  }

  .sidebar-nav {
    align-items: center;
  }

  .sidebar-link {
    justify-content: center;
    width: 40px;
    padding: 0;
  }

  .sidebar-link-label {
    display: none;
  }

  .sidebar-footer {
    align-items: center;
  }

  .sidebar-theme-btn {
    width: 32px;
  }

  .app-main {
    margin-left: 56px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 12px 16px;
    gap: 12px;
  }

  .topbar-search-wrap {
    max-width: none;
    justify-self: stretch;
  }
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.kpi-card__label {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.kpi-card__value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.kpi-card__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.trend-pill--up {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.trend-pill--down {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

/* Chart panel */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .chart-grid--split {
    grid-template-columns: 1fr;
  }
}

.chart-grid--split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.chart-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.chart-placeholder {
  height: 160px;
  position: relative;
}

.chart-line-svg {
  width: 100%;
  height: 120px;
  display: block;
}

.chart-line-path {
  fill: none;
  stroke: var(--color-primary-accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 120px;
  padding-top: 8px;
}

.chart-bar {
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--color-primary-accent);
  transition: height 0.2s ease;
}

.chart-bar--accent2 {
  background: var(--color-secondary-accent);
}

.donut-visual {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(
    var(--color-primary-accent) 0deg 200deg,
    var(--color-secondary-accent) 200deg 300deg,
    #E5E5E5 300deg 360deg
  );
}

.donut-hole {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: var(--color-surface);
}

/* Progress */
.progress-row {
  margin-bottom: 16px;
}

.progress-row:last-child {
  margin-bottom: 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  border-radius: 99px;
  background: var(--color-track);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--color-primary-accent);
}

.progress-fill--top {
  background: var(--color-secondary-accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background: var(--color-text);
  color: var(--color-surface);
  border-color: var(--color-text);
}

.btn--primary:hover {
  opacity: 0.92;
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn--secondary:hover {
  background: var(--color-bg-page);
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* Tables */
.data-table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--color-surface);
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.data-table th.text-right {
  text-align: right;
}

.data-table td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  height: 44px;
}

.data-table tbody tr:nth-child(even) {
  background: var(--color-zebra);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table td.text-right {
  text-align: right;
}

.thumb-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-secondary-accent);
}

.thumb-placeholder {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--color-track);
  flex-shrink: 0;
}

/* Toolbar row */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Notice / alerts */
.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.notice code {
  font-size: 12px;
  background: var(--color-bg-page);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Settings metric cards (reuse kpi) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.card-metric {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.card-metric span {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.card-metric strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

/* Auth page (sign-in, standalone) */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg-page);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-card);
}

.auth-logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-bottom: 28px;
}

.auth-title {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
}

.auth-error {
  margin: 0 0 16px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--color-danger-text);
  background: var(--color-danger-bg);
  border-radius: var(--radius-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.auth-field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color 0.15s;
}

.auth-field input:focus {
  border-color: var(--color-primary-accent);
}

.auth-btn {
  height: 40px;
  margin-top: 4px;
  padding: 0 20px;
  background: var(--color-text);
  color: var(--color-surface);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-btn:hover {
  opacity: 0.85;
}

/* Legacy sign-in-wrap (kept for compatibility) */
.sign-in-wrap {
  max-width: 440px;
  margin: 0 auto;
}

/* Dropdown-style filter (visual) */
.select-like {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 160px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: default;
}

.select-like::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  margin-top: -4px;
}

/* Imports */
.import-card {
  margin-bottom: 16px;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.import-field span {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.import-select {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
}

.import-select--sm {
  min-width: 240px;
}

.import-text {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
}

.preset-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.dropzone {
  position: relative;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg-page);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.dropzone-sub {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.import-helper {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.mapping-workbench {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 16px;
}

.mapping-source,
.mapping-targets {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.mapping-source h4 {
  margin: 0 0 10px;
  font-size: 13px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 10px;
  border-radius: 99px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  cursor: grab;
}

.map-row {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 240px);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.map-row:last-child {
  margin-bottom: 0;
}

.map-target-label {
  font-size: 13px;
  color: var(--color-text);
}

.map-slot {
  height: 34px;
  width: 100%;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-bg-page);
  color: var(--color-text);
  font-size: 12px;
  text-align: left;
  padding: 0 10px;
}

/* Activity stream */
.activity-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 16px;
  box-shadow: var(--shadow-card);
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.activity-list li {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding: 10px 0;
  font-size: 13px;
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-list strong {
  text-transform: capitalize;
}

.activity-list small {
  color: var(--color-text-muted);
}

.btn--xs {
  padding: 6px 10px;
  font-size: 12px;
}

.run-actions {
  display: inline-flex;
  gap: 6px;
}

.entity-link {
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.entity-link:hover {
  border-bottom-color: var(--color-border-strong);
}

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

.pagination-pages {
  display: inline-flex;
  gap: 6px;
}

.pagination-page {
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination-page.is-active {
  background: var(--color-text);
  color: var(--color-surface);
  border-color: var(--color-text);
}

.is-disabled {
  pointer-events: none;
  opacity: 0.5;
}

.detail-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 16px;
}

.detail-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

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

.detail-form input,
.detail-form select {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
}

.detail-form input:disabled {
  background: var(--color-bg-page);
}

.detail-actions {
  margin-top: 14px;
}

.detail-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.detail-side-stack {
  display: grid;
  gap: 16px;
}

.detail-card--compact {
  padding: 16px;
}

.pref-list {
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.pref-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

.pref-list div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pref-list dt {
  font-size: 13px;
  color: var(--color-text-muted);
}

.pref-list dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.is-clickable-row {
  cursor: pointer;
}

.is-clickable-row:hover {
  background: var(--color-bg-page);
}

.side-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 12, 21, 0.35);
  z-index: 190;
}

.side-modal-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: max(1000px, 50vw);
  max-width: 100%;
  height: 100vh;
  overflow: auto;
  background: var(--color-bg-page);
  border-left: 1px solid var(--color-border);
  z-index: 200;
  padding: 20px;
}

.modal-fade-enter,
.modal-fade-leave {
  transition: opacity 0.18s ease;
}

.modal-fade-enter-start,
.modal-fade-leave-end {
  opacity: 0;
}

.modal-fade-enter-end,
.modal-fade-leave-start {
  opacity: 1;
}

.modal-panel-enter,
.modal-panel-leave {
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.modal-panel-enter-start,
.modal-panel-leave-end {
  transform: translateX(20px);
  opacity: 0;
}

.modal-panel-enter-end,
.modal-panel-leave-start {
  transform: translateX(0);
  opacity: 1;
}

.side-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.side-modal-body {
  display: grid;
  gap: 14px;
}

.mini-line-chart-wrap {
  width: 100%;
  height: 140px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  padding: 10px;
  position: relative;
}

.mini-line-chart {
  width: 100%;
  height: 100%;
  color: var(--color-primary-accent);
  overflow: visible;
}

.mini-bars {
  width: 100%;
  height: 160px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  padding: 10px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  position: relative;
}

.mini-bar-col {
  flex: 1;
  min-width: 6px;
  display: flex;
  align-items: flex-end;
}

.mini-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: var(--color-secondary-accent);
}

.mini-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  .import-grid,
  .mapping-workbench {
    grid-template-columns: 1fr;
  }

  .map-row {
    grid-template-columns: 1fr;
  }

  .activity-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-two-col {
    grid-template-columns: 1fr;
  }

  .side-modal-panel {
    width: 100vw;
  }
}

/* Customer notes */
.notes-card {
  margin-top: 16px;
}

.notes-empty {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 12px 0;
}

.notes-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.notes-item {
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
}

.notes-item:last-child {
  border-bottom: none;
}

.notes-item__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.notes-item__author {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.notes-item__date {
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-bg-page);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.notes-item__text {
  font-size: 13px;
  color: var(--color-text);
  margin: 0 0 4px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.notes-item__ts {
  font-size: 11px;
  color: var(--color-text-muted);
}

.notes-form-wrap {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.notes-form-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--color-text);
}

.notes-form-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
  margin-bottom: 12px;
}

.notes-form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.notes-form-input {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
}

.notes-form-input:disabled {
  background: var(--color-bg-page);
  opacity: 0.7;
}

.notes-form-textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.5;
}

.notes-form-textarea:focus,
.notes-form-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

@media (max-width: 600px) {
  .notes-form-row {
    grid-template-columns: 1fr;
  }
}
