@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f0f2f5;
  -webkit-font-smoothing: antialiased
}

/* ── Drawer overrides ── */
.forecast-drawer .ant-drawer-header {
  padding: 10px 12px 4px;
  border-bottom: none;
  min-height: 0
}

.forecast-drawer .ant-drawer-body {
  padding: 0;
  background: #fafafa;
  overflow-y: auto
}

.forecast-drawer .ant-drawer-header-title {
  flex-direction: row-reverse
}

/* ── Inner layout ── */
.fc-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%
}

/* Sub-header */
.fc-subheader {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 10px 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px
}

.fc-sh-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0
}

.fc-sh-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8c8c8c;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0
}

.fc-sh-title {
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.fc-header-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.fc-sh-meta {
  display: flex;
  gap: 8px;
  margin-top: 1px;
  font-size: .72rem;
  color: #8c8c8c;
  flex-wrap: wrap;
  align-items: center
}

.fc-sh-meta strong {
  color: #262626;
  font-weight: 600
}

.fc-sh-right {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0
}

/* Content grid */
.fc-content {
  display: flex;
  gap: 16px;
  padding: 16px 24px 40px;
  flex: 1;
  min-height: 0
}

/* Sidebar column for inspector widgets (desktop) */
.fc-sidebar {
  width: 100%;
  flex-shrink: 0;
}

@media (min-width: 901px) {
  .fc-sidebar {
    width: 380px;
    align-self: flex-start;
    position: sticky;
    top: 72px;
  }
}

.fc-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px
}

/* Inspector widget layout inside sidebar */
.fc-inspector-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fc-inspector-pills {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 8px;
  padding-top: 2px;
  background: linear-gradient(#fafafa 75%, rgba(250, 250, 250, 0));
}

.fc-inspector-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

@media (min-width: 901px) {
  .fc-inspector-scroll {
    max-height: calc(100vh - 72px - 24px);
    overflow-y: auto;
    /* Hide scrollbar while keeping scroll behavior */
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge legacy */
  }

  .fc-inspector-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
}

.fc-inspector {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.fc-inspector.is-collapsed {
  width: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

/* Summary strip */
.fc-summary-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.fc-summary-cards {
  display: flex;
  gap: 8px;
  flex: 1;
}

.fc-kpi {
  flex: 0 1 auto;
  min-width: 80px;
  padding: 4px 8px;
}

.fc-kpi-label {
  font-size: .6rem;
  font-weight: 600;
  color: #bfbfbf;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1
}

.fc-kpi-value {
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 3px;
  color: #262626
}

.fc-kpi-sub {
  font-size: .6rem;
  color: #bfbfbf;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

/* Comment Timeline */
.fc-comment-timeline {
  flex: 2 1 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  min-width: 0;
  min-height: 54px
}

.fc-ct-dots {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 2px 0;
  flex-shrink: 0
}

.fc-ct-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #d9d9d9;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s
}

.fc-ct-dot.active {
  border-color: #5b63d3;
  background: #5b63d3;
  box-shadow: 0 0 0 2px rgba(91, 99, 211, 0.2)
}

.fc-ct-dot.pinned {
  border-color: #faad14;
}

.fc-ct-dot.more {
  width: 4px;
  height: 4px;
  border-width: 1px;
  opacity: 0.4;
  margin: 0 auto;
  cursor: pointer;
}

.fc-ct-dot.more:hover {
  opacity: 0.8;
}

.fc-ct-dot:hover:not(.active):not(.more) {
  border-color: #8c8c8c
}

.fc-ct-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px
}

.fc-ct-text {
  font-size: .75rem;
  color: #262626;
  font-weight: 600;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical
}

.fc-ct-meta {
  font-size: .65rem;
  color: #8c8c8c;
  display: flex;
  gap: 8px
}

.fc-ct-author {
  font-weight: 600;
  color: #5b63d3
}

.fc-ct-date {
  color: #bfbfbf
}

.fc-ct-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0
}

/* PO stats desktop alignment */
.fc-po-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* PO timeline */
.fc-po-timeline {
  position: relative;
  padding-left: 18px
}

.fc-po-timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  bottom: 14px;
  width: 1px;
  background: #e1e4e8;
}

.fc-po-item {
  position: relative;
  /* margin-bottom to separate dots slightly with the line */
}

