/* new */
html, body {
  overflow-x: hidden;
}

* {
  word-break: break-word;
}

body {
  margin: 0;
  font-family: sans-serif;
  display: flex;
  height: 100vh;
  flex-direction: column; 
}

section.navbar-section {
    width: 100%;
}

.navbar {
    width: 100%;
}

.bs-icon {
  --bs-icon-size: .75rem;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  font-size: var(--bs-icon-size);
  width: calc(var(--bs-icon-size) * 2);
  height: calc(var(--bs-icon-size) * 2);
  color: var(--bs-primary);
}

.bs-icon-xs {
  --bs-icon-size: 1rem;
  width: calc(var(--bs-icon-size) * 1.5);
  height: calc(var(--bs-icon-size) * 1.5);
}

.bs-icon-sm {
  --bs-icon-size: 1rem;
}

.bs-icon-md {
  --bs-icon-size: 1.5rem;
}

.bs-icon-lg {
  --bs-icon-size: 2rem;
}

.bs-icon-xl {
  --bs-icon-size: 2.5rem;
}

.bs-icon.bs-icon-primary {
  color: var(--bs-white);
  background: var(--bs-primary);
}

.bs-icon.bs-icon-primary-light {
  color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .2);
}

.bs-icon.bs-icon-semi-white {
  color: var(--bs-primary);
  background: rgba(255, 255, 255, .5);
}

.bs-icon.bs-icon-rounded {
  border-radius: .5rem;
}

.bs-icon.bs-icon-circle {
  border-radius: 50%;
}

.split-shadow {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: -6px -6px 0 0 rgba(255, 80, 80, 0.9), 6px 6px 0 0 rgba(60, 140, 255, 0.9);
}

.split-shadow {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: -6px -6px 0 0 rgba(255, 80, 80, 0.9), 6px 6px 0 0 rgba(60, 140, 255, 0.9);
}

span {
  display: inline-block;
  margin-right: 10px;
}

/* Header (nav bar) */
header {
  height: 10%;             /* take 10% of total height */
  min-height: 60px;        /* optional: ensure readable minimum */
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Main section with sidebar + workspace */
main {
  flex: 1;                 /* take remaining vertical space */
  display: flex;
  flex-direction: column;
  margin:5px;
}

.main-section {
  display: flex;
  flex: 1;
  flex-direction: row;     /* sidebar and workspace side by side */
  min-height: 0;           /* fix overflow issues */
}

.sidebar {
  /* max-width: 250px; */
  /* min-width: 250px; */
  flex-shrink: 0;
  background: #f8f8f8;
  padding: 10px;
  border-right: 1px solid #ccc;
}

.btn {
  padding: 10px;
  margin: 5px 0;
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 6px;
  cursor: grab;
}

.workspace {
  flex: 1;
  background: #ebf3fb;
  padding: 15px;
  overflow: auto;
  position: relative;
}

.drop-area {
  width: 100%;        /* full width of container */
  max-height: 600px;  /* max height */
  min-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 2px dashed #999;
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;
}  

.drop-area.dragover {
  border-color: #0b74de;
  background: #f0f7ff;
}

.subboxes {
  display: flex;
  gap: 5px;
  margin: 3px 0 0 0;
}

.subbox {
  flex: 1;
  background: #f3f5f7;
  border: 1px dashed #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  box-sizing: border-box;
}

.close-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  /*background: linear-gradient(145deg, #ff5c5c, #e60000);*/
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease-in-out;
}

