/* Partner Sync Dashboard — styles ported 1:1 from design/Partner Sync Dashboard.dc.html
   (Constitution Principle I: palette/type/thresholds as actually implemented there). */

* { box-sizing: border-box; }

::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-thumb { background: #CDD8D2; border-radius: 8px; border: 2px solid #F0F3F1; }
::-webkit-scrollbar-track { background: transparent; }

a { color: #157552; }
a:hover { color: #0E5138; }

body {
  margin: 0;
  font-family: 'Zen Kaku Gothic New', Arial, Helvetica, sans-serif;
  background: #F0F3F1;
  color: #14231C;
  -webkit-font-smoothing: antialiased;
}

.page { min-height: 100vh; padding: 26px 26px 40px; }
.shell { max-width: 1200px; margin: 0 auto; }

.hidden { display: none !important; }
.muted { color: #8A938E; }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark { width: 52px; height: 52px; border-radius: 14px; background: #fff; border: 1px solid #E2E8E5; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(20,35,28,.05); }
.brand-mark img { width: 30px; height: auto; display: block; }
.brand-title { font-family: 'Sora', Arial, Helvetica, sans-serif; font-size: 21px; font-weight: 800; letter-spacing: -.4px; margin: 0; line-height: 1.1; }
.brand-sub { font-size: 12px; color: #5C6970; margin: 3px 0 0; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.last-update { text-align: right; margin-right: 2px; }
.last-update-label { font-size: 10.5px; color: #8A938E; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.last-update-value { font-size: 12.5px; color: #14231C; font-weight: 700; }

/* Buttons */
.btn-outline {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 12px;
  border: 1px solid #E2E8E5; background: #fff; color: #14231C; font: inherit; font-size: 12.5px;
  font-weight: 700; cursor: pointer; transition: .18s;
}
.btn-outline:hover { background: #14231C; color: #fff; border-color: #14231C; }
.badge-estimation {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; background: #FFF4E5;
  border: 1px solid #F2D9AE; border-radius: 20px; font-size: 11px; font-weight: 700; color: #9A6512;
}

/* Rows / pills */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.controls-row { margin-bottom: 16px; }
.pillbar { display: flex; border: 1px solid #E2E8E5; border-radius: 12px; overflow: hidden; background: #fff; }
.divider { width: 1px; height: 22px; background: #DCE3DF; }
.view-caption { font-size: 11px; color: #8A938E; font-weight: 600; }
.pillbar-sm { border-radius: 11px; }
.pill {
  padding: 8px 15px; font-size: 12.5px; font-weight: 700; font-family: inherit; border: none;
  cursor: pointer; transition: .18s; white-space: nowrap; background: transparent; color: #6B7772;
}
.pill.pill-sm { padding: 7px 13px; font-size: 12px; }
.pill.active { background: #1E3A2E; color: #fff; }

/* KPI */
.kpi-header-row { align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.kpi-title { font-size: 12.5px; font-weight: 800; letter-spacing: .3px; color: #14231C; text-transform: uppercase; }
.kpi-caption { font-size: 11px; color: #8A938E; font-weight: 600; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi-card {
  position: relative; text-align: left; border: 1px solid #E2E8E5; background: #fff; border-radius: 16px;
  padding: 15px 15px 12px; cursor: pointer; overflow: hidden; font: inherit; box-shadow: 0 1px 2px rgba(20,35,28,.04);
  transition: opacity .28s ease, box-shadow .2s, border-color .2s;
}
.kpi-card:hover { box-shadow: 0 6px 20px rgba(20,35,28,.10); }
.kpi-card.dim { opacity: .42; }
.kpi-top-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.kpi-label-row { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 9px; min-height: 28px; }
.kpi-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; margin-top: 3px; }
.kpi-label { font-size: 12px; font-weight: 800; color: #14231C; line-height: 1.25; }
.kpi-value { font-size: 23px; font-weight: 800; letter-spacing: -.5px; color: #14231C; line-height: 1.1; }
.kpi-delta-row { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.kpi-delta { font-size: 11px; font-weight: 800; }
.kpi-avg { font-size: 10.5px; color: #8A938E; font-weight: 600; }

/* Dropdown menus (export / category / search) */
.menu-anchor, .search-anchor { position: relative; }
.search-anchor { flex: 1; min-width: 220px; }
.dropdown {
  position: absolute; top: calc(100% + 6px); background: #fff; border: 1px solid #E2E8E5; border-radius: 12px;
  box-shadow: 0 12px 34px rgba(20,35,28,.16); z-index: 50; padding: 5px;
}
.dropdown-export { right: 0; min-width: 250px; }
.dropdown-category { left: 0; width: 380px; max-height: 420px; overflow-y: auto; z-index: 45; }
.dropdown-search { left: 0; right: 0; max-height: 280px; overflow-y: auto; z-index: 40; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px;
  border: none; background: none; font: inherit; font-size: 12.5px; color: #14231C; font-weight: 600;
  cursor: pointer; border-radius: 8px;
}
.dropdown-item:hover { background: #F1F5F3; }
.dropdown-item.between { justify-content: space-between; }
.dropdown-item.search-result { flex-direction: column; align-items: flex-start; gap: 1px; }
.dropdown-dot { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.dropdown-sep { height: 1px; background: #EEF2F0; margin: 4px 6px; }

.category-row { display: flex; align-items: center; border-radius: 8px; }
.category-row:hover { background: #F8FAF9; }
.category-name-btn { flex: 1; text-align: left; padding: 9px 4px 9px 12px; border: none; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: #14231C; cursor: pointer; }
.category-count { font-size: 11px; color: #8A938E; font-weight: 600; padding-right: 4px; }
.category-toggle-btn { padding: 9px 12px 9px 4px; border: none; background: none; cursor: pointer; display: flex; align-items: center; }
.category-chevron { display: inline-block; transition: transform .2s; color: #8A938E; font-size: 12px; line-height: 1; }
.category-segments { padding: 2px 4px 6px 20px; display: flex; flex-direction: column; gap: 1px; }
.segment-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 6px 10px; border: none; background: none; font: inherit; font-size: 12px; font-weight: 600; color: #14231C; cursor: pointer; border-radius: 7px; }
.segment-item:hover { background: #F1F5F3; }
.segment-id-chip { font-size: 10px; font-weight: 700; color: #5C6970; background: #F1F5F3; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }

.btn-select {
  display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 14px;
  border-radius: 12px; border: 1px solid #E2E8E5; background: #fff; font: inherit; font-size: 12.5px;
  font-weight: 600; color: #14231C; cursor: pointer; width: 280px; outline: none;
}
.btn-select-label { display: flex; align-items: center; gap: 9px; overflow: hidden; }
.btn-select-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { flex: none; transition: transform .18s; }
.chevron.open { transform: rotate(180deg); }

.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-input {
  width: 100%; padding: 10px 14px 10px 36px; border-radius: 12px; border: 1px solid #E2E8E5; background: #fff;
  font: inherit; font-size: 12.5px; color: #14231C; outline: none; box-sizing: border-box;
}
.search-result-title { font-size: 12.5px; font-weight: 700; color: #14231C; }
.search-result-sub { font-size: 10.5px; font-weight: 600; color: #8A938E; }

/* Evolution card */
.card { background: #fff; border: 1px solid #E2E8E5; border-radius: 18px; box-shadow: 0 1px 3px rgba(20,35,28,.04); margin-bottom: 16px; }
.evolution-card { padding: 22px 22px 16px; }
.evolution-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.evolution-title { font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.evolution-subtitle { font-size: 11.5px; color: #5C6970; font-weight: 600; margin-top: 3px; }
.evolution-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.focus-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 9px; padding: 5px 6px 5px 12px; background: #EAF7F1; border: 1px solid #BFE7D4; border-radius: 20px; }
.focus-badge span { font-size: 11.5px; font-weight: 700; color: #157552; }
.focus-badge button { width: 18px; height: 18px; border-radius: 50%; border: none; background: #fff; color: #157552; font-size: 12px; font-weight: 800; cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; }
.chart-host { margin-top: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 14px; }
.legend-chip { display: flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 20px; border: 1px solid transparent; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: .18s; color: #5C6970; }
.legend-chip .swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend-chip.dim { opacity: .45; }

/* Detail table */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; max-height: 640px; overflow-y: auto; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table th {
  padding: 12px 12px; font-size: 11.5px; font-weight: 800; white-space: nowrap; cursor: pointer;
  user-select: none; position: sticky; top: 0; background: #EFF3F1; z-index: 1; border-bottom: 1px solid #E2E8E5;
}
.detail-table td { padding: 9px 16px; white-space: nowrap; }
.detail-table tbody tr { border-bottom: 1px solid #EEF2F0; }
.detail-table tbody tr:hover { background: #F6FAF8; }
.cell-id-chip { font-size: 10.5px; font-weight: 700; color: #5C6970; background: #F1F5F3; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.rate-chip { display: inline-block; min-width: 54px; padding: 3px 8px; border-radius: 20px; font-size: 12px; font-weight: 800; text-align: center; }
.rate-good { color: #157552; background: rgba(45,203,140,.14); }
.rate-mid { color: #B5751A; background: rgba(224,145,46,.16); }
.rate-bad { color: #B23A30; background: rgba(178,58,48,.12); }
.rate-missing { color: #8A938E; background: rgba(138,147,142,.10); }
.table-footer { padding: 12px 18px; font-size: 11.5px; color: #5C6970; font-weight: 600; border-top: 1px solid #EEF2F0; display: flex; justify-content: space-between; align-items: center; background: #FBFCFB; }