.fc-po-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 6px 0;
  gap: 8px;
  min-height: 28px;
}

.fc-po-row::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 2px solid #52c41a;
  background: #fff;
  z-index: 1;
}

.fc-po-item.s-confirmed .fc-po-row::before {
  border-color: #52c41a;
  background: #f6ffed;
}

.fc-po-item.s-intransit .fc-po-row::before {
  border-color: #1677ff;
  background: #e6f4ff;
}

/* PO title layout (name + status) */
.fc-po-title {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.fc-po-stat {
  text-align: right;
  min-width: 60px
}

.fc-po-stat-label {
  font-size: .56rem;
  color: #bfbfbf;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: .03em
}

.fc-po-stat-val {
  font-weight: 700;
  font-size: .8rem;
  color: #262626
}

.fc-po-drawer {
  animation: slideDown .15s ease
}

.fc-alloc-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  padding: 8px;
  background: #fafafa;
  border-radius: 4px
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-4px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

/* Sales table */
.fc-sales-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px
}

.fc-project-chips {
  display: flex;
  gap: 3px;
  flex-wrap: wrap
}

.fc-project-chips .ant-tag {
  cursor: pointer;
  user-select: none;
  font-size: .7rem;
  line-height: 1.4
}

/* Sales metric pills */
.fc-sales-metrics {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.fc-sales-wrap {
  overflow-x: auto
}

.fc-sales-wrap .ant-table {
  font-size: .72rem
}

.fc-sales-wrap .ant-table-thead>tr>th {
  font-size: .6rem;
  padding: 6px 7px !important;
  white-space: nowrap;
  background: #fafafa !important
}

.fc-sales-wrap .ant-table-tbody>tr>td {
  padding: 5px 7px !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: cell;
  transition: background 0.1s
}

/* ── Layered Cell Background System ── */
.fc-sales-wrap .ant-table-tbody>tr>td {
  --fc-tint-bg: transparent;
  --fc-highlight-bg: transparent;
  background: linear-gradient(var(--fc-highlight-bg), var(--fc-highlight-bg)), linear-gradient(var(--fc-tint-bg), var(--fc-tint-bg)), #fff !important;
}

.fc-sales-wrap .ant-table-tbody>tr:hover>td {
  background: linear-gradient(var(--fc-highlight-bg), var(--fc-highlight-bg)), linear-gradient(var(--fc-tint-bg), var(--fc-tint-bg)), #f5f5f5 !important;
}

.fc-sales-wrap .ant-table-thead>tr>th {
  --fc-tint-bg: transparent;
  --fc-highlight-bg: transparent;
  background: linear-gradient(var(--fc-highlight-bg), var(--fc-highlight-bg)), linear-gradient(var(--fc-tint-bg), var(--fc-tint-bg)), #fafafa !important;
}

/* 1. Project Column Colors */
.fc-sales-wrap .ant-table-thead>tr>th.fc-proj-PG,
.fc-sales-wrap .ant-table-tbody>tr>td.fc-proj-PG {
  --fc-tint-bg: rgba(99, 102, 241, 0.06);
}

.fc-sales-wrap .ant-table-thead>tr>th.fc-proj-AZ,
.fc-sales-wrap .ant-table-tbody>tr>td.fc-proj-AZ {
  --fc-tint-bg: rgba(234, 88, 12, 0.06);
}

.fc-sales-wrap .ant-table-thead>tr>th.fc-proj-AMAZON,
.fc-sales-wrap .ant-table-tbody>tr>td.fc-proj-AMAZON {
  --fc-tint-bg: rgba(8, 145, 178, 0.06);
}

.fc-sales-wrap .ant-table-thead>tr>th.fc-proj-FRG,
.fc-sales-wrap .ant-table-tbody>tr>td.fc-proj-FRG {
  --fc-tint-bg: rgba(5, 150, 105, 0.06);
}

.fc-sales-wrap .ant-table-thead>tr>th.fc-proj-VAYA,
.fc-sales-wrap .ant-table-tbody>tr>td.fc-proj-VAYA {
  --fc-tint-bg: rgba(219, 39, 119, 0.06);
}

.fc-sales-wrap .ant-table-thead>tr>th.fc-proj-WHS,
.fc-sales-wrap .ant-table-tbody>tr>td.fc-proj-WHS {
  --fc-tint-bg: rgba(124, 58, 237, 0.06);
}

/* 2. Enhanced Hovers */
.fc-sales-wrap .ant-table-tbody>tr:hover>td.fc-proj-PG {
  --fc-tint-bg: rgba(99, 102, 241, 0.1);
}

.fc-sales-wrap .ant-table-tbody>tr:hover>td.fc-proj-AZ {
  --fc-tint-bg: rgba(234, 88, 12, 0.1);
}

.fc-sales-wrap .ant-table-tbody>tr:hover>td.fc-proj-AMAZON {
  --fc-tint-bg: rgba(8, 145, 178, 0.1);
}

.fc-sales-wrap .ant-table-tbody>tr:hover>td.fc-proj-FRG {
  --fc-tint-bg: rgba(5, 150, 105, 0.1);
}

.fc-sales-wrap .ant-table-tbody>tr:hover>td.fc-proj-VAYA {
  --fc-tint-bg: rgba(219, 39, 119, 0.1);
}

.fc-sales-wrap .ant-table-tbody>tr:hover>td.fc-proj-WHS {
  --fc-tint-bg: rgba(124, 58, 237, 0.1);
}

/* 3. Excel-like Focus (Crosshairs layer over the tint) */
.fc-sales-wrap .ant-table-tbody>tr.fc-row-highlight>td {
  --fc-highlight-bg: rgba(91, 99, 211, 0.05);
}

.fc-sales-wrap .ant-table-tbody>tr>td.fc-col-highlight,
.fc-sales-wrap .ant-table-thead>tr>th.fc-col-highlight {
  --fc-highlight-bg: rgba(91, 99, 211, 0.05);
}

.fc-sales-wrap .ant-table-tbody>tr>td.fc-cell-active,
.fc-sales-wrap .ant-table-tbody>tr:hover>td.fc-cell-active {
  --fc-highlight-bg: rgba(91, 99, 211, 0.22);
  box-shadow: inset 0 0 0 1px #5b63d3 !important;
  color: #111 !important;
  font-weight: 600 !important;
}

/* ── Detachable / Draggable ── */
.fc-drag-handle {
  cursor: grab;
  color: #bfbfbf;
  margin-right: 8px;
  user-select: none;
}

.fc-drag-handle:active {
  cursor: grabbing;
}

.js-draggable-card {
  position: fixed !important;
  z-index: 2000 !important;
  width: 380px !important;
  box-shadow: 0 8px 24px rgba(91, 99, 211, 0.2) !important;
  border: 1px solid #5b63d3 !important;
  pointer-events: auto !important;
  background: #fff !important;
}

.fc-detached-wrapper {
  pointer-events: auto !important;
  cursor: default;
}

.fc-detached-wrapper>.fc-is-detached {
  box-shadow:
    0 40px 120px rgba(50, 60, 180, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6) !important;
  border: 2px solid #4349ab !important;
  border-radius: 12px !important;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.99) !important;
  backdrop-filter: blur(20px);
}