.close-btn:hover {
  background: linear-gradient(145deg, #ff7b7b, #ff1a1a);
  transform: scale(1.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.close-btn:active {
  transform: scale(0.95);
  background: linear-gradient(145deg, #cc0000, #990000);
}

.sidebar .btn {
  display: inline-block;
  width: 100%;
  box-sizing: border-box;
}

.panel {
  /*height: auto;*/
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px 5px;
  margin-bottom: 12px;
  position: relative;
  box-sizing: border-box;
  max-height: 320px;
}

.panel-content {
  align-items: stretch;
  display: flex;
  gap: 20px; /* spacing between chart and table */
  flex: 1;
  /*flex-direction: column;*/
  min-height: 0; /* critical for flex children scroll to work */
  overflow-x: visible;
  overflow-y: hidden
}



.panel-specific-table-wrapper {
    max-height: 140px;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    margin-top: 10px;
}

/* fade overlay */
.panel-specific-table-wrapper::after {
    content: "";
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.95));
    z-index: 2;
}

/* arrow indicator */
.panel-specific-table-wrapper::before {
    content: "▼";
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.5);
    z-index: 3;
    animation: bounceArrow 1.5s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 1;
}

/* when user scrolls, fade arrow out */
.panel-specific-table-wrapper.hide-arrow::before {
    opacity: 0;
}

/* animation */
@keyframes bounceArrow {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    50% {
        transform: translateY(5px);
        opacity: 1;
    }
}

.panel .table-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;   /* enable vertical scroll */
    max-height: 180px;   /* fill available space in panel */
}


.chart-container {
  flex: 1; /* takes left side */
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}


.table-container {
    position: relative;
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    max-height: 210px;  /* full panel-content height */
    min-height: 0;      /* critical for flexbox scrolling */
    font-size: 12px;    /* reduce font size to fit more rows */
    padding: 5px;
    border-left: 1px solid #ccc;
    box-sizing: border-box;
}

.table-container::before {
    content: "▼";
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.5);
    z-index: 3;
    animation: bounceArrow 1.5s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 1;
}

/* Fade overlay to suggest scrolling */
.table-container::after {
  content: "";
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.9));
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-container th, .table-container td {
    padding: 3px 5px;      /* smaller padding */
    text-align: left;
}

.styled-table {
  border-collapse: collapse;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  font-family: 'Segoe UI', sans-serif;
  font-size: 14px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  max-height: 120px;
}

.styled-table thead tr {
  background-color: #2f3640 !important; /* deep charcoal */
  color: #ffffff !important;
  text-align: left;
  font-weight: 600;
}

.styled-table thead th {
  background-color: #2f3640 !important; /* deep charcoal */
  color: #ffffff !important;
  text-align: left;
  font-weight: 600;
  border: none;
}

.styled-table th, .styled-table td {
  padding: 10px 14px;
}

.styled-table tbody tr {
  border-bottom: 1px solid #dddddd;
}

.styled-table tbody tr:nth-child(even) {
  background-color: #f2f2f2;
}

.styled-table tbody tr:nth-child(odd) {
  background-color: #ffffff;
}

.styled-table tbody tr:hover {
  background-color: #e8f6f3;
  transition: background-color 0.2s ease;
}

.styled-table th {
  font-weight: 600;
}

.styled-table td.anchor_class {
  color: #2980b9;
  cursor: pointer;
  font-weight: 500;
}

.styled-table td.anchor_class:hover {
  text-decoration: underline;
}

#search_by_index_results_div {
    margin-top: 5px;
}

.save-group-btn {
    /*position: absolute;*/
    width: 125px;
    bottom: 15px;
    right: 15px;
    background-color: #007bff;
    color: white;
    border: none;
    /*padding: 10px 10px;*/
    border-radius: 6px;
    margin-top: 10px;
    margin-left: 10px;
    font-size: 14px;
    cursor: pointer;
    /*z-index: 10;*/
    transition: opacity 0.3s ease;
    position: sticky;
    bottom: 0;
    z-index: 101;
    
}

.save-group-btn:disabled {
    background-color: gray;
    cursor: not-allowed;
}

.group-btn {
    position: relative;
    display: inline-block;
    background-color: #28a745; /* light green */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    margin-left: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.group-btn:hover {
    background-color: #218838; /* darker green */
}

/* Close X styling */
.group-btn .close-x {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    display:flex;
    align-items:center;
    justify-content:center;
    background: #fff;
    color: #c82333;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.group-message {
    display: inline-block;
    border-radius: 4px;
    margin-top: 10px;
    /*background-color: #198754; 
    color: white;*/
    font-size: 0.9rem;
    transition: opacity 0.5s ease;
}

