.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.language-toggle {
  min-width: 42px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0c1b2b;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
}

.language-toggle:hover { border-color: var(--cyan); }

a[href],
button:not(:disabled),
select,
summary,
[role="button"],
label:has(input[type="checkbox"]),
label:has(input[type="radio"]) { cursor: pointer; }

button:disabled { cursor: not-allowed; }

.account-row[role="button"]:hover,
.account-row[role="button"]:focus-visible { background: #102238; outline: 1px solid #4bd7c855; }

.filter-bar {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.filter-bar .eyebrow { margin-bottom: 7px; }
.filter-groups { display: flex; flex-wrap: wrap; gap: 9px; }
.filter-popover { position: relative; }
.filter-popover summary {
  min-width: 170px;
  list-style: none;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #081421;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  user-select: none;
}
.filter-popover summary::-webkit-details-marker { display: none; }
.filter-popover summary::after { content: "⌄"; position: absolute; right: 12px; color: var(--cyan); }
.filter-popover[open] summary { border-color: var(--cyan); }
.filter-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 12;
  width: min(320px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1727;
  box-shadow: 0 18px 50px #000a;
}
.filter-popover:last-child .filter-menu { right: 0; left: auto; }
.filter-options { display: grid; gap: 4px; max-height: 250px; overflow: auto; }
.filter-option { display: flex; align-items: center; gap: 9px; padding: 11px 9px; border-radius: 8px; font-size: 13px; }
.filter-option:hover { background: #142538; }
.filter-option input { width: 16px; height: 16px; accent-color: var(--cyan); }
.filter-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.filter-actions button { min-height: 36px; border: 0; border-radius: 7px; padding: 9px 10px; background: #142538; color: var(--cyan); font-size: 11px; font-weight: 750; }

.filtered-empty {
  min-height: 48vh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}
.filtered-empty > span { color: var(--cyan); font-size: 34px; }
.filtered-empty h3 { margin: 13px 0 7px; font-size: 23px; }
.filtered-empty p { max-width: 520px; margin: 0; color: var(--muted); }

.history-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 8px 0 18px; }
.history-heading h2 { margin: 0 0 5px; font-size: 28px; }
.history-heading p { margin: 0; }
.history-search { position: relative; display: block; margin-bottom: 14px; }
.history-search > span { position: absolute; left: 14px; top: 10px; color: var(--muted); font-size: 20px; }
.history-search input {
  width: 100%;
  padding: 12px 14px 12px 43px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #081421;
  color: var(--text);
}
.history-search input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #4bd7c815; }
.history-table { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.history-row { grid-template-columns: 1.15fr 1.2fr .65fr .6fr .8fr .8fr .8fr 1fr; }
.history-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.history-pagination .button { min-width: 100px; }

.environment-help {
  padding: 12px 14px;
  border: 1px solid #60a5fa40;
  border-radius: 11px;
  background: #102238;
  color: #b8cbe5;
  font-size: 12px;
  line-height: 1.5;
}

.environment-help.unsupported {
  border-color: #fb718566;
  background: #351621;
  color: #fecdd3;
}

.detail-table-row,
.detail-order-row,
.detail-trade-row {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

@media (min-width: 1181px) {
  .detail-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .sidebar nav { grid-template-columns: repeat(5, 1fr); }
  .top-actions { gap: 8px; }
  .top-actions .language-toggle { display: inline-block; padding: 7px 8px; font-size: 10px; }
  .nav-link span[data-i18n] { font-size: 10px; }
  .filter-groups { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .filter-popover summary { min-width: 0; }
  .filter-menu { width: min(310px, calc(100vw - 28px)); }
  .history-heading { align-items: start; flex-direction: column; }
  .history-table { border: 0; background: transparent; display: grid; gap: 10px; }
  .history-row { display: grid; grid-template-columns: 1fr 1fr !important; border: 1px solid var(--line) !important; border-radius: 14px; background: var(--surface); padding: 15px; }
  .history-row > * { display: block !important; }
  .history-row > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .top-actions .button { font-size: 12px; }
  .top-actions .button::after { content: none; }
}
