.ibkr-select-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ibkr-text-muted);
  margin-bottom: 8px;
}

/* ---------- "+ Add Account" button ---------- */
.ibkr-page-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.ibkr-add-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: 0.2s ease;
}

.ibkr-add-account-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* ---------- Current account box ---------- */
.ibkr-account-select-wrap {
  position: relative;
  min-width: 340px;
}

.ibkr-current-account-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;

  background: var(--ibkr-card-bg);
  border: 1px solid var(--ibkr-card-border);
  border-radius: 16px;
  box-shadow: var(--ibkr-card-shadow);

  cursor: pointer;
  transition: 0.2s ease;
}

.ibkr-current-account-box:hover {
  border-color: #3b82f6;
}

.ibkr-current-account-info {
  flex: 1;
  min-width: 0;
}

.ibkr-current-account-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ibkr-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ibkr-current-account-id {
  font-size: 12.5px;
  color: var(--ibkr-text-muted);
  margin-top: 1px;
}

.ibkr-select-chevron {
  font-size: 18px;
  color: var(--ibkr-text-muted);
  line-height: 1;
  transition: 0.2s ease;
}

/* ---------- Connected / Disconnected simple pill ---------- */
.ibkr-connected-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.ibkr-connected-pill.connected {
  background: var(--ibkr-pill-connected-bg);
  color: var(--ibkr-pill-connected-text);
}

.ibkr-connected-pill.disconnected {
  background: var(--ibkr-pill-disconnected-bg);
  color: var(--ibkr-pill-disconnected-text);
}

/* ---------- Inline "Connected" status next to the account name ---------- */
.ibkr-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.ibkr-inline-status.connected {
  color: var(--ibkr-pill-connected-text);
}

.ibkr-inline-status.disconnected {
  color: var(--ibkr-pill-disconnected-text);
}

/* ---------- Overlay dropdown list ---------- */
.ibkr-dropdown-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;

  display: none;
  flex-direction: column;

  background: var(--ibkr-card-bg);
  border: 1px solid var(--ibkr-card-border);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);

  padding: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.ibkr-dropdown-list.open {
  display: flex;
}

.ibkr-dropdown-item:hover {
  background: var(--ibkr-table-row-alt);
}

.ibkr-dropdown-item + .ibkr-dropdown-item {
  border-top: 1px solid var(--ibkr-table-border);
  margin-top: 2px;
  padding-top: 14px;
}

.ibkr-dropdown-check {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  color: #2563eb;
  font-weight: 700;
}

.ibkr-dropdown-item-info {
  flex: 1;
  min-width: 0;
}

.ibkr-dropdown-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ibkr-text-dark);
}

.ibkr-dropdown-item-id {
  font-size: 12px;
  color: var(--ibkr-text-muted);
  margin-top: 1px;
}

/* ---------- "Add New IBKR Account" row at the bottom of the dropdown ---------- */
.ibkr-dropdown-add {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  margin-top: 4px;
  border-top: 1px solid var(--ibkr-table-border);

  font-size: 13.5px;
  font-weight: 700;
  color: #2563eb;
  cursor: pointer;
  border-radius: 12px;
}

.ibkr-dropdown-add:hover {
  background: var(--ibkr-table-row-alt);
}

.ibkr-dropdown-add-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #2563eb;
  border-radius: 50%;
  font-size: 13px;
}

:root[data-theme="dark"] .ibkr-dropdown-add,
:root[data-theme="dark"] .ibkr-dropdown-check {
  color: #60a5fa;
}

:root[data-theme="dark"] .ibkr-dropdown-add-icon {
  border-color: #60a5fa;
}

/* ---------- Accounts Connected / Last Updated panel ---------- */
.ibkr-toolbar-divider {
  width: 1px;
  align-self: stretch;
  background: var(--ibkr-card-border);
}

.ibkr-info-icon {
  color: var(--ibkr-text-muted);
  margin-top: 2px;
  flex-shrink: 0;
}

.ibkr-info-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--ibkr-text-dark);
  line-height: 1.2;
}

.ibkr-info-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
}

.ibkr-info-link:hover {
  text-decoration: underline;
}

:root[data-theme="dark"] .ibkr-info-link {
  color: #60a5fa;
}

/* ---------- Flat stat cards (no left accent bar) ----------
   statCard() is defined elsewhere (gateway.js). If it renders
   a left accent border by default, this neutralizes it for the
   3-up summary row so it matches the flat card look. Adjust the
   selector below if statCard()'s markup uses a different class. */