.fc-is-detached .ant-card-head {
  cursor: grab !important;
  background: linear-gradient(135deg, #f8f9ff 0%, #ecefff 100%) !important;
  border-bottom: 1px solid #d1d9ff !important;
  padding: 4px 10px !important;
  height: 40px !important;
  min-height: 40px !important;
  display: flex !important;
  align-items: center !important;
}

.fc-is-detached .ant-card-body {
  padding: 8px 10px 10px !important;
}

.fc-is-detached .ant-card-head-title {
  padding: 2px 0 !important;
  font-size: .7rem !important;
}

.fc-is-detached .ant-card-head:active {
  cursor: grabbing !important;
}

.fc-is-detached .ant-card-head-title {
  font-weight: 700 !important;
  color: #1a2b5d !important;
}

/* Sidebar widget hover state to indicate draggability */
.fc-inspector .fc-insp-card:hover {
  border-color: #d6e4ff;
}

/* Inspector cards */

.fc-insp-card .ant-card-head {
  min-height: 32px;
  padding: 0 12px;
  font-size: .76rem
}

.fc-insp-card .ant-card-head-title {
  font-size: .76rem;
  font-weight: 600;
  padding: 7px 0
}

.fc-insp-card .ant-card-body {
  padding: 8px 12px 12px !important
}

.fc-insp-card .ant-card-extra {
  padding: 7px 0
}

.fc-insp-card .ant-table {
  font-size: .72rem
}

.fc-insp-card .ant-table-thead>tr>th {
  font-size: .58rem;
  padding: 5px 6px !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: #fafafa !important
}

.fc-insp-card .ant-table-tbody>tr>td {
  padding: 5px 6px !important
}

/* Pin toolbar */
.fc-pin-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px
}

