/* ================================================================
   INVESTORWATCH BASE / LEGACY UI
   Dark + Light Theme Compatibility Pass

   Dependency:
   Load the primary InvestorWatch theme-token stylesheet first.
   This file intentionally consumes the shared --iw-* variables.

   Theme selector:
       <html data-theme="dark">
       <html data-theme="light">

   Existing selectors and layout behavior are preserved.
================================================================ */

html {
  font-size: var(--iw-font-xlarge);
}  

body {
  margin: 0;
  font-family:
      Inter,
      -apple-system,
      BlinkMacSystemFont,
      "Segoe UI",
      sans-serif;
  background: var(--iw-bg);
  color: var(--iw-text);
  overflow-x: hidden;
}

/* ================================
   MAIN CONTENT
================================ */

/* This section is used to hide element for mobile device */
.hide-on-mobile {
  display: block; /* default */
} 
.mobile .hide-on-mobile {
  display: none;
}   

.hidden2 {
  display: none !important;
}   

.hidden {
  display: none;
}   

.visible {
  display: block;
}

.app-logo {
    width: 340px;
    height: auto;
}

.trademark {
   color: var(--iw-text); 
   font-size: var(--iw-font-medium);
   top:60px; 
   margin-left:900px;
}

.hero {
  text-align: center;
  padding: 60px 20px 40px;
}

.hero h1 {
  font-size: 48px;
  margin-bottom: 10px;
}

.hero p {
  font-size: var(--iw-font-xxlarge);
  color: var(--iw-border-strong);
}

/* menu buttons for accounts container */
.menu-button {
    padding: 8px 16px;
    border: 0px;
    font-size: var(--iw-font-large);
    font-weight: bold;
    background: transparent;
    color: var(--iw-accent);
    cursor: pointer;
} 
.menu-button:hover {
    text-decoration: underline;
    background: transparent;
    color: var(--iw-positive);
}
.menu-button.active {
    text-decoration: underline;
    background: transparent;
    color: var(--iw-positive);
}   

/* Home elements sections */
.home-container {
  margin-left: 20px;
  max-width: 1100px;
  color: var(--iw-text);
  font-size: var(--iw-font-medium);
} 
  
.home-container p {
  margin-left: 30px;
  max-width: 1000px;
}
  
.home-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Style for the banner bar */
.banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: var(--iw-banner-bg); /* Ink Black */
    color: var(--iw-banner-text);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    z-index: 100;
}   
    
/* Style for the banner bar */
.banner-home {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: var(--iw-banner-bg); /* Ink Black */
    color: var(--iw-text);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.banner-home p {
  font-size: var(--iw-font-xlarge);
  text-align: left;
  opacity: 0.9;
  margin-left: 110px;
  color: var(--iw-positive);
  transform: translateY(-30px);
}

.banner-info-desktop {
   display: flex;
   align-items: center;
   gap: 8px;
}

.account-menu-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--iw-text);
    cursor: pointer;
    font-size: var(--iw-font-xxxlarge);
    padding-right: 15px;
    line-height: 1;
}

.account-menu-button:hover {
    background: transparent;
    transform: translateY(-4px);
}

/* Date and time container and styling */
.banner-info-container {
    position: relative;
    display: flex;
    flex-direction: row;
    font-size: var(--iw-font-medium);
    gap: 10px;
    color: var(--iw-text);
    position: absolute;
    top: 10px;  /* Adjust vertical position */
    right: 50px;
}   

.username {
  font-weight: bold;
  font-size: var(--iw-font-xlarge);
  color: var(--iw-text);
}   

.logo-container {
    display: flex;
    background: transparent;
}  


#banner-info-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    left: auto;
    min-width: 180px;
    padding: 6px;
    margin: 0;
    background: var(--iw-surface);
    border: 1px solid var(--iw-border);
    border-radius: 8px;
    box-shadow: var(--iw-shadow);
    z-index: 1000;
}

.user-menu-button {
    color: var(--iw-text);
    cursor: pointer;
    margin: 0;
    padding: 6px 10px;
    font-size: var(--iw-font-medium);
    line-height: 1.2;
    white-space: nowrap;
}

.user-menu-button:hover {
    background-color: var(--iw-accent);
}

#currentDate,
#localTime,
#localTemperature,
#localWeatherDescription {
    margin-bottom: 5px; /* Space between date, time, and temperature */
}   
    
.current-time {
  font-size: var(--iw-font-large);
  color: var(--iw-border-strong);
}

nav {
    background-color: var(--iw-surface-raised);
    color: var(--iw-text);
    padding: 10px;
}

nav button {
    background: none;
    border: none;
    color: var(--iw-text);
    font-size: var(--iw-font-title);
    cursor: pointer;
}   

/* Button to open Login form located on home page */
.login-buttons-row {            
    display: flex;
    margin-left: 30px;
    font-size: var(--iw-font-xlarge);
    gap: 30px;
    background: transparent;
} 

.mobile .login-buttons-row {            
    font-size: var(--iw-font-xxlarge);
    margin-top: 10px;
    margin-left: 10px;
} 


.login-form-button { 
    background: transparent;
    border: 0px;
    font-weight: bold;
    color: var(--iw-accent-soft);
    cursor: pointer;
    text-decoration: none;
} 
.login-form-button:hover {
    background: transparent;
    color: var(--iw-surface-hover);
} 


/* Login form elements */
.login-container {
    top: 20%; 
    left: 30%;
    margin-top: 20px;
    margin-left: 20px;
    background: var(--iw-surface);
    width: 100%;
    height: 500px;
    color: var(--iw-text);
    font-size: var(--iw-font-large);
}   
    
.login-button { 
    background: var(--iw-surface);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 150px;
    height: 40px;
    border: 1px solid var(--iw-border-strong);
    border-radius: 2px;
    font-size: var(--iw-font-xlarge);
    font-weight: bold;
    color: var(--iw-text-muted);
    cursor: pointer;
}
.login-button:hover {
    background: transparent;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.4);
    color: var(--iw-positive);
}
  
.login-extra {
    font-size: var(--iw-font-large);
    color: var(--iw-text);
    margin-top: 20px;
}

#content {
    background-color: var(--iw-surface);
}

button {
    background-color: var(--iw-text);
    color: var(--iw-text);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: 1px solid var(--iw-border-strong);
    border-radius: 4px;
    font-size: var(--iw-font-xlarge);
    box-sizing: border-box;
}
button:hover {
    background-color: var(--iw-positive);
}

.show-alert-container {
    position: fixed;
    left: 20%;
    top: 10%;
    display: flex;
    min-width: 300px;
    max-width: 600px;
    min-height: 150px;
    border: 1px solid var(--iw-border);
    border-radius: var(--iw-radius);
    background: var(--iw-surface);
    color: var(--iw-text);
    box-shadow: var(--iw-shadow);
    z-index: 9999;
    resize: both;
    overflow: hidden;
}
.show-alert-container .content {
    font-size: var(--iw-font-xxlarge);
    flex-direction: column;
    text-align: left;
    padding: 20px;
    color: var(--iw-text);
    white-space: pre-wrap;  /* Preserves newlines and wraps long text */
    overflow: auto;
}
.show-alert-container .footer {
    display: flex;
    justify-content: center;   /* horizontal centering */
    margin-top: 10px;
    margin-bottom: 15px;
    padding-top: 12px;
}
.show-alert-container .footer button {
    width: 120px;
    font-size: var(--iw-font-xxlarge);
    font-weight: bold;
    background: var(--iw-surface-soft);
    color: var(--iw-text);
    border-radius: 8px;
}
.show-alert-container .footer button:hover {
    color: var(--iw-accent);
}

/* Help Button */
.help-modal {
    position: fixed;
    top: 10%; left: 10%;
    width: 50vw;
    height: 50vh;
    max-width: 90vw;
    max-height: 90vh;
    min-width: 300px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    background: var(--iw-surface);
    border: 1px solid var(--iw-border-strong);
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    resize: both; /* Enables manual resizing */
    z-index: 9999; /* On top */
    overflow: auto;
}

