/* Growth Path – OD-style design */
:root {
  --color-primary: #9D3339;
  --color-primary-dark: #82252c;
  --color-primary-light: rgba(157, 51, 57, 0.08);
  --color-accent: #C58945;
  --color-accent-light: rgba(197, 137, 69, 0.12);
  --color-bg: #F7F4EC;
  --color-bg-subtle: #f0ede4;
  --color-surface: #DCDBD3;
  --color-surface-light: #e8e7e2;
  --color-text: #1a1a1a;
  --color-text-muted: #5c5c5c;
  --color-white: #fff;
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --sidebar-width: 260px;
  --max-content: 1000px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --transition: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-primary);
  color: var(--color-white);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand .logo {
  height: 42px;
  width: auto;
  display: block;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.sidebar-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.02em;
}

.main-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-white);
}

.nav-link.active {
  background: var(--color-white);
  color: var(--color-primary);
}

.nav-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem 3rem;
  max-width: calc(100vw - var(--sidebar-width));
}

/* Sections */
.page-section {
  display: none;
  animation: sectionIn 0.25s ease;
}

.page-section.active {
  display: block;
}

@keyframes sectionIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-section h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.section-intro {
  color: var(--color-text-muted);
  margin: 0 0 1.75rem;
  max-width: 56ch;
  font-size: 0.95rem;
}

/* Tiers panel: product filter */
.tiers-controls {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tiers-controls-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.tiers-product-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  border: 1px solid var(--color-surface);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-text);
  min-width: 140px;
  cursor: pointer;
}

.tiers-product-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.tiers-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Dashboard panel */
.dashboard-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dashboard-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dashboard-control-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.dashboard-main-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 2rem;
}

.dashboard-main-table {
  min-width: 1000px;
  font-size: 0.875rem;
}

.dashboard-main-table th,
.dashboard-main-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--color-surface-light);
  white-space: nowrap;
}

.dashboard-main-table thead tr:first-child th {
  text-align: center;
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: 600;
}

.dashboard-main-table .dashboard-subhead th {
  background: var(--color-surface-light);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.8rem;
}

.dashboard-main-table .dashboard-col-entity {
  min-width: 160px;
  text-align: left;
  font-weight: 500;
  color: var(--color-text);
}

.dashboard-main-table thead tr:first-child .dashboard-col-entity {
  text-align: left;
}

.dashboard-distributions {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-dist-section {
  margin-bottom: 0;
}

.dashboard-dist-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary);
}

.dashboard-dist-chart-wrap {
  margin-bottom: 1.25rem;
  max-width: 820px;
  min-height: 380px;
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
  border: 2px solid var(--color-surface-light);
  padding: 1rem;
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.dashboard-dist-chart-wrap:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow);
}

.dashboard-dist-chart-wrap:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.dashboard-dist-chart-hint {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* Chart modal */
.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.2s ease, opacity 0.2s ease;
}

.chart-modal-open {
  visibility: visible;
  opacity: 1;
}

.chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.chart-modal-box {
  position: relative;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 95vw;
  width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-surface-light);
  background: var(--color-bg-subtle);
}

.chart-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
}

.chart-modal-close {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.chart-modal-close:hover {
  background: var(--color-surface-light);
  color: var(--color-text);
}

.chart-modal-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--color-surface-light);
  background: var(--color-white);
}

.chart-modal-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.chart-modal-select {
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  border: 1px solid var(--color-surface);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-text);
  min-width: 140px;
}

.chart-modal-canvas-wrap {
  padding: 1.25rem;
  min-height: 420px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-dist-table {
  min-width: 400px;
  font-size: 0.9rem;
}

.dashboard-dist-table th,
.dashboard-dist-table td {
  padding: 0.5rem 0.75rem;
}

/* LC Analysis panel */
.lc-analysis-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.lc-analysis-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.lc-analysis-product {
  margin-bottom: 0;
}

.lc-analysis-product-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-primary);
}

.lc-analysis-table {
  font-size: 0.875rem;
  min-width: 520px;
  margin-bottom: 1rem;
}

.lc-analysis-table:last-of-type {
  margin-bottom: 0;
}

.lc-analysis-table th,
.lc-analysis-table td {
  padding: 0.5rem 0.65rem;
  text-align: center;
}

.lc-analysis-table thead tr:first-child th {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.8rem;
}

.lc-analysis-table .lc-analysis-subhead th {
  background: var(--color-surface-light);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.75rem;
}

.lc-analysis-table tbody td:first-child {
  background: transparent;
  width: 1%;
}