.group-message.hide {
    opacity: 0;
    pointer-events: none;
}


#groupButtonsContainer {
  position: sticky;
  bottom: 0;
  background: #fff;

  z-index: 2000; /* keep it on top */
  padding: 10px 15px;
  border-top: 1px solid #ccc;
  display: flex;
  gap: 10px;
  /* Optional: box-shadow for separation */
  box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

.accordion-buttons {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
}

/* Accordion button must be full width */
.accordion-buttons .btn {
    width: 100%;
}

/* Accordion panel must span full width */
.mobile-accordion-panel {
    width: 100%;
    margin-top: 8px;
}
#mobileToggleWrapper {
    display: flex;
    justify-content: center;
}


#mobileLayoutToggleBtn {
    display: inline-block;
    padding: 8px 14px;
    font-size: 14px;
}

.grid-buttons {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

/* default hidden on mobile */
#dropArea.mobile-hidden {
  display: none !important;
}

/* Also do this for the saveGroupBtn container if needed */
#dropArea {
  /*display: none;*/
  position: relative;
  /* Make sure it has a height; e.g.: */
  height: 600px; /* or whatever height your layout requires */
  overflow-y: auto; /* hide overflow outside */
  overflow-x:hidden;
}

.newsletter-panel {
  position: fixed;
  width: 800px;
  height: 600px;
  max-height: 100%;
  border-radius: 16px;
  background: #ffffff;
  border: 3px solid #333333; 
  box-shadow:
    0 0 12px rgba(51, 51, 51, 0.2),
    0 4px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Merriweather', serif;
  color: #333333;
  z-index: 100;
  background-clip: padding-box;
  padding: 20px;
  transition: box-shadow 0.3s ease;

  top: 50%;                /* move to center line */
  transform: translateY(-50%); /* pull it up by half its height */
  right: 20px;

}

.newsletter-panel:hover {
  box-shadow:
    0 0 18px rgba(51, 51, 51, 0.3),
    0 6px 30px rgba(0, 0, 0, 0.15);
}


.newsletter-middle {
  flex: 0 0 40%;
  border-bottom: 1px solid #e2e8f0;
  padding: 15px 10px;
  font-size: 1em;
  line-height: 1.5;
  color: #4a5568;
  overflow-y: auto;
}

.newsletter-top {
    font-family: "Merriweather", Georgia, serif;
    font-size: 26px;
    font-weight: 800;
    text-align: center;
    padding: 16px 0;

    background: linear-gradient(
        90deg,
        #c59f57,
        #e0c27b,
        #c59f57
    );
    -webkit-background-clip: text;
    color: transparent;

    text-shadow: 0 0 6px rgba(0,0,0,0.15);
    letter-spacing: 1px;
    text-transform: uppercase;
}


.newsletter-bottom {
  flex: 1;
  height: 57%;
  padding: 15px 10px;
  overflow-y: auto;
  font-size: 0.95em;
  line-height: 1.6;
  color: #2d3748;
}
.newsletter-bottom iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.newsletter-bottom h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2b6cb0;
}

.newsletter-bottom ul {
  padding-left: 20px;
  margin: 0;
}

.news-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eaeaea;
  cursor: pointer;
  align-items: center;
}

.news-row:hover {
  background: #f7f7f7;
  border-radius: 6px;
}

.news-thumb {
    width: 60px;             /* keep your current size */
    height: 60px;
    object-fit: cover;       /* makes images look clean */
    
    padding: 6px;            /* the padding you asked for */
    border: 1px solid #d3d3d3;  /* subtle border */
    border-radius: 6px;      /* optional rounding, looks nicer */
    
    background: #fff;        /* ensures clean light background */
    box-sizing: border-box;  /* so padding doesn't change outer size */
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}  

.news-text {
  font-size: 0.9em;
  line-height: 1.35em;
  color: #2d3748;
  max-width: calc(100% - 70px);
}