.help-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    font-size: var(--iw-font-large);
}
.help-header, 
.help-footer {
    flex-shrink: 0;
    padding: 10px;
    background: var(--iw-surface-soft);
    border-bottom: 1px solid var(--iw-border);
    color: var(--iw-text);
}
.help-body {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto; /* Allows scrolling */
}
.help-btn { 
    background-color: var(--iw-surface);
    color: var(--iw-positive);
    padding: 5px 10px;
    font-size: var(--iw-font-large);
    cursor: pointer;
}  
.help-btn:hover {
    background-color: var(--iw-accent-soft);
}
.help-close {    
    position: absolute; 
    top: 10px; 
    right: 15px;
    font-size: 24px;
    font-size: var(--iw-font-close-btn);
    font-weight: bold;
    cursor: pointer;
    color: var(--iw-text-muted);
}           
.help-close:hover {
    color: var(--iw-text);
}       

.content-container {
    position: fixed;
    width: 95%;
    bottom: 20px;              /* THIS enables scrolling */
    top: 300px;
    overflow-y: auto;
} 

/* Position the instructions near the help icon */
.help-container {
    position: relative;
    display: inline-block;
}

.instructions {
    align-items: left;
    white-space: normal;     /* allow wrapping */
    word-wrap: break-word;   /* break long words if needed */
    overflow-wrap: break-word; /* modern wrapping */
    font-size: var(--iw-font-large);
    color: var(--iw-text);
    margin-left: 50px;
    margin-top: 70px;
}

.confirm-modal {
    position: fixed;
    background-color: var(--iw-surface);
    top: 20%;
    left: 20%;
    width: 400px;
    max-width: 90vw;
    border: 4px solid black;
    border-radius: 8px;
    z-index: 8000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    outline: 4px solid var(--iw-negative);
}
.confirm-modal .content {
    white-space: normal;     /* allow wrapping */
    word-wrap: break-word;   /* break long words if needed */
    overflow-wrap: break-word; /* modern wrapping */
    font-size: var(--iw-font-large);
    padding: 20px;
    margin-bottom: 10px;
    background-color: var(--iw-surface);
    color: var(--iw-text);
    font-size: var(--iw-font-xlarge);
} 
.confirm-modal .buttons {
    display: flex;
    justify-content: center;  /* center horizontally */
    gap: 15px;                /* space between buttons */
    margin-top: auto;         /* push container down */
    padding-top: 10px;
} 

.section-title {
  margin-top: 20px;
  margin-bottom: 10px;
  font-weight: 600;
  border-bottom: 2px solid var(--iw-border);
  padding-bottom: 4px;
  background-color: var(--iw-surface-soft);  /* light var(--iw-text-muted) bg */
  padding: 4px 8px;
  border-radius: 4px;
} 

/* Models Stylesheet */

#models-container {
    display: none;
}
.models-content-container {
    width: 95%;
    overflow-y: auto;
    margin-top: 20px;
    margin-bottom: 20px;
} 
.model-buttons {
    gap: 10px;                /* space between buttons */
    margin-bottom: 20px;
}
.model-btn {
  font-size: var(--iw-font-large);
  color: var(--iw-text);
  min-width: 100px;
  background: var(--iw-surface);
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  border: 4px;
  border-radius: 4px;
}
.model-btn:hover {
  color: var(--iw-accent);
  background: var(--iw-text-muted);
}
.model-btn.active {
  background: var(--iw-accent);
}

#model-title {
   background: transparent;
   font-size: var(--iw-font-xlarge);
   color: var(--iw-text);
   font-weight: bold;
   margin-left: 10px;
}

.grid-menu {
    position: fixed;

    top: 170px;
    left: 240px;
    right: 0;
    bottom: 0;

    overflow-y: auto;
    overflow-x: auto;

    padding: 10px 20px 20px 20px;

    box-sizing: border-box;
}

.grid-menu-container {
    display: grid;

    /* Automatically changes number of columns as width changes */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));

    gap: 20px;
    padding: 20px;

    width: 100%;
    max-width: 100%;
    box-sizing: border-box;

    overflow-x: auto;
    overflow-y: auto;

    max-height: calc(100vh - 150px);
}

.grid-menu-container > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.card {
    background-color: var(--iw-surface);
    color: var(--iw-text);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    max-width: 350px; /* ensures consistent card height */
}   

.card::after {
  /* Hover hint */ 
  content: attr(data-tooltip);
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: var(--iw-font-small);
  color: var(--iw-text-muted);
  background: var(--iw-surface-soft);
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  z-index: 1;
}

.card:hover {
    background: var(--iw-surface-hover);
    border-color: var(--iw-border-strong);
    color: var(--iw-text);
}

.card.active {
    background-color: #EEE8AA; /*PaleGoldenrod*/
    box-shadow: 0 0 0 2px rgba(45, 92, 255, 0.6);
}

.card-title {
    font-size: var(--iw-font-large);
    font-weight: 650;
    margin-bottom: 8px;
    color: var(--iw-text);
}

.card-desc {
    font-size: var(--iw-font-medium);
    color: var(--iw-text-secondary);
}

.toggle-menu-icon {
    position: relative;
    align-items: center;
    justify-content: center;
    margin-left: 20px;
    background: transparent;
    color: var(--iw-text);
    padding: 0;
    cursor: pointer;
    z-index: 1000;
    font-size: var(--iw-font-xxxlarge);
    transition: color 0.3s ease, transform 0.2s ease;
}

.icon-tooltip {
  position: relative;
  display: inline-flex;
}

.icon-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 0;                 /* anchor to right edge */
  margin-top: 6px;
  min-width: 300px;
  max-width: 600px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--iw-text);
  font-size: var(--iw-font-small);
  padding: 6px 8px;
  border-radius: 4px;
  white-space: normal;      /* allow wrapping */
  word-wrap: break-word;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: translateY(-2px);
  z-index: 9999;
}

/* Show on hover,  keyboard focus */
.icon-tooltip:hover::after,
.icon-tooltip:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.actions-menu-icon {
  position: absolute;
  font-size: var(--iw-font-icon);
  margin-left: 8px;
  cursor: pointer;
  top: 20%;
  left: 40%;
}
.actions-menu-icon hidden {
  display: none;
}
.actions-menu-icon:hover {
  transform: scale(1.1);
}

.account-actions-menu {
  position: absolute;
  top: 20%;
  left: 45%;
  background: var(--iw-surface);
  border: 1px solid var(--iw-border-strong);
  padding: 5px 0;
  width: 250px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  font-size: var(--iw-font-medium);
}
.account-actions-menu a {
  display: block;       /* Display links as full-width block */
  padding: 6px 12px;     /* Vertical spacing between items */
  text-decoration: none;
  color: var(--iw-text-secondary);
  font-size: var(--iw-font-medium);
}

.account-actions-menu a:hover {
  background-color: var(--iw-surface-hover);
}

.accounts-container {
  overflow-y: auto;
  gap: 10px;
  padding-top: 10px;
  padding-left: 20px;
  background: var(--iw-surface);
}

.title {        
    font-size: var(--iw-font-title);
    font-weight: bold; 
    color: var(--iw-text); 
    padding: 10px; 
} 

/* SEARCH RESULTS */

.symbol-list {
    background: var(--iw-accent-soft);
    border: 1px solid var(--iw-border);
    top: 200px;
    margin-left: 30px;
    width: 700px;
    height: 400px;
    overflow-y: auto;
    font-size: var(--iw-font-small);
    display: none;
    color: var(--iw-text);
    z-index: 9000;
}
  
.search-picklist-items {
    height: 100%;
    font-size: var(--iw-font-small);
    overflow-y: auto;
}

.search-picklist-close {
    margin-left: 10px;
    z-index: 200;

    width: 22px;
    height: 22px;

    border: none;
    background: transparent;
    color: var(--iw-text);
    cursor: pointer;
    font-size: var(--iw-font-xxlarge);
    line-height: 20px;
}

.search-picklist-close:hover {
    opacity: 1;
}


.search-picklist-item {
    padding: 6px;
    cursor: pointer;
}
.search-picklist-item:hover {
    background-color: var(--iw-accent-soft);
}

.stock-search {
    margin-top: 40px;
    color: var(--iw-text);
}
.stock-search input.symbol-input[type="text"] {
    box-sizing: border-box;
    width: 500px;
    height: 35px;
    padding: 6px 10px;           /* overrides framework padding */
    font-size: var(--iw-font-large);
    line-height: 1.2;
    background-color: var(--iw-surface-soft);
    color: var(--iw-text);
    border: 1px solid var(--iw-border-strong);
    border-radius: 4px;
    outline: none;
    text-decoration: none; /* Remove underline */
}
.mobile .stock-search input.symbol-input[type="text"] {
    box-sizing: border-box;
    width: 500px;
    height: 70px;
    padding: 6px 10px;           /* overrides framework padding */
    font-size: var(--iw-font-xxxlarge);
    line-height: 1.2;
    background-color: var(--iw-surface-soft);
    color: var(--iw-text);
    border: 1px solid var(--iw-border-strong);
    border-radius: 4px;
    outline: none;
    text-decoration: none; /* Remove underline */
}