.ibkr-summary.ibkr-flat > * {
  border-left-width: 1px !important;
  border-left-color: var(--ibkr-card-border) !important;
  box-shadow: none !important;
}



@media (max-width: 720px) {
  .ibkr-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
}

.ibkr-toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  padding: 24px;

  border-radius: 22px;

  background: var(--ibkr-card-bg);

  border: 1px solid var(--ibkr-card-border);

  position: relative;
}

.ibkr-account-wrapper {
  width: 48%;
  position: relative;
}

.ibkr-title {
  display: block;

  font-size: 15px;

  font-weight: 500;

  color: var(--ibkr-text-dark);

  margin-bottom: 10px;
}

.ibkr-account-select {
  display: flex;
  align-items: center;

  gap: 18px;

  padding: 18px 22px;

  background: #172131;

  border: 1px solid #2a3648;

  border-radius: 18px;

  cursor: pointer;

  transition: 0.25s;
}

.ibkr-account-select:hover {
  border-color: #3b82f6;
}

.ibkr-avatar {
  width: 56px;
  height: 56px;

  border-radius: 50%;

  background: #2563eb;

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

  flex: none;
}

.ibkr-avatar svg {
  width: 28px;
  height: 28px;

  fill: white;
}

.ibkr-account-details {
  flex: 1;
}

.ibkr-account-name {
  font-size: 18px;

  font-weight: 700;

  color: white;

  margin-bottom: 4px;
}

.ibkr-account-id {
  font-size: 15px;

  color: #a3afc2;
}

.ibkr-account-status {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 8px 16px;

  background: rgba(34, 197, 94, 0.15);

  color: #22c55e;

  border-radius: 999px;

  font-size: 15px;

  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;

  border-radius: 50%;

  background: #22c55e;

  box-shadow: 0 0 8px #22c55e;
}

.ibkr-arrow {
  width: 22px;
  height: 22px;

  stroke: #c9d3e1;
}

.ibkr-toolbar-right {
  display: flex;
  align-items: center;
  gap: 38px;
}

.toolbar-divider {
  width: 1px;
  height: 92px;

  background: #293445;
}

.ibkr-info-block {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.ibkr-info-block .icon {
  width: 22px;
  height: 22px;

  stroke: #9ca3af;

  fill: none;

  stroke-width: 2;
}

.label {
  font-size: 15px;

  color: var(--ibkr-text-dark);

  margin-bottom: 6px;
}

.value {
  font-size: 34px;

  font-weight: 700;

  color: var(--ibkr-text-dark);

  line-height: 1;

  margin-bottom: 8px;
}

.ibkr-info-block a {
  font-size: 15px;

  color: #3b82f6;

  cursor: pointer;

  text-decoration: none;
}

.ibkr-dropdown {
  position: absolute;

  top: 118px;

  left: 0;

  width: 660px;

  background: #111827;

  border: 1px solid #273244;

  border-radius: 18px;

  padding: 10px 0;

  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);

  z-index: 20;
}

.ibkr-dropdown-item {
  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 18px 22px;
}

.ibkr-dropdown-item .left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ibkr-dropdown-item-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ibkr-account-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Paper */
.ibkr-account-type-badge.paper {
    background: var(--ibkr-warn-bg);
    color: var(--ibkr-warn-text);
    border: 1px solid var(--ibkr-warn-border);
}

/* Live */
.ibkr-account-type-badge.live {
    background: var( --ibkr-badge-stk-bg);
    color: var( --ibkr-badge-stk-text);
    border: 1px solid var( --ibkr-badge-stk-bg);
}

.radio {
  width: 28px;
  height: 28px;

  border-radius: 50%;

  border: 2px solid #4b5563;

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

  font-size: 14px;

  color: white;
}

.radio.active {
  background: #2563eb;

  border-color: #2563eb;
}

.name {
  font-size: 17px;

  font-weight: 700;

  color: white;

  margin-bottom: 3px;
}

.id {
  font-size: 15px;

  color: #94a3b8;
}

.badge {
  padding: 7px 16px;

  border-radius: 999px;

  background: rgba(34, 197, 94, 0.15);

  color: #22c55e;

  font-size: 14px;

  font-weight: 600;
}

.divider {
  height: 1px;

  background: #222d3d;

  margin: 0 20px;
}

.ibkr-tooltip{
    position:relative;
    display:inline-flex;
      align-items:center;
    z-index:9999;
}
.table-wrap{
    position:relative;
    z-index:1;
}