/* Add this CSS to your stylesheet or inject via JS */
.bottom-text-style {
  font-family: 'Georgia', serif;
  font-size: 16px;
  line-height: 1.6;
  color: #4a4a4a;
  background: #faf9f6;
  padding: 20px 25px;
  border-radius: 12px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap; /* preserve line breaks */
  border-left: 5px solid #6b8e23; /* subtle green accent */
  margin-top: 12px;
  transition: background-color 0.3s ease;
}

.bottom-text-style:hover {
  background: #f0f3e8;
  box-shadow: 0 8px 16px rgba(107, 142, 35, 0.25);
}

.sidebar-category-header {
    margin-top: 10px;
    margin-bottom: 4px;
    padding-left: 4px;
    color: #d0d0d0;        /* light gray, not bright */
    font-size: 0.82rem;
    font-weight: 600;      /* medium emphasis */
}

.sidebar-category-section {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}


/* drag & drop screen */
@media (max-width: 768px) {

  /* Each category becomes a horizontal scroll row */
  .sidebar-category-section {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;

    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;

    padding: 8px 4px 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent buttons from shrinking */
  .sidebar-category-section > * {
    flex: 0 0 auto;
  }

  .sidebar-category-section .btn,
  .sidebar-category-section button,
  .sidebar-category-section .panel-button,
  .sidebar-category-section .index-tile-wrapper {
    width: 110px !important;     /* 👈 key line */
    min-width: 110px !important;
    margin-bottom: 0 !important;
  }

  .sidebar-category-section::-webkit-scrollbar {
    display: none;
  }

  .sidebar-category-section {
    scrollbar-width: none; /* Firefox */
  }

    /* 🔒 RESTORE ACCORDION TO VERTICAL */
  .accordion-buttons {
    display: flex !important;
    flex-direction: column !important;
    overflow-x: hidden !important;
  }

  .accordion-buttons .btn {
    width: 100% !important;
    min-width: 100% !important;
    margin-bottom: 8px !important;
  }

  .btn {
    padding: 1px;
    margin: 1px 0;
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 6px;
    cursor: grab;
  }

  .sidebar-category-header {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 6px;
  } 

  .panel-content {
    flex-direction: column;   /* stack */
    overflow: visible;
  }

  .panel .table-container {
    max-height: none !important;
    overflow-y: visible !important;
  }


  .drop-area {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
  }


  .chart-container {
    width: 100%;
    max-width: 100%;
    overflow-x:auto;
  }

  .chart-container svg {
    max-width: 100%;
    display: block;
    margin: 0 auto;
  }


  .bar-label {
    font-size: 12px;
  }

  .table-container {
    border-left: none !important;
    border-top: 1px solid #ccc;
    max-height: none !important;
  }


  .workspace.mobile-hidden {
    display: none !important;
  }

  .sidebar {
    backdrop-filter: blur(10px);
    min-width: 100% !important;
    max-width: 100% !important;
    flex-shrink: 1 !important;
    border-right: none !important;
  }

  #groupButtonsContainer {
    display: none !important;
  }

  /* MOBILE PROFESSIONAL CARDS – SOFT APPLE GRADIENT */
  .sidebar button,
  .sidebar .btn,
  .sidebar .panel-button {

    display: flex !important;


    width: 100% !important;

    margin-bottom: 18px !important;

    background: linear-gradient(to bottom right, #e9e9e9, #e4ebf1) !important;

    border: 1px solid #e4ebf188 !important;
    border-radius: 20px !important;

    box-shadow: -5px -5px 10px #efefef, 
      5px 5px 10px  #0d275088;

    font-family: "Inter", sans-serif !important;
    font-size: 1.15rem !important;
    font-weight: 500 !important;
    line-height: 1.25 !important;
    letter-spacing: .3px;

    color: #1f2937 !important;
    fill: #1f2937 !important;

    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .sidebar button *,
  .sidebar .btn *,
  .sidebar .panel-button * {
    /* word-break: normal !important; */
    overflow-wrap: normal !important;
    hyphens: auto;
    text-align: center;
    color: #1f2937 !important;
    fill: #1f2937 !important;

  }

  .sidebar button:active,
  .sidebar .btn:active,
  .sidebar .panel-button:active {
    transform: scale(0.97);
    border: 1px solid #efefef !important;
    box-shadow: inset -5px -5px 10px #efefef,  /* inset Darker shadow for depth */
    inset 5px 5px 10px  #0d275088; /* inset Lighter shadow for highlight */
  };




  .newsletter-panel {
    width: calc(100vw - 32px);
    right: 16px;
    left: 16px;
  }

  header {
    flex-direction: column;
    height: auto;
    padding: 15px 20px;
    gap: 0.75rem;
  }

  footer{
    flex-direction: column;
    height: auto;
    padding: 15px 20px;
    gap: 0.75rem;
  }
  
  article.prose {
    padding: 15px 12px;
    font-size: 1rem;            /* Slightly bigger for readability */
    line-height: 1.5;           /* More line spacing */
    background: #f9f9f9;        /* subtle background for contrast */
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-width: 100%;
    overflow-wrap: break-word;  /* Better word breaks */
  }

  article.prose p {
    margin-bottom: 1em;
  }

  article.prose strong {
    color: #2c3e50;            /* Darker emphasis */
  }

  article.prose em {
    font-style: italic;
    color: #555;
  }
  .panel {
    max-height: none !important;
  }
  
  .selector-bar {
    position: relative !important;   /* no overlay */
    left: 0 !important;
    bottom: auto !important;

    width: 100%;
    max-width: 100%;

    display: flex;
    flex-wrap: wrap;                 /* allow wrap */
    justify-content: flex-start;     /* ✅ LEFT aligned */
    align-items: center;
    gap: 8px;

    margin-bottom: 12px;
    padding: 8px 10px;

    text-align: left;                /* ✅ text alignment */
  }

  .selector-bar span {
    margin-right: 6px;
    white-space: nowrap;
  }

  .styled-table{
    max-height: 320px;
  }
  
  .close-btn {
    position: absolute;
    top: 6px;
    right: 6px;

    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #c99999;
    color: #fff;

    border: 2px solid #fff;
    border-radius: 50%;

    font-size: 18px;
    font-weight: 800;        /* ✅ bold X */
    line-height: 1;          /* ✅ critical: removes baseline drift */

    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    opacity: 0.85;
    z-index: 2000;

    padding: 0;              /* ✅ ensure no padding shifts */
  }


  .panel-specific-table-wrapper {
      max-height: 100%;
 
  }

  .panel[data-panel-kind="sector-donut-chart"] 
  .chart-container {
    width: 100% !important;
  }

  .panel[data-panel-kind="sector-donut-chart"] 
  .chart-container svg {
    width: 100% !important;
    height: 100% !important;
    margin-left: 0 !important;
  }

  .panel[data-panel-kind="sector-donut-chart"] .styled-table tbody {
    column-count: 1;
  }

  .sidebar-category-section.grid-buttons {
    .grid-buttons {
      display: grid;
      grid-template-columns: repeat(4, 1fr); /* iPhone style */
      gap: 14px;
      padding: 12px;
    }
  }

  .index-tile-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    align-items: center;   /* centers label under card */
  }  

  .index-tile-btn {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    height: 100px;
    aspect-ratio: 1 / 1;
    border-radius: 22px;    
  }

  .index-tile-image {
    width: 100%;
    height: 100%;
    padding: 1px;               /* higher padding */
    box-sizing: border-box;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
  }

  .index-tile-label {
    margin-top: 8px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #374151;
    text-align: center;
    letter-spacing: 0.03em;
  }


  /*------- newly added -----------*/

  /* Section spacing */
  .accordion-buttons .sidebar-category-header {
    margin-top: 28px;
    margin-bottom: 12px;
  }

  /* Accordion container */
  .accordion-buttons {
    gap: 14px;
  }

  /* Accordion row */
  .accordion-buttons .btn,
  .accordion-buttons button,
  .accordion-buttons .panel-button {
    position: relative;
    min-height: 68px;                 /* 👈 perceived height */
    padding: 18px 48px 18px 18px;     /* room for chevron */
    line-height: 1.3;
    font-size: 1.05rem;
    font-weight: 500;

    background: linear-gradient(
      to bottom,
      #ffffff,
      #f7f8fa
    ) !important;

    border-radius: 22px !important;
    border: 1px solid rgba(0,0,0,0.04) !important;

    box-shadow:
      0 8px 20px rgba(0,0,0,0.10) !important;

    display: flex;
    align-items: center;
  }

  /* Left accent bar */
  .accordion-buttons .btn::before,
  .accordion-buttons button::before,
  .accordion-buttons .panel-button::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(
      to bottom,
      #d1d5db,
      #9ca3af
    );
  }

  /* Chevron affordance */
  .accordion-buttons .btn::after,
  .accordion-buttons button::after,
  .accordion-buttons .panel-button::after {
    content: "›";
    position: absolute;
    right: 18px;
    font-size: 1.6rem;
    color: #9ca3af;
    transform: translateY(-1px);
  }

  /* Active / pressed state */
  .accordion-buttons .btn:active,
  .accordion-buttons button:active,
  .accordion-buttons .panel-button:active {
    transform: scale(0.97);
    box-shadow:
      0 4px 12px rgba(0,0,0,0.14) !important;
  }

  /* Hide panel title header (text like "DOW Trends") */
  body.mobile-layout-accordion .panel-header,
  body.mobile-layout-accordion .close-btn {
    display: none !important;
  }
  .styled-table {
    font-size: 11px;
  }
}