.stock-search input.symbol-input[type="text"]::placeholder {
    color: rgba(135, 206, 235, 1);
    opacity: 1;
}

.description {
    display: flex-wrap;
    width: 500px;
}

.name {
    display: flex;
    gap: 10px;
    align-items: center;
    height: 30px;
}

.text-success {
  color: var(--iw-positive);
}
.text-danger {
  color: var(--iw-negative);
}

.modal {
  position: fixed;
  display: none; 
  top: 20%;
  left: 10%;
  z-index: 9999 !important;
}

.modal.open {
  display: block; 
}

.modal .content {
  background-color: var(--iw-surface) !important;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  color: var(--iw-text) !important;
}

.modal-header {
  background-color: var(--iw-surface-raised);  /* dark header */
  color: var(--iw-text);
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}

.modal-content {
  position: relative;
  background-color: var(--iw-surface) !important;
  color: var(--iw-text) !important;
}   

/* Darker overlay so background is blocked out */
.modal-backdrop {
  background-color: #000 !important;
  opacity: 0.7 !important;  /* adjust 0–1 as needed */
  z-index: 9998;
} 
  
.modal-resize-handle {
  width: 15px;
  height: 15px;
  background: transparent;
  position: absolute;
  right: 2px;
  bottom: 2px;
  cursor: se-resize;
}

.modal-dialog {
  margin-left: 20%;
  margin-right: auto;
  resize: both;
  overflow: auto;
}

.modal-body {
  font-size: var(--iw-font-large);
  padding-right: 2rem;  /* add right-side breathing room */
}

.data-item {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.data-item span {
  font-weight: 500;
}

.data-item span:first-child {
  margin-right: 8px;
}

.hide-btn { 
    position: relative;
    text-align: center;
    margin-left: 300px;
    cursor: pointer;
    font-size: var(--iw-font-large);
    color: var(--iw-text-muted);
    padding: 10px;
}   
.hide-btn:hover {
    color: var(--iw-negative);
} 


/* These elements are used for user feedback submission */

.feedback-thumbs {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.feedback-thumbs p {
    font-size: var(--iw-font-title);
    font-weight: 600;
}
.thumb-up {
  font-size: 1.5rem;
  padding: .5rem;
  border: none;
  background-color: transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}
.thumb-up:hover {
  background-color: transparent;
  transform: translateY(-4px);
}
.thumb-up.active {
  background-color: rgba(59, 130, 246, 0.12);
  box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.6),
        0 0 18px rgba(59, 130, 246, 0.8);
}
.thumb-down {
  font-size: var(--iw-font-xxxlarge);
  padding: .5rem;
  border: none;
  background-color: transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}
.thumb-down:hover {
  background-color: transparent;
  transform: translateY(+4px);
}
.thumb-down.active {
  background-color: rgba(59, 130, 246, 0.12);
  box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.6),
        0 0 18px rgba(59, 130, 246, 0.8);
}   

.feedback {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    color: var(--iw-text);
}

.feedback textarea {
    height: 120px;
    color: var(--iw-text);
}

.feedback textarea:focus {
    outline: none;
    border-color: var(--iw-accent);
}

.star-rating {
    display: inline-flex;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}
.star {
    font-size: var(--iw-font-xxxlarge);
    color: var(--iw-text-muted);
    transition: color 0.2s ease;
}
.star.active {
    color: gold;
}
.star-rating.error .star {
    color: var(--iw-negative);
}
.star-rating.error::after {
    content: "Please select a rating";
    display: block;
    font-size: var(--iw-font-medium);
    color: var(--iw-negative);
    margin-top: 4px;
}

.textarea {
    font-size: 14px;
    font-size: var(--iw-font-large);
    min-width: 500px;
    margin-right: 20px;
}

.note-message-box {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
}

.note {
    display: none;
    flex: 1 1 auto;
    white-space: normal;
    overflow-wrap: break-word;
    font-size: var(--iw-font-medium);
    color: var(--iw-text) !important;;
}

.note-message-box button.note-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
    padding: 5px 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--iw-accent) !important;
    font-family: inherit !important;
    font-size: var(--iw-font-medium) !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}
button.note-link:hover {
    text-decoration: underline;
}

.buttons-box {
    display: flex !important;
    align-items: flex-start !important;
    gap: 16px !important;
    padding-left: 20px;
}

.buttons-box button.note-link {
    display: inline-flex !important;
    align-items: left !important;
    gap: 6px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--iw-accent) !important;
    font-family: inherit !important;
    font-size: var(--iw-font-medium) !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}

.page-title-container {
  display: flex;
  position: absolute;
  margin: 40px;
  font-size: var(--iw-font-title);
  min-width: 300px;
  color: var(--iw-accent);
}   
.page-title-container img {
  margin-right: 10px;
}


/* History Toggle Button */
.history-button-container {
  position: relative;
  display: flex;
}

.historyToggle {
  margin-left: 10px;
  background-color: transparent;
  color: transparent;
  cursor: pointer;
  transform: translateY(-12px);
  border: 0px;
  z-index: 110;
}
.historyToggle:hover {
   background: transparent;
   color: var(--iw-text-muted);
}
.historyToggle i {
  color: var(--iw-text);
  font-size: var(--iw-font-xxlarge);
}

#historyAccordion {
  flex: 1 1 auto;
  overflow-y: auto; 
  margin-left: 10px;
  scrollbar-width: thin;
  font-size: var(--iw-font-large);
}   

/* Let the accordion area scroll while header stays fixed */
.historyHeader {
  flex: 0 0 auto;
  padding: 10px 10px;
  border-bottom: 2px solid var(--iw-text-secondary);
}

/* The history drawer panel must allow internal scrolling */
#historyPanel {
    position: fixed;
    top: 120px;
    left: -300px; /* hidden by default */
    width: 300px;
    height: 100%;
    background: var(--iw-panel-bg);
    color: var(--iw-text);
    box-sizing: border-box;
    overflow-y: auto;
    transition: left 0.3s ease;
    font-size: var(--iw-font-medium);
    z-index: 1500;
}
#historyPanel.open {
    left: 0;
}
#historyPanel h2 {
    margin-top: 0;
    font-size: var(--iw-font-large);
}

.history-item {
  background-color: var(--iw-surface-soft);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
  font-size: var(--iw-font-medium);
  line-height: 1.2;
}

.history-item:hover {
  background-color: var(--iw-surface-hover);
  transform: scale(1.01);
}

/* Security name (title) */
.history-name {
  font-weight: 600;
  color: var(--iw-text);
  margin-bottom: 2px; /* minimal gap */
}

.history-meta {
  color: var(--iw-accent);
  font-size: var(--iw-font-medium);
}

/* Optional: tooltip style for timestamp hover (Chrome/Safari) */
.history-item[title] {
  cursor: help;
}

.timestamp {
  font-size: var(--iw-font-medium);
  color: var(--iw-text-muted);
}

/* Dim overlay behind the drawer */
.historyOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease;
  z-index: 1040; /* below drawer (drawer z-index: 1050) */
}
.historyOverlay.show {
  opacity: 1;
  visibility: visible;
}

/* Collapse animation helpers */
.collapse:not(.show) { 
  display: none; 
}
.accordion-collapse {
  overflow: hidden;           /* required for height animation */
  transition: height 0.35s ease;
}
/* Remove Bootstrap default chevron; we use our own */
.accordion-button::after { display: none !important; }

/* Arrow rotation */
.arrow-icon { transition: transform .25s ease, color .25s ease; color:var(--iw-border-strong); }
.arrow-icon.rotate-down { transform: rotate(180deg); color:var(--iw-accent); }
.accordion-button:hover .arrow-icon { color:var(--iw-accent); }

.accordion-btn {
  margin-top: 20px;
  margin-left: 20px;
  margin-bottom: 10px;
  width: 100%;
  background-color: var(--iw-text);
  color: var(--iw-text);
  cursor: pointer;
  text-align: left;
  border: none;
  outline: none;
  transition: background-color 0.3s;
  font-size: var(--iw-font-xlarge);
  font-weight: bold;
}
.accordion-btn:hover {
  background-color: var(--iw-accent);
  color: var(--iw-text);
}
.panel {
  padding: 0 20px;
  background: transparent;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}
