/* ============================================================
   Tab 02 - Trend Analysis (Revenue Growth Rates)
   DocuSign FBT - light theme finance BI prototype
   ============================================================ */

:root {
  --cobalt: #4C00FF;
  --cobalt-dark: #3D00CC;
  --lavender: #F5F3FF;
  --inkwell: #000000;
  --red: #FF5252;
  --green: #1D9E75;
  --muted: #5A5A5A;
  --hairline: #E8E8E8;

  --bg: #FAFAFB;
  --surface: #FFFFFF;
  --shadow: 0 1px 3px rgba(16, 0, 64, 0.06), 0 1px 2px rgba(16, 0, 64, 0.04);
  --shadow-lg: 0 6px 24px rgba(16, 0, 64, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--inkwell);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0;
  max-width: none;
}

/* ============================ APP SHELL (left sidebar + main) ============================ */
/* A full-height lavender "rail" is painted by the shell so the sidebar reads as
   a full-height pane even though its (sticky) content can be shorter. */
.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  background: linear-gradient(to right,
    var(--lavender) 0, var(--lavender) 267px,
    var(--hairline) 267px, var(--hairline) 268px,
    #FFFFFF 268px);
}
.sidebar {
  flex: 0 0 268px;
  width: 268px;
  background: transparent;
  padding: 18px 18px 40px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}
.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 28px 48px;
}

.apply-btn {
  width: 100%;
  background: var(--cobalt);
  color: #fff;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 18px;
  transition: background 0.15s ease;
}
.apply-btn:hover { background: var(--cobalt-dark); }

.sidebar .control-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.sidebar .select { width: 100%; min-width: 0; background: #fff; }
.sidebar .control-label { color: var(--inkwell); }

.sidebar-divider { height: 1px; background: var(--hairline); margin: 18px 0 14px; }
.sidebar-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--cobalt); margin-bottom: 12px;
}

/* ============================ HEADER ============================ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 18px;
  gap: 24px;
}
.header-left { display: flex; align-items: center; gap: 16px; }

.wordmark-img {
  height: 26px;
  width: auto;
  display: block;
}

.fbt-logo {
  height: 30px;
  width: auto;
  display: block;
}
.title-block { padding-left: 8px; border-left: 1px solid var(--hairline); }
.tab-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.tab-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.header-right { text-align: right; }
.data-as-of { font-size: 13px; color: var(--muted); }
.data-as-of strong { color: var(--inkwell); }
.disclaimer {
  font-size: 11px; color: var(--muted);
  margin-top: 4px; font-style: italic;
}

/* ============================ TAB NAV ============================ */
.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2px 2px 0;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--hairline);
}
.nav-item,
.nav-item:link,
.nav-item:visited,
.nav-item:active {
  color: var(--inkwell);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.2;
  padding: 8px 2px;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.15s ease;
}
.nav-item:hover { color: var(--cobalt); }
.nav-item .nav-num { color: var(--cobalt); font-weight: 700; margin-right: 0.4rem; }
.nav-item.nav-item-selected {
  font-weight: 700;
  border-bottom: 2px solid var(--cobalt);
  padding-bottom: 6px;
}
.nav-item.nav-item-disabled,
.nav-item.nav-item-disabled:hover {
  color: #B8B8B8;
  cursor: default;
  pointer-events: none;
}
.nav-item.nav-item-disabled .nav-num { color: #B8B8B8; }

/* ============================ CONTROLS ============================ */
.controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.option-flag {
  align-self: center;
  color: #9a9a9a;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  margin-right: 10px;
}
.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.control-divider { width: 1px; align-self: stretch; background: var(--hairline); margin: 4px 0; }
/* forces the filter group onto its own row within the flex controls bar */
.controls-break { flex-basis: 100%; height: 0; margin: 0; }
.controls .filters-label {
  flex-basis: 100%; margin: 6px 0 -2px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted);
}

.segmented {
  display: inline-flex;
  background: var(--lavender);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--cobalt-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg-btn:hover { background: rgba(76, 0, 255, 0.08); }
.seg-btn.active {
  background: var(--cobalt);
  color: #fff;
  box-shadow: 0 1px 4px rgba(76, 0, 255, 0.35);
}
.seg-btn:disabled,
.seg-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.seg-btn:disabled:hover,
.seg-btn.disabled:hover { background: transparent; }

.select {
  font-family: inherit;
  font-size: 13px;
  color: var(--inkwell);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-width: 140px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.select:hover { border-color: #c9c4e6; }
.select:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(76, 0, 255, 0.12); }
.select.presentational { color: var(--muted); background: #fbfbfd; cursor: not-allowed; opacity: 0.85; }

/* ============================ KPI STRIP ============================ */
.kpi-section { margin-bottom: 22px; }
.kpi-section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 10px;
}
.kpi-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--cobalt); background: var(--lavender);
  padding: 3px 8px; border-radius: 5px;
}
.kpi-context { font-size: 12px; color: var(--muted); }

.kpi-strip { display: block; }