@media (min-width: 768px) {

  #mobileLayoutToggleBtn {
    margin-top: 12px;
  }

  .panel[data-panel-kind="sector-donut-chart"] .styled-table {
    border: 1px solid #ccc !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    box-shadow: none !important;
    font-size: 11px !important;
  }

  .panel[data-panel-kind="sector-donut-chart"] .styled-table th,
  .panel[data-panel-kind="sector-donut-chart"] .styled-table td {
    border: none !important;
    padding: 4px 6px !important;
  }
  
  /* Target ONLY the donut panel legend table */
  .panel[data-panel-kind="sector-donut-chart"] .table-container {
    max-height: 300px;
    overflow-y: auto;
    overflow: visible;
    padding: 4px;
    border-left: none;
  }

  .panel[data-panel-kind="sector-donut-chart"] th,
  .panel[data-panel-kind="sector-donut-chart"] td {
    padding: 3px 6px;
    line-height: 1.2;
    white-space: nowrap;
  }

  /* Keep header normal */
  .panel[data-panel-kind="sector-donut-chart"] thead {
    display: table;
    width: 100%;
  }

  /* Make body act like a legend */
  .panel[data-panel-kind="sector-donut-chart"] tbody {
    display: block;
    column-count: 2;          /* 👈 split legend into 2 columns */
    column-gap: 12px;
  }

  .panel[data-panel-kind="sector-donut-chart"] tbody tr {
    display: flex;
    justify-content: space-between;
    break-inside: avoid;
    padding: 2px 0;
  }

  .panel[data-panel-kind="sector-donut-chart"] tbody td:first-child {
    flex: 1;
  }

  .panel[data-panel-kind="sector-donut-chart"] tbody td:last-child {
    text-align: right;
    width: 48px;
  }
  .panel[data-panel-kind="sector-donut-chart"] thead {
    display: none;
  }
  .panel[data-panel-kind="sector-donut-chart"] table {
    border: 1px solid #ccc;
    border-collapse: separate;
    border-spacing: 0;
  }

  .panel[data-panel-kind="sector-donut-chart"] th,
  .panel[data-panel-kind="sector-donut-chart"] td {
    border: none;
  }
}

@media (max-width: 380px) {
  .grid-buttons {
    grid-template-columns: repeat(3, 1fr);
  }
  .styled-table {
    font-size: 10px;
  }  
}