.ibkr-tooltip-text{
    position:absolute;
    bottom:calc(100% + 10px);
    left:50%;
    transform:translateX(-50%) translateY(6px);

    min-width:240px;
    max-width:280px;

    background:#111827;
    color:#fff;
    padding:10px 14px;

    border-radius:10px;
    font-size:13px;
    line-height:1.5;
    text-align:center;

    box-shadow:0 10px 30px rgba(0,0,0,.25);

    opacity:0;
    visibility:hidden;
    transition:.25s ease;
    pointer-events:none;

    z-index:9999;
}

.ibkr-tooltip-text::after{
    content:"";
    position:absolute;
    top:100%;
    left:50%;
    transform:translateX(-50%);

    border-width:7px;
    border-style:solid;
    border-color:#111827 transparent transparent transparent;
}

.ibkr-tooltip:hover .ibkr-tooltip-text{
    opacity:1;
    visibility:visible;
    transform:translateX(-50%);
}

table{
    overflow:visible !important;
}

tr{
    overflow:visible !important;
}

td{
    overflow:visible !important;
}

.table-wrap{
    overflow:visible !important;
}

/* Tighten gap between page-header and content on IBKR Portfolio page */
#dash-ibkrportfolio .page-header {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

#dash-ibkrportfolio .page-header p {
  margin: 4px 0 0 0 !important;
}

#dash-ibkrportfolio #ibkrContent {
  margin-top: 0 !important;
  padding-top: 8px !important;
}

/* =========================================================
   IBKR PREMIUM TOOLBAR
   ========================================================= */

.ibkr-toolbar {
    width: 100%;
    min-height: 112px;

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

    padding: 18px 24px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.012)
        ),
        #151a21;

    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 22px;

    box-sizing: border-box;

    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.025);
}


/* =========================================================
   ACCOUNT SELECTOR
   ========================================================= */

.ibkr-toolbar-account {
    flex: 0 0 auto;

    min-width: 360px;
    max-width: 430px;
}


/* =========================================================
   RIGHT SIDE
   ========================================================= */

.ibkr-toolbar-meta {
    display: flex;
    align-items: center;

    height: 100%;

    gap: 14px;
}


/* =========================================================
   STAT CARD
   ========================================================= */

.ibkr-toolbar-stat {
    min-width: 175px;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px 16px;

    background: rgba(255, 255, 255, 0.025);

    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.ibkr-toolbar-stat:hover {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(255, 255, 255, 0.10);
}


/* =========================================================
   ICON
   ========================================================= */

.ibkr-stat-icon {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

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

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.055);
}