/* single combined stat - headline % + $ change + the actual movement */
.kpi-hero {
  display: inline-block;
  min-width: 360px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--cobalt);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 22px 18px;
}
.kpi-hero-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted);
}
.kpi-hero-basis {
  margin-left: 8px; color: #9a9a9a; font-weight: 500; text-transform: none; letter-spacing: 0;
}
.kpi-hero-row { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 7px; }
.kpi-hero-pct {
  font-size: 36px; font-weight: 700; letter-spacing: -1px; line-height: 1;
  display: inline-flex; align-items: center; gap: 6px;
}
.kpi-hero-pct .kpi-arrow { font-size: 22px; }
.kpi-hero-dol { font-size: 18px; font-weight: 600; }
.kpi-hero-move {
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.move-amt { color: var(--inkwell); font-weight: 600; }
.move-period { color: #9a9a9a; font-size: 11px; }
.move-arrow { color: var(--cobalt); font-weight: 700; margin: 0 4px; }
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi-tile.headline { border-top: 3px solid var(--cobalt); }
.kpi-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted);
}
.kpi-value {
  font-size: 26px; font-weight: 700; letter-spacing: -0.5px;
  margin-top: 8px; display: flex; align-items: center; gap: 6px;
}
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.kpi-arrow { font-size: 18px; line-height: 1; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ============================ PANELS ============================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.panel-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.panel-title.subordinate { font-size: 14px; color: var(--muted); }
.secondary-tag {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); background: #f1f1f4; padding: 2px 7px; border-radius: 4px;
  margin-left: 6px; vertical-align: middle;
}
.panel-sub { margin: 5px 0 0; font-size: 12px; color: var(--muted); max-width: 760px; }
.panel-sub strong { color: var(--inkwell); font-weight: 600; }
.basis-chip {
  flex-shrink: 0;
  font-size: 11px; font-weight: 600;
  color: var(--cobalt-dark); background: var(--lavender);
  padding: 5px 11px; border-radius: 20px; white-space: nowrap;
}
.basis-chip strong { color: var(--inkwell); }

.hero-panel { border-top: 3px solid var(--cobalt); }
.chart-wrap { position: relative; width: 100%; }
.total-chart-wrap { height: 400px; }
.source-chart-wrap { height: 380px; }

/* ============================ TABLES ============================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.table-wrap.collapsed { display: none; }

table.pivot {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  /* fixed layout so every .pivot table shares identical column widths and the
     Product Line and Business Source tables line up column-for-column */
  table-layout: fixed;
}
table.pivot td.col-label { overflow: hidden; text-overflow: ellipsis; }
.period-col { white-space: nowrap; }
/* in-between periods are muted historical context */
.hist-col { color: #aeaeae; font-weight: 400; }
/* boxed Current / Comparison columns draw the eye to the compared pair */
.box-col {
  background: rgba(76, 0, 255, 0.06);
  border-left: 2px solid var(--cobalt);
  border-right: 2px solid var(--cobalt);
  color: var(--inkwell);
  font-weight: 600;
}
table.pivot thead th.box-col { border-top: 2px solid var(--cobalt); }
table.pivot tfoot td.box-col { border-bottom: 2px solid var(--cobalt); }
.col-tag {
  display: block; font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--cobalt); margin-bottom: 3px;
}
.col-tag-cmp { color: var(--muted); }
table.pivot thead th {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted);
  text-align: right;
  padding: 10px 14px;
  border-bottom: 2px solid var(--hairline);
  white-space: nowrap;
  background: #fbfbfd;
  position: sticky; top: 0;
}
table.pivot thead th.col-label { text-align: left; }
.th-sub { font-weight: 400; text-transform: none; letter-spacing: 0; color: #9a9a9a; font-size: 10px; }
table.pivot tbody td {
  padding: 9px 14px;
  text-align: right;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.pivot td.col-label { text-align: left; }

.row-line { cursor: pointer; }
.row-line:hover { background: var(--lavender); }
.row-line td { font-weight: 600; }
.row-line .chev {
  display: inline-block; width: 14px; color: var(--cobalt);
  transition: transform 0.15s ease; font-size: 10px;
}
.row-line.expanded .chev { transform: rotate(90deg); }

.row-group { background: #fff; }
.row-group:hover { background: #fafaff; }
.row-group td.col-label { padding-left: 38px; color: var(--muted); font-weight: 400; }
.row-group.hidden { display: none; }

tfoot td {
  padding: 11px 14px;
  text-align: right;
  font-weight: 700;
  border-top: 2px solid var(--hairline);
  background: #fbfbfd;
}
tfoot td.col-label { text-align: left; }

.delta-pos { color: var(--green); font-weight: 600; }
.delta-neg { color: var(--red); font-weight: 600; }
.delta-na { color: #bbb; }

/* numeric column alignment - keep headers and values on the same right edge */
table.pivot th.num, table.pivot td.num { text-align: right; }
table.pivot .col-rev { min-width: 132px; }
table.pivot .col-delta { min-width: 76px; }
.dist-cell { white-space: nowrap; }
.dist-bar {
  display: inline-block; height: 6px; border-radius: 3px;
  background: rgba(76, 0, 255, 0.22); vertical-align: middle; margin-right: 8px;
}
.dist-num { display: inline-block; min-width: 48px; text-align: right; }

/* collapsible data table */
.collapse-toggle {
  width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--inkwell);
  padding: 0; display: flex; align-items: center; gap: 8px;
}
.collapse-toggle .chev { color: var(--cobalt); transition: transform 0.15s ease; display: inline-block; }
.collapse-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.data-pivot { margin-top: 16px; }
.data-pivot thead th:first-child, .data-pivot tbody td:first-child { text-align: left; position: sticky; left: 0; background: #fbfbfd; }
.data-pivot tbody tr.grand td { font-weight: 700; background: var(--lavender); }

/* ============================ FOOTER ============================ */
.app-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 11px; color: var(--muted);
  padding-top: 18px; margin-top: 8px;
  border-top: 1px solid var(--hairline);
}

/* tooltip cell hover affordance */
td[data-tip] { cursor: help; }