.fc-pin-bar .ant-tag {
  cursor: pointer;
  user-select: none;
  font-size: .68rem;
  border-radius: 4px
}

/* Profit grid */
.fc-profit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  text-align: center;
  margin-bottom: 12px
}

.fc-profit-cell {
  padding: 7px;
  background: #fafafa;
  border-radius: 6px;
  border: 1px solid #f0f0f0
}

.fc-profit-cell .label {
  font-size: .56rem;
  color: #bfbfbf;
  text-transform: uppercase;
  font-weight: 600
}

.fc-profit-cell .val {
  font-size: .88rem;
}

/* Idealo "our position" row */
.fc-idealo-ours td {
  background: #f0f5ff !important;
  font-weight: 700;
}

/* Marketplace pricing grid */
.fc-mp-grid {
  overflow-x: auto;
}

.fc-mp-grid table td {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin-top: 2px
}

/* ── Trigger page ── */
.trigger-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 16px
}

.trigger-page h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #595959
}

.trigger-page p {
  color: #8c8c8c;
  font-size: .82rem
}

/* Responsive */
@media(max-width:900px) {
  .fc-content {
    flex-direction: column;
    padding: 12px 14px 80px
  }

  /* Header Reorganization */
  .fc-subheader {
    flex-direction: column;
    align-items: stretch !important;
    gap: 16px !important;
  }

  .fc-sh-left {
    align-items: stretch !important;
  }

  /* Mobile header: app-like stacking */
  .fc-sh-left > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .fc-sh-title {
    font-size: .98rem;
    line-height: 1.25;
  }

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

  .fc-sh-meta .ant-divider-vertical {
    display: none;
  }

  .fc-sh-right {
    justify-content: flex-start;
    width: 100%;
  }

  .fc-sh-right .ant-btn {
    flex: 1;
  }

  .fc-sh-right .ant-btn-icon-only {
    flex: 0;
  }

  /* "View" popover: stack sections vertically */
  .fc-view-pop {
    flex-direction: column !important;
    gap: 16px !important;
    max-width: 80vw;
  }

  .fc-view-pop > div {
    width: 100% !important;
  }

  /* Summary & KPI Cards — fit in one row */
  .fc-summary-group {
    width: 100%;
  }

  .fc-summary-cards {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .fc-kpi {
    min-width: 0;
    padding: 2px 4px;
    text-align: left;
  }

  .fc-kpi-label {
    font-size: .55rem;
  }

  .fc-kpi-value {
    font-size: .8rem;
  }

  .fc-kpi-sub {
    font-size: .55rem;
  }

  .fc-comment-timeline {
    width: 100%;
    flex: 1 1 100%;
    order: 10;
    min-width: 0;
  }

  /* Sales Performance filters / toggles */
  .fc-sales-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .fc-project-chips {
    display: none;
  }

  .fc-sales-bar .ant-space {
    width: 100%;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 8px;
  }

  .fc-sales-metrics {
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fc-sales-bar .ant-divider-vertical {
    display: none;
  }

  .fc-sales-bar .ant-segmented {
    align-self: flex-start;
  }

  /* PO Layout Fix — Restore single row stats */
  .fc-po-row {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 10px 0;
  }

  .fc-po-stats {
    display: flex !important;
    flex-direction: row !important;
    width: auto !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end;
    gap: 12px !important;
  }

  .fc-po-stat {
    flex: 0 0 auto;
    min-width: 50px;
    text-align: center;
  }

  .fc-po-stat-label {
    font-size: .55rem !important;
  }

  /* Stack PO title on small screens for more KPI space */
  .fc-po-title {
    flex-direction: column;
    align-items: flex-start;
    white-space: normal;
    gap: 4px;
  }

  /* Tables in cards */
  .ant-card-body {
    overflow-x: auto;
  }

  /* Detached widgets sizing */
  .fc-detached-wrapper {
    width: 90vw !important;
    left: 5vw !important;
    right: auto !important;
  }
}