.panel p {
  color: var(--iw-text);
  margin: 2px 20px;
  font-size: var(--iw-font-medium);
}

.autocomplete-list {
    position: absolute;
    background: var(--iw-surface);
    border: 1px solid var(--iw-border);
    max-height: 150px;
    overflow-y: auto;           
    width: 250px;
    z-index: 9999;
    display: none;
}
.autocomplete-item {
    padding: 6px;
    cursor: pointer;
}   
.autocomplete-item:hover {
    background-color: var(--iw-accent-soft);
}   

.gain {
  color: var(--iw-positive);
  font-weight: bold;
}

.loss {
  color: var(--iw-negative);
  font-weight: bold;
}

.top-container {         
  overflow-y: auto;
  width: 90%;
  height: 70%;
}   
.container-close {
  float: right;
  z-index: 10;
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: var(--iw-font-close-btn);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  color: var(--iw-text);
} 
.container-close:hover {
  background: var(--iw-negative);
  color: var(--iw-text);
}   

.account-button {
    width: 150px;
    height: 30px;
    background-color: var(--iw-surface);
    color: var(--iw-text);
    font-size: var(--iw-font-medium);
    cursor: pointer;
    margin-top: 2px;
    margin-left: 2px;
} 
.account-button:hover {
    background-color: var(--iw-accent);
    transform: translateY(-4px);
} 
.account-button.active {
    background-color: var(--iw-positive);
    color: var(--iw-text);
} 

#dashToggle {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    outline: none;
}

.dash-buttons-row {
  display: flex;
  margin-left: 550px;
  overflow-x: auto;
  gap: 15px;

  border-color: 1px;
  border-width: 1px;
  border-style: solid;

  max-height: 70px;
  max-width: 700px;
  opacity: 1;

  transform: translateY(-60px);
}

.dash-buttons-row.collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.dash-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--iw-text-muted);
  font-size: var(--iw-font-large);
}

.dash-toggle-btn i {
  transition: transform 0.25s ease;
}

.dash-toggle-btn.collapsed i {
  transform: rotate(180deg);
}

.dash-btn-icon {
    position: relative;
    border: none;
    cursor: pointer;
    font-size: var(--iw-font-xxlarge);
    background-color: transparent;
}
.mobile .dash-btn-icon {
    position: relative;
    border: none;
    cursor: pointer;
    font-size: 50px;
}

.dash-btn-icon:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
} 
.dash-btn-icon.active {
    background-color: rgba(59, 130, 246, 0.12);
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.6),
        0 0 18px rgba(59, 130, 246, 0.8);
}

.help-icon {
    position: relative;
    display: flex;
    cursor: pointer;
    z-index: 8000;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--iw-text);
    width: 25px;
    height: 25px;
    border-radius: 50%;
    font-size: var(--iw-font-xlarge);
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    margin-left: 20px;
} 
  
.help-icon:hover .tooltip-text,
.help-icon:focus .tooltip-text {
  visibility: visible;
  opacity: 1;
} 

.tooltip-wrapper {
  position: relative;
  display: inline-block;
}
.tooltip-wrapper .tooltip-text {
  visibility: hidden;
  opacity: 0;
  background-color: var(--iw-text);
  color: var(--iw-text);
  text-align: left;
  padding: 4px 6px;
  border-radius: 4px;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  transition: opacity 0.2s ease-in-out;
  width: auto;
  white-space: normal;        /* allow normal wrapping */
  word-wrap: break-word;      /* wrap long words if needed */
  word-break: break-word;     /* ensure long words break to avoid overflow */
  font-size: var(--iw-font-medium);
  min-width: 400px;           /* the maximum width of tooltip */
  z-index: 9000;
}
.tooltip-wrapper .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0,0,0,0.8) transparent transparent transparent;
}
.tooltip-wrapper:hover .tooltip-text,
.tooltip-wrapper:active .tooltip-text {
  opacity: 1;
  visibility: visible;
}

.busy-container {
  display: flex;
  flex-direction: row;         /* Force horizontal layout */
  align-items: center;         /* Align text and spinner vertically */
  justify-content: center;     /* Center the group horizontally */
  margin-top: 10px;
  min-width: 50%;
  z-index: 100;
}

.busy-text {
  font-size: var(--iw-font-medium);
  font-weight: bold;
  color: var(--iw-text-muted);
  white-space: nowrap;         /* Prevent wrapping */
  margin: 0;
}

.busy-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--iw-accent);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  flex-shrink: 0;              /* Prevent shrinking */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


.drawer-title {
   font-size: var(--iw-font-xxlarge);
   font-weight: 500;
}


#drawer {
    position: fixed;
    left: 10px;
    top: 140px;
    bottom: 0;

    width: var(--drawer-width, 900px);
/*
    height: 100vh;
*/
    z-index: 1000;

    display: flex;
    flex-direction: column;

    font-size: var(--iw-font-large);
    color: var(--iw-text);
    transform: translateX(-100%);  /* Drawer initially hidden */
}

#drawer .drawer-close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    left: auto;
    
    background: transparent;
    border: none;
    cursor: pointer;

    font-size: var(--iw-font-xxlarge);
    color: var(--iw-text-muted);
    
    z-index: 1000;
}

#drawer .drawer-close-btn:hover {
    color: var(--iw-text);
    background: var(--iw-surface-hover);
}


#drawer.open {
    transform: translateX(0);
    pointer-events: auto;
}

#drawerContent {
    flex: 1 1 auto;        
    padding-left: 10px;
    min-height: 0;
    width: 95%;
    height: 95%;
    margin-right: 30px;
    overflow-y: auto;
    text-align: left;
    scroll-behavior: smooth;
    scroll-gutter: stable;

/*
    color: var(--iw-text);
    background: transparent;
*/

    background-color: var(--iw-panel-bg); /* Ink Black */
    opacity: 0;
    pointer-events: none;

    transition: opacity 0.2s ease, transform 0.2s ease;
}

#drawer.open #drawerContent {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

#drawer.minimized #drawerContent {
    opacity: 0;
    pointer-events: none;
}

#drawer .panel-body {          
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--iw-text);
}   

#drawer .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
/*
  margin: 20px;
  padding: 12px;
*/
}

#drawer .panel-header h3 {
  margin: 5px;
  font-size: var(--iw-font-xxlarge);
  font-weight: 600;
}

#drawer .panel-header .header-buttons {
  display: flex;
  align-items: left;
  gap: 10px;
}

#drawer .panel-header .header-buttons button {
  margin-left: 10px;
  padding: 0.5rem 1rem;

  border: 1px solid black;
  border-radius: 0.3rem;
  height: 35px;

  background: var(--iw-surface);
  color: var(--iw-text);

  font-size: var(--iw-font-large);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

#drawer .panel-header .header-buttons button:hover {
  background: var(--iw-accent);
  color: var(--iw-text);
}

/*
.drawer-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;

    background: transparent;
    border: none;
    cursor: pointer;

    font-size: var(--iw-font-close-btn);
    color: var(--iw-text-muted);

    z-index: 1000;
}

.drawer-close-btn:hover {
    color: var(--iw-text);
    background: var(--iw-surface-hover);
}
*/

.panel-btn.icon-btn {
  position: relative;
  margin-top: 10px;
  padding: 6px;
  background: transparent;
  color: var(--iw-text-muted);
  border: none;
  cursor: pointer;
}
.panel-btn.icon-btn i {
  font-size: var(--iw-font-icon);
  color: var(--iw-text);
  transition: color 0.15s ease;
}
.panel-btn.icon-btn:hover i {
  color: var(--iw-text-muted);
}
.panel-btn.icon-btn::after {
  /* Tooltip on hover */
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  background: var(--iw-surface-raised);
  color: var(--iw-text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: var(--iw-font-small);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 100;
}
.panel-btn.icon-btn:hover::after {
  opacity: 1;
}

/* =========================
   Drawer Form Elements
   ========================= */
#drawer p {
    font-size: var(--iw-font-small);
}