.lc-analysis-empty {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

/* Growth Path panel */
.growth-path-controls {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.growth-path-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
}

.growth-path-table {
  min-width: 960px;
  font-size: 0.875rem;
}

.growth-path-table th,
.growth-path-table td {
  padding: 0.65rem 0.85rem;
  vertical-align: top;
  border-bottom: 1px solid var(--color-surface-light);
}

.growth-path-table .growth-path-col-element {
  font-weight: 600;
  color: var(--color-primary);
  min-width: 140px;
  max-width: 160px;
}

.growth-path-table td {
  white-space: pre-line;
  max-width: 280px;
  min-width: 120px;
}

/* Cards */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-surface-light);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
  border-left: 3px solid var(--color-primary);
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--color-surface);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-primary);
}

.card p {
  margin: 0;
  color: var(--color-text);
}

.tier-card .tier-criteria,
.tier-card .tier-badge {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Use Guide */
.guide-intro {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-surface-light);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  max-width: 720px;
}

.guide-intro p {
  margin: 0;
  font-size: 0.9875rem;
  line-height: 1.65;
  color: var(--color-text);
}

.guide-placeholder {
  max-width: 720px;
}

.guide-card {
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 2rem;
}

.guide-card:last-of-type {
  margin-bottom: 0;
}

.guide-card-num {
  position: absolute;
  left: 1.75rem;
  top: 1.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.guide-card h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

.guide-lead {
  margin: 0 0 1.25rem;
  color: var(--color-text);
  font-size: 0.95rem;
}

.guide-list,
.guide-list-bullets {
  margin: 0 0 0 0.5rem;
  padding-left: 1.25rem;
}

.guide-list li,
.guide-list-bullets li {
  margin-bottom: 0.4rem;
}

.guide-list li:last-child,
.guide-list-bullets li:last-child {
  margin-bottom: 0;
}

.guide-list-bullets li::marker {
  color: var(--color-accent);
}

/* Sheets (Navigate the File) */
.guide-sheets {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-sheet {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-surface-light);
}

.guide-sheet-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.guide-sheet-body h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
}

.guide-sheet-body p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text);
}

.guide-sheet-body p:last-of-type {
  margin-bottom: 0.35rem;
}

.guide-sheet-body ul {
  margin: 0;
  padding-left: 1.25rem;
}

.guide-sheet-body ul li {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

/* Steps (Use Effectively) */
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.guide-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.guide-step-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.guide-step-body strong {
  display: block;
  font-size: 0.95rem;
  color: var(--color-primary);
  margin-bottom: 0.2rem;
}

.guide-step-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.5;
}

.guide-close {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-surface-light);
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

@media (max-width: 600px) {
  .guide-card {
    padding-left: 1.75rem;
    padding-top: 2.5rem;
  }

  .guide-card-num {
    left: 1.5rem;
    top: 1.25rem;
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.9rem;
  }

  .guide-sheet {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .guide-sheet-num,
  .guide-step-num {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.6875rem;
  }
}

/* Tiers grid */
.tier-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* Growth Path timeline */
.path-container {
  padding: 1rem 0;
}

.path-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}

.path-stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 180px;
}

.path-dot {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-surface);
}

.path-label {
  font-weight: 600;
  color: var(--color-text);
}

/* Dashboard KPIs */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.kpi-card {
  text-align: center;
}

.kpi-card .kpi-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.kpi-card .kpi-label {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Data tables */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-surface-light);
}

.data-table thead th {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--color-primary-light);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.lc-table {
  min-width: 400px;
}

.table-placeholder {
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
  padding: 1.5rem !important;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    width: 220px;
    min-width: 220px;
  }

  .main-content {
    padding: 1.5rem 1.25rem;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 0;
  }

  .sidebar-brand {
    padding: 0.75rem 1rem;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
  }

  .sidebar-brand .logo {
    height: 36px;
    margin-bottom: 0;
  }

  .sidebar-title {
    display: none;
  }

  .main-nav {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
  }

  .main-content {
    margin-left: 0;
    padding: 1.25rem 1rem;
    max-width: 100%;
  }

  .page-section h1 {
    font-size: 1.5rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .path-timeline {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Print */
@media print {
  .sidebar {
    position: relative;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    box-shadow: none;
    border-bottom: 2px solid var(--color-primary);
  }

  .sidebar-brand {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
  }

  .main-nav {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .page-section {
    display: none !important;
  }

  .page-section.active {
    display: block !important;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid var(--color-surface);
  }
}