.ibkr-stat-icon svg {
    width: 19px;
    height: 19px;

    fill: none;
    stroke: #aeb7c4;
    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =========================================================
   STAT CONTENT
   ========================================================= */

.ibkr-stat-content {
    display: flex;
    flex-direction: column;
    gap: 3px;

    min-width: 0;
}

.ibkr-stat-label {
    font-size: 11px;
    font-weight: 500;

    color: #7f8997;

    letter-spacing: 0.02em;
}

.ibkr-stat-value {
    font-size: 22px;
    line-height: 1;

    font-weight: 700;

    color: #f1f4f8;
}


/* =========================================================
   LAST SYNC
   ========================================================= */

.ibkr-sync-value {
    display: block;

    font-size: 14px;
    line-height: 1.25;

    font-weight: 700;

    color: var(--ibkr-accent-red);
}


/* =========================================================
   CONNECT BUTTON
   ========================================================= */

.ibkr-connect-btn {
    height: 48px;

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

    gap: 8px;

    padding: 0 20px;

    border: 0;
    border-radius: 12px;

    background: var(--ibkr-accent-red);
    color: #ffffff;

    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 8px 20px rgba(220, 38, 38, 0.18);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        opacity 0.18s ease;
}

.ibkr-connect-btn:hover:not(:disabled) {
    transform: translateY(-1px);

    box-shadow:
        0 10px 25px rgba(220, 38, 38, 0.28);
}

.ibkr-connect-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ibkr-connect-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.ibkr-connect-btn svg {
    width: 17px;
    height: 17px;

    fill: none;
    stroke: currentColor;

    stroke-width: 2;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =========================================================
   LIVE ACCOUNT STATUS
   ========================================================= */

.ibkr-live-status {
    min-height: 48px;

    display: flex;
    align-items: center;

    gap: 11px;

    padding: 8px 14px;

    border-radius: 12px;

    background: rgba(239, 68, 68, 0.055);

    border: 1px solid rgba(239, 68, 68, 0.14);
}


/* =========================================================
   WARNING ICON
   ========================================================= */

.ibkr-live-icon {
    width: 32px;
    height: 32px;

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

    border-radius: 9px;

    background: rgba(239, 68, 68, 0.10);
}

.ibkr-live-icon svg {
    width: 17px;
    height: 17px;

    fill: none;
    stroke: var(--ibkr-accent-red);

    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =========================================================
   LIVE CONTENT
   ========================================================= */

.ibkr-live-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ibkr-live-label {
    font-size: 11px;
    font-weight: 500;

    color: #8b94a1;
}

.ibkr-live-warning {
    font-size: 13px;
    font-weight: 700;

    color: var(--ibkr-accent-red);

    white-space: nowrap;
}

.ibkr-live-warning small {
    font-size: 11px;
    font-weight: 500;

    opacity: 0.75;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {

    .ibkr-toolbar {
        gap: 18px;
    }

    .ibkr-toolbar-account {
        min-width: 300px;
    }

    .ibkr-toolbar-stat {
        min-width: 145px;
    }

    .ibkr-live-status {
        padding: 8px 10px;
    }
}


@media (max-width: 980px) {

    .ibkr-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ibkr-toolbar-account {
        width: 100%;
        max-width: none;
    }

    .ibkr-toolbar-meta {
        width: 100%;
        flex-wrap: wrap;
    }

    .ibkr-toolbar-stat {
        flex: 1;
    }
}


@media (max-width: 650px) {

    .ibkr-toolbar {
        padding: 14px;

        border-radius: 16px;
    }

    .ibkr-toolbar-meta {
        display: grid;

        grid-template-columns: 1fr 1fr;
    }

    .ibkr-toolbar-stat {
        min-width: 0;
    }

    .ibkr-connect-btn {
        width: 100%;
    }

    .ibkr-live-status {
        width: 100%;
        box-sizing: border-box;
    }
}

/* =========================================
   RESPONSIVE MULTI-ROW PORTFOLIO TABLE
   ========================================= */

.ibkr-portfolio-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}

.ibkr-portfolio-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: separate;
    border-spacing: 0;
}

/* Keep every row intact */
.ibkr-portfolio-table tbody tr {
    width: 100%;
}

/* Keep cells from collapsing */
.ibkr-portfolio-table th,
.ibkr-portfolio-table td {
    white-space: nowrap;
    box-sizing: border-box;
}

/* =========================================
   TABLET
   ========================================= */

@media (max-width: 1100px) {

    .ibkr-portfolio-table {
        min-width: 950px;
    }

    .ibkr-portfolio-table-wrap {
        overflow-x: auto !important;
    }
}


/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 700px) {

    .ibkr-portfolio-table-wrap {
        overflow-x: auto !important;
        width: 100%;
    }

    /*
       IMPORTANT:
       Keep multiple rows as normal table rows.
       Do NOT use display:block on tr/td.
    */

    .ibkr-portfolio-table {
        min-width: 900px;
        width: 900px;
    }

    .ibkr-portfolio-table th,
    .ibkr-portfolio-table td {
        padding: 12px 14px !important;
    }

    .ibkr-portfolio-table th {
        font-size: 10px !important;
    }

    .ibkr-portfolio-table td {
        font-size: 13px;
    }

    /* Make symbol slightly wider */
    .ibkr-portfolio-table th:first-child,
    .ibkr-portfolio-table td:first-child {
        min-width: 125px;
    }

    /* Asset */
    .ibkr-portfolio-table th:nth-child(2),
    .ibkr-portfolio-table td:nth-child(2) {
        min-width: 80px;
    }

    /* Quantity */
    .ibkr-portfolio-table th:nth-child(3),
    .ibkr-portfolio-table td:nth-child(3) {
        min-width: 85px;
    }

    /* Prices */
    .ibkr-portfolio-table th:nth-child(4),
    .ibkr-portfolio-table td:nth-child(4),
    .ibkr-portfolio-table th:nth-child(5),
    .ibkr-portfolio-table td:nth-child(5) {
        min-width: 105px;
    }

    /* Market value */
    .ibkr-portfolio-table th:nth-child(6),
    .ibkr-portfolio-table td:nth-child(6) {
        min-width: 125px;
    }

    /* P&L */
    .ibkr-portfolio-table th:nth-child(7),
    .ibkr-portfolio-table td:nth-child(7) {
        min-width: 115px;
    }

    /* P&L % */
    .ibkr-portfolio-table th:nth-child(8),
    .ibkr-portfolio-table td:nth-child(8) {
        min-width: 90px;
    }

    /* Actions */
    .ibkr-portfolio-table th:nth-child(9),
    .ibkr-portfolio-table td:nth-child(9) {
        min-width: 150px;
    }
}