#drawer h1,
#drawer h2,
#drawer h3 {
    font-size: var(--iw-font-xxlarge);
    font-weight: 600;
}
#drawer ul {
    /* list-style-type: disc; */
    margin-left: 15px;
}
#drawer th {
    background-color: transparent;
    color: var(--iw-text);
    font-size: var(--iw-font-xlarge);
    text-align: left;
}
#drawer code {
    background-color: #f4f4f4;
    padding: 2px 4px;
    border-radius: 4px;
}
#drawer input,
#drawer select,
#drawer textarea {
    color: var(--iw-text);
    margin-bottom: 6px;
    border: 1px solid #334155;
    border-radius: 6px;
    background: var(--iw-surface);
}
#drawer label {
    margin-top: 12px;
    font-weight: bold;
    color: var(--iw-text);
}
#drawer input {
    padding: 8px;
    height: 30px;
    border: 1px solid var(--iw-border-strong);
    border-radius: 2px;
    background: var(--iw-surface);
}
#drawer input:focus,
#drawer select:focus {
    border-color: var(--iw-positive);
    outline: none;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}
#drawer select[multiple][size] {
    min-height: 80px;
    height: auto;
    background: var(--iw-surface);
}
#drawer .password-container {
    position: relative;
    display: flex;
    align-items: center;
}
#drawer .password-container input {
    display: flex;
}
#drawer .password-container .eye-button {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: .75rem;
    padding: .75rem;
}
#drawer .password-container .eye-button img {
    width: 24px;
    height: 24px;
    color: var(--iw-text);
}

.date-field {
    position: relative;
    display: inline-block;
}

.date-field input[type="date"] {
    width: 100%;
    height: 34px;
    box-sizing: border-box;
}

.calendar-inside {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
    font-size: var(--iw-font-xlarge);
}

.calendar-inside:hover {
    color: #2196F3;
}

/* Dashboard page content */
#mainContent {
    transition: margin-left 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: auto;
}   
#mainContent.shifted {
    margin-left: calc(var(--drawer-width) - 220px);
}

.transparent-button {
    font-size: var(--iw-font-medium);
    cursor: pointer;
    color: var(--iw-text);
    background: transparent;
    border: 0px;
    margin-left: 20px;
}
.transparent-button:hover {
    background-color: var(--iw-text);
    color: var(--iw-text);
}

.close-btn {
  display: flex;
  float: right;

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

  top: 5px;
  right: 5px;

  z-index: 100;

  border: 0px;
  background: var(--iw-surface);
  font-size: var(--iw-font-close-btn);
  line-height: 1;

  cursor: pointer;
}
.close-btn:hover {
  background: transparent;
  color: var(--iw-negative);
}

.drawer-button {
  position: absolute;
  display: flex;
  top: 5px;
  left: 5px;
  z-index: 2000; /* above backdrop and drawer (which are 100 and 101) */
  border: 0;
  font-size: var(--iw-font-xxlarge);
  cursor: pointer;
  background: transparent;
  color: var(--iw-text);
}   
.drawer-button:hover {
  color: var(--iw-text-muted);
}

.no-decoration {
    /* remove underline from url text */
    text-decoration: none;
}

.username-input {
    width: 350px;
}
.password-field {
    position: relative;
    display: flex;
    align-items: center;
    width: 350px;
}
.password-input {
    width: 100%;
    height: 38px;
    padding-right: 38px; /* space for the eye */
    padding-left: 10px;
    font-size: var(--iw-font-medium);
    box-sizing: border-box;
}
.toggle-password {
    position: absolute;
    margin-top: 5px;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--iw-text);
    font-size: var(--iw-font-xlarge);
    user-select: none;
    color: white !important;
}
.toggle-password:hover {
    color: var(--iw-text-muted) !important;
}

.form-header {
    margin: 20px;
}

.form-header .title {
    margin: 0;
    font-size: var(--iw-font-xxlarge);
    font-weight: bold;
    padding-top: 10px;
    padding-bottom: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

.form-header h2 {
    margin: 0;
    font-size: var(--iw-font-xxxlarge);
}

.form-header .header-buttons button {
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid black;
    border-radius: 0.3rem;
    background: var(--iw-surface);
    color: var(--iw-text);
    cursor: pointer;
    transition: background 0.3s ease;
}
.form-header .header-buttons button:hover {
    background: var(--iw-accent);
    color: var(--iw-text);
}

.baseContainer {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin-top: 20px;
    margin-left: 20px;
    background: transparent;
}
.baseContainer .row {
    flex-direction: column;
    background-color: transparent;
    color: var(--iw-text);
    border-radius: 2px;
    font-size: var(--iw-font-xlarge);
    width: 100%;
}   

/*
.mobile .baseContainer {
    left: 5%;
}   
*/

.password-container .eye-button {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: .75rem;
    padding: .75rem;
}   
.password-container .eye-button img {
    width: 24px;
    height: 24px;
    filter: invert(1);
}   
.password-container .eye-button:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}

.form-container {
    position: fixed;
    display: none;
    flex-direction: column;
    min-width: 400px;
    max-width: 800px;
    top: 10%;
    left: 10%;
    padding: 20px;
    background: var(--iw-surface-soft);
    border: 2px solid var(--iw-border-strong);
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    z-index: 9000;
}
/*
.mobile .form-container {
    left: 5%;
}
*/

.form-content {
    padding: 20px;
    margin-left: 10px;
    background-color: var(--iw-text);
    color: var(--iw-text);
    flex-direction: column;
    font-size: var(--iw-font-medium);
    display: flex;
    overflow-y: auto;
    text-align: left;
    /*resize: both;*/
}
.form-content .title {
    font-size: var(--iw-font-medium);
    font-weight: bold;
    margin: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}   
.form-content h2,
.form-content h3,
.form-content h4,
.form-content h5 {
    margin-bottom: 20px;
    font-size: 1rem;
    font-size: var(--iw-font-xlarge);
    color: var(--iw-text);
}
/*
.mobile .form-content h3 {
    margin-bottom: 8px;
    font-size: var(--iw-font-medium);
}
*/
.form-content label {
    margin-top: 10px;
    font-weight: bold;
    color: var(--iw-text);
}
/*
.mobile .form-content label {
    margin-top: 5px;
}
*/
.form-content p {
    font-size: var(--iw-font-large);
    color: var(--iw-text);
}
.mobile .form-content p {
    font-size: var(--iw-font-small);
    color: var(--iw-text);
}
.form-content a {
    font-size: var(--iw-font-large);
    color: var(--iw-positive);
    font-weight: bold;
    text-decoration: none;
}
/*
.mobile .form-content a {
    font-size: var(--iw-font-small);
}
*/
.form-content a:hover {
    color: var(--iw-accent);
}
.form-content input {
    padding: 6px;
    height: 25px;
    width: 100%;
    border: 1px solid var(--iw-border-strong);
    border-radius: 2px;
    margin-bottom: 10px;
}
.form-content input:focus,
.form-content select:focus {
    border-color: var(--iw-positive);
    outline: none;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}
.form-content select[multiple][size] {
  min-height: 80px;
  height: auto;
  width: 100%;
}
/*
.mobile .form-content input {
    font-size: var(--iw-font-small);
    padding: 5px;
    height: 25px;
}
*/

.form-buttons {
    display: flex;
    justify-content: center;  /* center horizontally */
    gap: 10px;                /* space between buttons */
    margin-top: 20px;
    margin-bottom: 10px;
    width: 100%;
}
.form-buttons button {
  font-size: var(--iw-font-xlarge);
  min-width: 100px;
  height: 30px;
  background: var(--iw-surface);
  color: var(--iw-text);
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}
.form-buttons button:hover {
  background: var(--iw-accent);
  transform: translateY(-2px);
}
/*
.mobile .form-buttons button {
  font-size: var(--iw-font-medium);
  height: 25px;
}
*/

.form-section {
    margin-top: 15px;
    border-top: 2px solid var(--iw-text-muted); /* divider */
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: var(--iw-font-large);
    font-weight: bold;
    width: 80%;
}

/* these elements are used in Screener page */
.form-instruction {
  white-space: normal;     /* allow wrapping */
  word-wrap: break-word;   /* break long words if needed */
  overflow-wrap: break-word; /* modern wrapping */
  font-size: var(--iw-font-medium);
  font-style: italic;
  color: var(--iw-text);
}

.form-info {
  font-size: var(--iw-font-medium);
  white-space: normal;     /* allow wrapping */
  word-wrap: break-word;   /* break long words if needed */
  overflow-wrap: break-word; /* modern wrapping */
}

.form-title {
    font-size: var(--iw-font-xxlarge);
    font-weight: bold;
    color: var(--iw-text);
    /*margin-top:15px;*/
    margin-left:15px;
}

.form-row {
    flex-direction: column;
    background-color: transparent;
    color: var(--iw-text);
    border-radius: 2px;
    display: flex;
    font-size: var(--iw-font-xlarge);
    width: 100%;
}
.form-row label {
    margin-top: 12px;
    font-weight: bold;
    font-size: var(--iw-font-medium);
}
.form-row p {
    margin-top: 12px;
    font-size: var(--iw-font-medium);
    font-weight: bold;
}
.form-row input,
.form-row select {
    padding: 6px;
    font-size: var(--iw-font-medium);
    height: 30px;
    border: 1px solid var(--iw-border-strong);
    border-radius: 2px;

}
.form-row select option {
    background-color: var(--iw-text);   /* native dropdown */
    color: #000;
}
.form-row input:focus,
.form-row select:focus {
    border-color: var(--iw-positive);
    outline: none;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}
.form-row textarea {
  padding: 6px;
  font-size: var(--iw-font-medium);
  height: 96px;          /* approx 6 rows */
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

table {
  border-collapse: collapse;
}

th, td {
  padding: 10px 16px;  /* vertical | horizontal */
}

.page-container {                
    position: fixed;
    top: 200px;
    flex-direction: column;
    width: 600px;
    padding: 20px;
    background: var(--iw-surface);
    color: var(--iw-text);
    font-size: var(--iw-font-large);
}   

.alert-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  z-index: 2;
}
.alert-icon img {
  width: 24px;
  height: 24px;
}

@media (max-width: 1200px) {
  .portfolio-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 900px) {
  .portfolio-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .portfolio-summary-grid {
    grid-template-columns: 1fr;
  }
}

.tab-tooltip {
  position: relative;
}

/* Tab Tooltip elements */
.tab-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;              /* display tooltip under the tab */
  left: 0;                /* anchor to left edge of tab */
  transform: translateX(-50%);
  margin-top: 6px;
  margin-left: 60%;

  min-width: 300px;
  max-width: 600px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--iw-text);
  font-size: var(--iw-font-small);
  padding: 4px 8px;
  border-radius: 4px;

  white-space: normal;    /* allow wrapping */
  word-wrap: break-word;
  line-height: 1.35;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
}

/* Show on hover */
.tab-tooltip:hover::after,
.tab-tooltip:focus-visible::after {
  opacity: 1;
}

#portfolioContent {
    margin-left: 0;
    transition: margin-left 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: margin-left;
} 
#portfolioContent.shifted {
    margin-left: calc(var(--drawer-width) - 220px);
} 

#tradeGroupContent {
    margin-left: 0; 
    transition: margin-left 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: margin-left;
}   
#tradeGroupContent.shifted {
    margin-left: calc(var(--drawer-width) - 220px);
}   
#tradeGroupContent.shifmin {
    margin-right: var(--drawer-width);
}   

.stock-search-drawer {
    background-color: transparent;
}   
.stock-search-drawer input.symbol-input[type="text"] {
    box-sizing: border-box;
    width: 500px;
    height: 36px;
    padding: 7px 10px;
    font-size: var(--iw-font-large);
    line-height: 1.2;
    background: var(--iw-surface-soft);
    color: var(--iw-text);
    border: 1px solid var(--iw-border-strong);
    border-radius: 6px;
    outline: none;
    text-decoration: none;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease;
}

.stock-search-drawer input.symbol-input[type="text"]:focus {
    border-color: var(--iw-focus-border);
    box-shadow: 0 0 0 2px var(--iw-focus-ring);
}
.stock-search-drawer input.symbol-input[type="text"]::placeholder {
    color: rgba(135, 206, 235, 1);
    opacity: 1; 
} 

.stock-search-drawer .symbol-list {
    background: DarkSlateGrey;
    border: 1px solid var(--iw-border);
    margin: 10px;
    width: 700px;
    height: 400px;
    overflow-y: auto;
    font-size: var(--iw-font-medium);
    display: none;
}

/* Rank */
.rank-badge {
  min-width: 18px;
  padding: 2px 5px;
  font-size: var(--iw-font-small);
  border-radius: 4px;
  background: var(--iw-surface-raised);
  text-align: center;
}

/* Name */
.member-link {
  color: var(--iw-positive);
  cursor: pointer;
  font-weight: 600;
  max-width: 120px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-link:hover {
  text-decoration: underline;
}

/* Numeric alignment */
.text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Gainers / Losers */
.positive {
  color: var(--iw-positive);
}

.negative {
  color: var(--iw-negative);
}

.add-button {
   margin-left: 20px;
   font-size: var(--iw-font-xxxlarge);
}
.add-button:hover {
   color: var(--iw-text-muted);
}


/* The following styling section is used for the Tool output drawer that is initiated from Dashboard */

.tool-card {
  margin-top: 30px;
  width: 95%;
  background: transparent;
  font-size: var(--iw-font-small);
  text-align: left;
  background-color: var(--iw-text);
  color: #e5e5e5; 
  padding: 10px 10px;
  font-family: Arial, sans-serif;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
} 
  
.tool-footer {
  color: var(--iw-text-muted);
  font-size: var(--iw-font-medium);
  margin-top: 8px;
} 

.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--iw-font-medium);
    color: #111;
}
.compact-table td,
.compact-table th {
    font-size: var(--iw-font-small);
    color: var(--iw-surface-raised);
    text-align: left;
    line-height: .9;
}
.compact-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.compact-table.dark {
    color: #eaeaea;
}
.compact-table.dark th {
    font-size: var(--iw-font-small);
    background-color: var(--iw-surface-soft);
    color: var(--iw-text);
}
.compact-table.dark td {
    font-size: var(--iw-font-small);
    background-color: var(--iw-surface-soft);
    color: #9fe1b1;
}
.compact-table.dark tr:nth-child(even) td {
    /* subtle color change on even numbers */
    background-color: var(--iw-panel-bg);
}

.hist-tooltip {
  opacity: 1 !important;
  z-index: 2000 !important;
}
.hist-tooltip-inner {
  background-color: var(--iw-surface-raised); /* slightly lighter than drawer */
  color: var(--iw-text);
  font-size: var(--iw-font-small);
  padding: 6px 8px;
  border-radius: 4px;
}
.hist-tooltip-arrow::before {
  border-top-color: var(--iw-surface-raised);
}

.floating-tooltip {
  position: fixed;
  background: var(--iw-surface-soft);
  color: var(--iw-accent);
  font-size: var(--iw-font-xlarge);
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;

  white-space: normal;       /* 🔑 allow wrapping */
  word-wrap: break-word;     /* legacy support */
  overflow-wrap: anywhere;   /* modern wrapping */

  line-height: 1.35;
  text-align: left;

  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 9999;
}

.floating-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.support {
    position: fixed;
    left: 10%;
    top: 10%;
    border: 4px solid var(--iw-border-strong);
    border-radius: 6px;
    display: flex;
    background-color: var(--iw-surface);
    max-width: 800px;
    max-height: 600px;
    min-width: 600px;
    min-height: 300px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    overflow: auto;
    resize: both; /* Enables manual resizing */
}
.support h3 {
  font-size: var(--iw-font-xlarge);
  font-weight: 600;
  text-align: center;
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--iw-text);
}
.support .content {
    margin: 20px;
    font-size: var(--iw-font-medium);
    color: var(--iw-text);
}
.support .content textarea {
    min-height: 300px;
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: left;
    white-space: pre-wrap;  /* Preserves newlines and wraps long text */
    color: var(--iw-text);
}


/* ===== TOP FILTERS (2 ROWS EXACT) ===== */

.filter-grid2 {
    display:grid;
    grid-template-rows:auto auto;
    grid-auto-flow:column;
    grid-auto-columns:minmax(150px,1fr);
    gap:6px 12px; /* Reduced spacing */
    margin-bottom: 12px;
}

.filter-grid {
    display:grid;
    /*grid-template-rows:auto auto;*/
    /*grid-auto-flow:column;*/
    grid-template-columns:repeat(6,1fr);
    grid-auto-columns:minmax(100px,1fr);
    gap:6px 8px; /* Reduced spacing */
    margin-bottom: 12px;
}

/* ===== SIGNAL FILTERS ===== */
.filter-signal-grid {
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:6px 14px; /* Reduced spacing */
}

/* ===== COMPANY ATTRIBUTE FILTERS ===== */
.filter-comp-grid {
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:6px 14px; /* Reduced spacing */
}

.filter-item{
    display:flex;
    flex-direction:column;
}
.filter-item label{
    font-size: var(--iw-font-small);
    margin-bottom:1px;
    color:var(--iw-text-muted);
}
.filter-item input,
.filter-item select{
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    font-size: var(--iw-font-medium);
    padding: 2px 6px;
    box-sizing: border-box;
    line-height: 1.2;
}

/* Remove extra spacing Bootstrap might add */
.filter-item select,
.filter-item input {
    margin-bottom: 0px;
}
.filter-item select[multiple][size] {
    min-height: 80px;
    height: auto;
    background: none;
    color: var(--iw-text);
    width: 200px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

/* ===== SIGNAL FILTERS ===== */
.filter-signal-grid {
    display:grid;
    grid-template-columns:repeat(6,1fr);
    gap:6px 8px; /* Reduced spacing */
}

/* ===== COMPANY ATTRIBUTE FILTERS ===== */
.filter-comp-grid {
    display:grid;
    grid-template-columns:repeat(6,1fr);
    gap:6px 8px; /* Reduced spacing */
}

.filter-control {
    display: flex;
    flex-direction: column;
    gap: 4px;

    min-width: 0;
}
.filter-control label {
    font-size: var(--iw-font-medium);
    font-weight: 600;
    color: var(--iw-text-soft);
    margin: 0;
}
.filter-input-group {
    display: flex;
    overflow: hidden;
}

.filter-divider {
    margin: 10px 0 6px 0;
    border-top: 1px solid white;
}

.filter-divider span {
    position: absolute;
    top: -8px;
    left: 10px;
    background: #1a1a1a; /* drawer background */
    padding: 0 6px;
    font-size: var(--iw-font-small);
    color: #999;
    letter-spacing: 0.5px;
}

.dashboard-button {
    background: transparent;
    margin-top: 20px;
    margin-left: 20px;
    border: 0px; 
    font-weight: bold;
    font-size: var(--iw-font-xlarge);
    color: var(--iw-accent-soft);
    cursor: pointer;
    text-decoration: none;
}   
.dashboard-button:hover {
    background: transparent;
    color: var(--iw-text);
}   

.checkbox {
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    font-size: var(--iw-font-medium);
    padding: 2px 6px;
    box-sizing: border-box;
    line-height: 1.2;
}

.message-text {
    align-items: left;
    white-space: normal;     /* allow wrapping */ 
    word-wrap: break-word;   /* break long words if needed */
    overflow-wrap: break-word; /* modern wrapping */
    font-size: var(--iw-font-large);
    color: var(--iw-accent);
}

.home-message {
    align-items: left;
    white-space: normal;     /* allow wrapping */
    word-wrap: break-word;   /* break long words if needed */
    overflow-wrap: break-word; /* modern wrapping */
    margin-left: 40px;
    margin-bottom: 20px;
    font-size: var(--iw-font-xlarge);
    color: var(--iw-warning);
} 


.section-title {
  margin-top: 20px;
  margin-bottom: 10px;
  font-weight: 600;
  border-bottom: 2px solid var(--iw-border);
  padding-bottom: 4px;
  background-color: var(--iw-surface-soft);  /* light var(--iw-text-muted) bg */
  padding: 4px 8px;
  border-radius: 4px;
} 

.query-header {
    margin-left:10px;
    font-size: var(--iw-font-medium);
} 
.query-header input {
    min-width: 300px;
}
  
.excel-btn {
    font-size: var(--iw-font-xxxlarge);
    gap:10px;
    border: 0px;
} 

#htmlContent {
    margin-top: 190px;
    transition: margin-left 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: auto;
} 

/* This section is used for backtest form and perfmrmance report (html) */
.backtest-btn {
  font-size: var(--iw-font-medium);
  height: 24px;
  background: var(--iw-surface);
  color: var(--iw-text);
  cursor: pointer;
  border: none;
  border-radius: 2px;
}

.backtest-btn:hover {
  background: var(--iw-accent);
  transform: translateY(-2px);
} 

.backtest-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--iw-surface);
    border: 1px solid var(--iw-border);
    border-radius: 10px;
    padding: 16px 18px;

    min-height: 90px;

    display: flex;
    flex-direction: column;
    justify-content: center;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.summary-card.wide {
    grid-column: span 2;
}

.summary-label {
    color: var(--iw-text-muted);
    font-size: var(--iw-font-small);
    font-weight: 600;

    text-transform: uppercase;
    letter-spacing: 0.06em;

    margin-bottom: 7px;
}

.summary-value {
    color: var(--iw-text-bright);
    font-size: var(--iw-font-xxlarge);
    font-weight: 600;
}

.summary-value.small {
    font-size: var(--iw-font-large);
}

.summary-card.performance-card {
    background: var(--iw-surface-soft);
}

.summary-value.positive {
    color: var(--iw-positive);
}

.summary-value.negative {
    color: var(--iw-negative);
}


/* Tablet */
@media (max-width: 1000px) {
    .backtest-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* Mobile */
@media (max-width: 600px) {
    .backtest-summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-card.wide {
        grid-column: span 1;
    }
}

.toolbar-row {
    display: flex;
    align-items: stretch;  /* Makes everything same height */
    gap: 10px;
}

.toolbar-input {
    height: 24px;
    font-size: var(--iw-font-large);
    padding: 0 12px;
    min-width: 300px;
    box-sizing: border-box;
}

.toolbar-btn {
    height: 24px;
    font-size: var(--iw-font-large);
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.operator-select,
.value-input {
    height: 24px;
    border: 1px solid var(--iw-border-strong);
    font-size: var(--iw-font-medium);
    box-sizing: border-box;
}

/* LEFT SIDE */
.operator-select {
    width: 70px;
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0 8px;
}

/* RIGHT SIDE */
.value-input {
    flex: 1;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 0 10px;
}

/* FOCUS */
.operator-select:focus,
.value-input:focus {
    outline: none;
    border-color: #6ea8fe;
    position: relative;
    z-index: 2;
}

.form-select.operator-select {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
}

.form-control.value-input {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

#positions-transactions {
    display: none; 
    margin: 20px;
}

#positions-transactions-external {
    display: none; 
    margin: 20px;
}

.positions-button {
    border: 0px;
    font-size: var(--iw-font-large);
    font-weight: bold;
    background: transparent;
    color: var(--iw-accent);
    cursor: pointer;
    margin-bottom: 10px;
}   
.positions-button:hover {
    background: transparent;
    color: var(--iw-text-muted);
}


/* Trade Groups Section */

#trade-group-intro {
   display: none;
   border: 2px;
   border-radius: 6px;
   padding: 20px;
   color: var(--iw-text-muted);
   font-size: var(--iw-font-xlarge);
   font-weight: bold;
}

#groups-container {
  margin-top: 20px;
}  

#groups-members {
  display: none;
}

.show-groups-button {
    border: 0px;
    font-size: var(--iw-font-large);
    font-weight: bold;
    background: transparent;
    color: var(--iw-accent);
    cursor: pointer;
    margin-bottom: 10px;
}
.show-groups-button:hover {
    background: transparent;
    color: var(--iw-text-muted);
}

.groups-button {
    padding: 8px 16px;
    border: 0px;
    font-size: var(--iw-font-xlarge);
    font-weight: bold;
    background: transparent;
    color: var(--iw-accent);
    cursor: pointer;
}   
.groups-button:hover {
    background: transparent;
    text-decoration: underline;
    color: var(--iw-positive);      
}   
.groups-button.active {
    text-decoration: underline;
    background: transparent;
    color: var(--iw-positive);
}   

.close2-btn {
  display: flex;                 /* center content */
  align-items: center;
  justify-content: center;
    
  top: 5px; 
  right: 5px;
  z-index: 2000; /* above backdrop and drawer (which are 100 and 101) */
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  font-size: var(--iw-font-xlarge);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  color: var(--iw-text);
} 
.close2-btn:hover {
  background: var(--iw-negative);
  color: var(--iw-text); 
} 
.close2-btn:active {
    background: rgba(255, 255, 255, 0.2);
} 


/* System Activity Section */

#usage-table-container {
  margin-left: 20px;
}

#system-usage-container {
    width: 100%;
    position: fixed;
    top: 170px;
    margin-top: 30px;
} 

.usage-menu-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 5px;
    width: 100%;
    max-width: 900px;
    overflow-y: auto;
}
.usage-menu-container > * {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}
@media (max-width: 900px) {
    .usage-menu-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 600px) {
    .usage-menu-container {
        grid-template-columns: 1fr;
    }
}

#usage-table-container {
    display: none;

    width: calc(100vw - 280px);
    height: calc(100vh - 220px);

    overflow: hidden;
    box-sizing: border-box;
}

#usage-grid {
    width: 100%;
    height: 100%;
    min-width: 0;
}

#dashboard-container {
   display: none;
   margin-top: 40px;
}

#help-container {
    display: flex;
    position: fixed;
    top: 150px;
    margin-left: 240px;
    bottom: 20px;
}

#help-buttons {
  display: flex;
  margin-left: 30px;
  margin-bottom: 40px;
  overflow-x: auto;
  gap: 15px;
    
  max-height: 80px;
  opacity: 1;
}   

#glossary-container {
   display: none;
   margin-top: 40px;
   font-size: var(--iw-font-large);
}

.help-button {
    font-size: var(--iw-font-xxlarge);
    font-weight: bold;
    color: var(--iw-text);
    cursor: pointer;
    margin-bottom: 10px;
}
.help-button:hover {
    color: var(--iw-text-muted);
}
.help-button.active {
    text-decoration: underline;
    color: var(--iw-accent);
}

#videos-container {
   display: none;
   margin-top: 40px;
   font-size: var(--iw-font-large);
}

#signals-doc-container {
   display: none;
   margin-top: 40px;
   font-size: var(--iw-font-large);
}



/* ================================================================
   INVESTORWATCH THEME COMPATIBILITY + PROFESSIONAL POLISH
================================================================ */

/* Native controls */
input,
select,
textarea {
    font-family: inherit;
}

input,
select,
textarea {
    background-color: var(--iw-surface-soft);
    color: var(--iw-text);
    border-color: var(--iw-border-strong);
}

input::placeholder,
textarea::placeholder {
    color: var(--iw-text-muted);
    opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--iw-focus-border);
    box-shadow: 0 0 0 2px var(--iw-focus-ring);
}

/* General legacy buttons */
button {
    border-color: var(--iw-border-strong);
}

button:focus-visible {
    outline: 2px solid var(--iw-accent);
    outline-offset: 2px;
}

/* Banner / application chrome */
.banner,
.banner-home {
    background: var(--iw-panel-bg);
    color: var(--iw-text);
    border-bottom: 1px solid var(--iw-border);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.18);
}

.account-menu-button,
.username,
.current-time,
.banner-info-container,
.banner-info-desktop {
    color: var(--iw-text);
}

/* Dropdown menus */
.user-menu,
.account-actions-menu {
    background: var(--iw-surface);
    color: var(--iw-text);
    border: 1px solid var(--iw-border);
    border-radius: 8px;
    box-shadow: var(--iw-shadow);
}

.user-menu-button,
.account-actions-menu a {
    color: var(--iw-text-secondary);
}

.user-menu-button:hover,
.account-actions-menu a:hover {
    background: var(--iw-surface-hover);
    color: var(--iw-text);
}

/* Legacy cards */
.card,
.summary-card {
    background: var(--iw-surface);
    color: var(--iw-text);
    border: 1px solid var(--iw-border);
    box-shadow: var(--iw-shadow);
}

.card h3,
.card-title {
    color: var(--iw-text-caption);
}

.card-desc p {
    color: var(--iw-text-secondary);
}

.card.active {
    background: var(--iw-accent-soft);
    border-color: var(--iw-accent);
}

/* Search/autocomplete surfaces */
.symbol-list,
.autocomplete-list,
.search-picklist-items,
.stock-search-drawer .symbol-list {
    background: var(--iw-surface);
    color: var(--iw-text);
    border-color: var(--iw-border);
    border-radius: 7px;
    box-shadow: var(--iw-shadow);
}

.search-picklist-item,
.autocomplete-item {
    color: var(--iw-text-secondary);
}

.search-picklist-item:hover,
.autocomplete-item:hover {
    background: var(--iw-surface-hover);
    color: var(--iw-text);
}

/* Modal compatibility */
.modal .content,
.modal-content,
.help-modal,
.support,
.login-container,
.page-container {
    background: var(--iw-surface) !important;
    color: var(--iw-text) !important;
    border-color: var(--iw-border);
}

.modal-header,
.help-header,
.help-footer {
    background: var(--iw-surface-raised);
    color: var(--iw-text);
    border-color: var(--iw-border);
}

.modal-backdrop,
.modal2 {
    background-color: var(--iw-overlay) !important;
}

/* Drawer */
#drawer {
    color: var(--iw-text);
}

#drawerContent {
    background: var(--iw-panel-bg);
    border-right: 1px solid var(--iw-border);
}

#drawer .panel-body {
    color: var(--iw-text);
}

/* Generic title / status helpers */
.title,
.note,
.instructions,
#model-title,
.help-button {
    color: var(--iw-text);
}

.message-text,
.positions-button,
.show-groups-button,
.dashboard-button,
.login-form-button {
    color: var(--iw-accent);
}

.gain,
.text-success,
.positive,
.investment-positive {
    color: var(--iw-positive);
}

.loss,
.text-danger,
.negative,
.investment-negative {
    color: var(--iw-negative);
}

/* Tabs */
.nav-tabs {
    border-color: var(--iw-border);
}

.nav-tabs .nav-link {
    color: var(--iw-text-muted);
}

.nav-tabs .nav-link:hover {
    color: var(--iw-text);
    background: var(--iw-surface-hover);
}

.nav-tabs .nav-link.active {
    color: var(--iw-text);
}

.nav-tabs .nav-link.active::after {
    background: var(--iw-accent);
}

/* Tooltips */
.icon-tooltip::after,
.tab-tooltip::after,
.floating-tooltip,
.hist-tooltip-inner,
.tooltip-wrapper .tooltip-text {
    background: var(--iw-surface-raised);
    color: var(--iw-text);
    border: 1px solid var(--iw-border);
    box-shadow: var(--iw-shadow);
}

/* Spinner */
.busy-text {
    color: var(--iw-text-secondary);
}

.busy-spinner {
    border-color: var(--iw-border);
    border-top-color: var(--iw-accent);
}

/* Legacy trade group table */
.trade-group-table-container,
.trade-group-table-card {
    background: var(--iw-surface);
    border: 1px solid var(--iw-border);
    box-shadow: var(--iw-shadow);
}

.trade-group-table {
    color: var(--iw-text);
}

.trade-group-table th {
    color: var(--iw-text-secondary);
    border-color: var(--iw-border);
}

.trade-group-table td {
    border-color: var(--iw-border);
}

.trade-group-table tbody tr:hover {
    background: var(--iw-surface-hover);
}

.rank-badge {
    background: var(--iw-surface-raised);
    color: var(--iw-text-secondary);
}

.member-link {
    color: var(--iw-accent);
}

/* Filters */
.filter-item label,
.filter-control label {
    color: var(--iw-text-secondary);
}

.filter-divider {
    border-color: var(--iw-border);
}

.filter-divider span {
    background: var(--iw-panel-bg);
    color: var(--iw-text-muted);
}

/* Backtest / summary */
.backtest-btn {
    background: var(--iw-control-bg);
    color: var(--iw-control-text);
    border: 1px solid var(--iw-border);
    border-radius: 5px;
}

.backtest-btn:hover {
    background: var(--iw-control-hover);
    color: var(--iw-text);
}

.summary-card,
.summary-card.performance-card {
    background: var(--iw-surface);
    border-color: var(--iw-border);
}

.summary-label {
    color: var(--iw-text-muted);
}

.summary-value {
    color: var(--iw-text);
}

/* Section headings */
.section-title {
    color: var(--iw-text);
    background: var(--iw-surface-soft);
    border-color: var(--iw-border);
}

/* Legacy close buttons */
.container-close,
.close2-btn {
    background: var(--iw-surface);
    color: var(--iw-text-secondary);
    border-color: var(--iw-border);
}

.container-close:hover,
.close2-btn:hover {
    background: var(--iw-negative-soft);
    color: var(--iw-negative);
    border-color: var(--iw-negative);
}

/* Scrollbars */
* {
    scrollbar-color: var(--iw-border-strong) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--iw-border-strong);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--iw-text-muted);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Light mode native widgets */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
    color-scheme: light;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html:not([data-theme]) input,
html:not([data-theme]) select,
html:not([data-theme]) textarea {
    color-scheme: dark;
}

/* Reduce motion for accessibility without altering normal behavior. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
