/* ArtemisMatch: styles shared by every page. Colours come from themes.css. */

/*
 * Density. Traders share their screens with other applications, so signed-in pages
 * start small and leave little empty space; traders can still zoom. Bootstrap sizes
 * text, padding, buttons and form controls from the root size, so this one value
 * scales the whole app. Change it here, nowhere else.
 */
html.dense {
    font-size: 12px;
}

html.dense body {
    line-height: 1.3;
}

html.dense .app-bar {
    --bs-navbar-padding-y: 0.15rem;
}

html.dense .app-bar .navbar-brand {
    font-size: 1.15rem;
    padding: 0;
}

html.dense .app-bar .btn {
    --bs-btn-padding-y: 0.1rem;
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-font-size: 0.9rem;
}

/* Compact tables: minimal padding, figures aligned */
.table-dense {
    font-variant-numeric: tabular-nums;
}

.table-dense > :not(caption) > * > * {
    padding: 0.08rem 0.3rem;
}

.table-dense thead th {
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.15;
}

.table-dense .btn {
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 0.35rem;
    --bs-btn-font-size: 0.9rem;
}

/* Panel headers: one tight line */
.panel-header {
    padding: 0.15rem 0.4rem;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.panel-header .badge {
    font-weight: 500;
}

.panel-actions {
    gap: 0.25rem;
}

.panel-actions .btn {
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 0.4rem;
    --bs-btn-font-size: 0.85rem;
}

.login-container {
    max-width: 400px;
    margin-top: 12vh;
}

/* Signed-out pages: slow yield curves behind the form (public/assets/js/backdrop.js),
   drawn in the theme's colours. The form keeps a solid panel so it reads cleanly. */
.signin-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.signin-main {
    position: relative;
    z-index: 1;
}

.signin-main .card {
    background-color: var(--am-panel-bg);
    border-color: var(--am-panel-border);
}

/* The main button in the theme's accent (the blue of the curves), not Bootstrap's */
.signin-main .btn-primary {
    --bs-btn-bg: var(--am-bid);
    --bs-btn-border-color: var(--am-bid);
    --bs-btn-color: var(--am-panel-bg);
    --bs-btn-hover-bg: var(--am-bid);
    --bs-btn-hover-border-color: var(--am-bid);
    --bs-btn-hover-color: var(--am-panel-bg);
    font-weight: 600;
}

.brand-logo {
    max-width: 260px;
    max-height: 80px;
}

/* The current sign-in logo on the Firm page, small */
.firm-logo-preview {
    max-width: 160px;
    max-height: 40px;
}

.code-form {
    max-width: 300px;
}

.w-40 {
    width: 40%;
}

.license-key {
    font-family: monospace;
    font-size: 0.8em;
}

/* Market panel: outrights on the left, spread grid on the right, one table */

.market-panel {
    position: relative;
}

/* Messages float over the panel instead of pushing the prices down */
.panel-messages {
    position: absolute;
    top: 1.8rem;
    right: 0.4rem;
    z-index: 5;
    max-width: 60%;
}

.panel-messages .alert {
    padding: 0.15rem 0.5rem;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.3);
}

.price-table .instrument {
    font-weight: 500;
    white-space: nowrap;
}

.price-table thead tr.group th {
    border-bottom: 0;
    padding-bottom: 0;
    color: var(--am-size);
    font-weight: 400;
    font-size: 0.85em;
}

.price-table .price {
    position: relative;
    white-space: nowrap;
}

/* Prices as TradeMatchUI's market page shows them (pages/market.css): each in a box like
   an input box; a live screen bid on a green pill and offer on a red one; the mid gold
   with auction interest on both sides, underlined green with interest on one; an implied
   price in amber. The script sets the classes (live, interest-both, interest-one,
   implied). */
.price-table [data-field="bid"],
.price-table [data-field="ask"],
.price-table [data-field="mid"] {
    display: inline-block;
    /* A fixed width, room for a price like "1,176.50": a longer one is cut off in its box
       rather than widening the column, so boxes line up from one panel to the next. */
    width: 4.25em;
    overflow: hidden;
    white-space: nowrap;
    min-height: calc(1.3em - 2px);
    line-height: calc(1.25em - 2px);
    font-size: 0.92em;
    vertical-align: middle;
    padding: 0 0.15em;
    text-align: center;
    color: var(--bs-body-color);
    background-color: var(--am-price-box);
    border: 1px solid var(--am-price-box-border);
    border-radius: 2px;
}

.price-table .spread-cell [data-field="bid"],
.price-table .spread-cell [data-field="ask"],
.price-table .spread-cell [data-field="mid"] {
    width: 4.25em;
}

.price-table [data-field="bid"].live {
    color: var(--am-live-text);
    background-color: var(--am-live-bid);
    border-color: var(--am-live-bid);
    border-radius: 4px;
}

.price-table [data-field="ask"].live {
    color: var(--am-live-text);
    background-color: var(--am-live-ask);
    border-color: var(--am-live-ask);
    border-radius: 4px;
}

.price-table [data-field="mid"].interest-one {
    border-bottom: 3px solid var(--am-interest-side);
}

.price-table [data-field="mid"].interest-both {
    color: var(--am-interest-text);
    background-color: var(--am-interest);
    border-color: var(--am-interest-border);
}

/* Fixed column widths, as TradeMatchUI's fixed-width outrights panel: the table does not
   stretch to the panel, so the same columns line up from one market's panel to the next;
   spare width is left on the right. A longer name or size than usual still fits (the
   widths are minimums). */
.price-table {
    width: auto;
}

.price-table > tbody > tr > th.instrument,
.price-table > thead > tr > th:first-child {
    width: 5em;
    min-width: 5em;
}

/* The instrument names, in the outrights and down the side of the spreads, shaded
   lightly from top to bottom as the tables' row headings (the theme's --am-label-shade:
   a touch of grey on light themes, a touch darker on dark ones). Drawn as an inset shadow
   over the row stripe (Bootstrap's own inset shadow), so it shows on every row even where
   a theme's stripes are solid. The fixed spread labels do the same in their own rule. */
.outrights-table > thead > tr > th:first-child,
.outrights-table > tbody > tr > th.instrument {
    box-shadow: inset 0 0 0 9999px var(--am-label-shade),
        inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
}

/* Sizes in the millions; a desk admin's "3 clients" in the auction columns */
.price-table > tbody > tr > td.size {
    width: 5em;
    min-width: 5em;
}

.price-table > tbody > tr > td.auction-interest {
    width: 3em;
    min-width: 3em;
}

.price-table > tbody > tr > td.price {
    width: 5.8em;
    min-width: 5.8em;
}

.price-table > tbody > tr > td.price.auction {
    width: 7em;
    min-width: 7em;
}

.price-table > tbody > tr > td.spread,
.price-table > tbody > tr > td.spread-empty {
    width: 15.2em;
    min-width: 15.2em;
}

/* Outrights and spreads side by side, as TradeMatchUI's two blocks: the outrights stay
   put, the spreads scroll sideways on their own. The browser's scrollbar for the spreads
   is hidden; a slim bar of our own lies over the bottom of their last row, so it adds no
   height (market-panel.js draws it, and keeps the two tables' rows level). */
.price-area {
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
}

.price-outrights {
    flex: none;
}

.price-spreads {
    position: relative;
    flex: 0 1 auto;
    min-width: 0;
}

.price-spreads-scroll {
    overflow-x: auto;
    scrollbar-width: none;
}

.price-spreads-scroll::-webkit-scrollbar {
    display: none;
}

/* The spreads' first column: the near leg, fixed while the spreads scroll beneath it.
   It needs a solid background; the row stripes still show (Bootstrap draws them as a
   shadow inside each cell). Faint lines either side, as between the other columns. */
.spreads-table > * > tr > .spread-label {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 4em;
    min-width: 4em;
    max-width: 6em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    background-color: var(--am-panel-bg);
    /* Lines drawn inside the cell: a sticky cell's borders stay behind when it moves. */
    box-shadow: inset 1px 0 0 var(--bs-border-color), inset -1px 0 0 var(--bs-border-color),
        inset 0 0 0 9999px var(--am-label-shade),
        inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
    padding-left: 0.4rem;
}

.spreads-table .spread-start {
    border-left: 0;
}

/* Faint lines between the spread columns (one per far leg) */
.spreads-table > * > tr > .spread-col + .spread-col {
    border-left: 1px solid var(--bs-border-color);
}

.spread-scrollbar {
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 1px;
    height: 4px;
    border-radius: 2px;
    background-color: var(--am-stripe);
    cursor: pointer;
}

.spread-scrollbar-thumb {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 2px;
    background-color: var(--bs-secondary-color);
    opacity: 0.55;
    cursor: grab;
}

.spread-scrollbar:hover .spread-scrollbar-thumb {
    opacity: 0.9;
}

/* Faint lines between the screen and auction sections */
.price-table .section-start {
    border-left: 1px solid var(--bs-border-color);
}

.price-table [data-action] {
    cursor: pointer;
}

.price-table span[data-action]:hover,
.price-table span[data-action]:focus {
    text-decoration: underline;
}

/* "+" buttons: always visible but faint, so they are easy to find without competing
   with the prices; brighter on hover. Kept narrow: no padding beyond a hair. */
.price-table .add {
    padding: 0 0.1rem;
    font-size: 1em;
    line-height: 1;
    vertical-align: baseline;
    text-decoration: none;
    color: var(--bs-secondary-color);
    opacity: 0.35;
}

.price-table tr:hover .add {
    opacity: 0.6;
}

.price-table .add:hover,
.price-table .add:focus {
    color: var(--am-hover);
    opacity: 1;
}

.price-table .size {
    color: var(--am-size);
}

.price-table .own,
.price-table .has-own {
    font-weight: 600;
    color: var(--am-own);
}

/* An implied price (brokers only): derived from spreads, not a direct order; amber, as in
   TradeMatchUI, and it opens the orders behind it */
.price-table [data-field].implied {
    color: var(--am-implied);
    cursor: pointer;
}

/* Traders: orders at the best price come from traders they are restricted from */
/* Restricted prices, as TradeMatchUI marks them: X when every order at the price is from
   a trader you cannot trade with (it cannot be clicked), ! when some are. */
.price-table [data-field].restricted-full::after,
.price-table [data-field].restricted-partial::after {
    margin-left: 0.2em;
    font-weight: 700;
}

.price-table [data-field].restricted-full::after {
    content: "X";
    color: var(--am-ask);
}

.price-table [data-field].restricted-partial::after {
    content: "!";
    color: var(--am-warning);
}

.price-table [data-field].restricted-full {
    cursor: not-allowed;
}

/* Your client is first at the best price (TradeMatchUI's "ownprice"): a ring round the price */
.price-table [data-field].ownprice {
    font-weight: 700;
    outline: 2px solid var(--bs-link-color);
    outline-offset: 1px;
}

/* Every price box, outright or spread, sits in a price-wrap: exactly the size of the box,
   so things placed on it (a trader's dot, a spread's magnifying glass) are placed
   against the box itself, the same way everywhere and whatever the cell's padding (a
   Bonds row has extra room above for the yield). */
.price-table .price-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* A trader's dot: they have orders at this price; it opens them. As TradeMatchUI, on the
   top-right corner of the price box. */
.price-table .own-orders {
    position: absolute;
    top: -0.67em;
    right: -0.35em;
    z-index: 2;
    font-size: 1.2em;
    line-height: 1;
    color: var(--am-bid);
    text-shadow: 0 0 2px var(--am-panel-bg);
    cursor: pointer;
}

/* Bonds: the yield just above the price, laid over the top of the cell as TradeMatchUI
   does, so it adds little height. Lined up with the price box: the bid's box is at the
   right of its cell, the offer's at the left, the mid's in the middle. Bonds rows get a
   little more top padding to make room. */
.price-table .price .yld {
    position: absolute;
    top: 0.05em;
    width: 6.2em;
    font-size: 0.65em;
    line-height: 1;
    text-align: center;
    color: var(--am-size);
    /* Selectable, as in TradeMatchUI: a double-click picks the yield to copy */
    cursor: text;
    user-select: text;
}

.price-table .price.bid .yld {
    right: 0.4em;
}

.price-table .price.ask .yld {
    left: 0.4em;
}

.price-table .price.auction .yld {
    left: 50%;
    transform: translateX(-50%);
}

.price-table.bonds > tbody > tr > td.price {
    padding-top: 0.5em;
}

/* Sizes, names and price boxes share the row's middle line */
.price-table > tbody > tr > * {
    vertical-align: middle;
}

/* Everything in a Bonds row lines up with the price boxes, below the yields */
.price-table.bonds > tbody > tr > * {
    vertical-align: bottom;
}

.price-table [data-popup]:not(:empty) {
    cursor: pointer;
}

/* Pop-ups on the prices (depth, rankings, your orders) */
.popup-box {
    min-width: 12rem;
}

.popup-title {
    text-align: center;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.popup-depth th,
.popup-depth td {
    padding: 0.1rem 0.4rem;
}

.depth-split {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8em;
}

.depth-bar {
    flex: 1;
    height: 5px;
    background: var(--am-ask);
    border-radius: 2px;
    overflow: hidden;
}

.depth-bar-bid {
    height: 100%;
    background: var(--am-bid);
}

.depth-bid {
    color: var(--am-bid);
}

.depth-ask {
    color: var(--am-ask);
}

/* Desk admins: several clients are interested in the auction */
.price-table .auction-warning {
    color: var(--am-warning);
    font-weight: 600;
}

/* The spread grid */
.price-table .spread {
    padding: 0.05rem 0.25rem;
}

.price-table .spread-empty {
    background: transparent;
}


/* A spread: one row of prices, as TradeMatchUI's spreads; the magnifying glass opens its depth */
/* Only as wide as its boxes and "+" buttons, centred in the cell */
.price-table .spread {
    text-align: center;
}

.spread-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
    vertical-align: middle;
    white-space: nowrap;
    line-height: 1.3;
}

.spread-cell [data-field] {
    min-height: calc(1.3em - 2px);
}

/* The magnifying glass floats on the bid box's top-left corner (its price-wrap), taking
   no room, so the boxes stay lined up from one spread to the next (TradeMatchUI's
   bidsearch icon) */
.spread-cell .spread-depth {
    position: absolute;
    top: -0.6em;
    left: -0.5em;
    z-index: 2;
    font-size: 0.8em;
    line-height: 1;
    color: var(--bs-secondary-color);
    cursor: pointer;
}

.spread-cell .spread-depth:hover {
    color: var(--am-hover);
}

/* Quiet spreads (no orders, no auction interest) are dimmed when "All spreads" is on */
.price-table .spread:not(.active-spread) .spread-cell {
    opacity: 0.6;
}

.price-table [data-field].changed,
.price-table td.changed {
    animation: price-changed 1.2s ease-out;
}

@keyframes price-changed {
    from { background-color: var(--am-flash); }
    to { background-color: transparent; }
}

/* A price that has gone up flashes green, down red (TradeMatchUI's flashup / flashdown) */
.price-table [data-field].changed-up,
.price-table td.changed-up {
    animation: price-up 2s ease-out;
}

.price-table [data-field].changed-down,
.price-table td.changed-down {
    animation: price-down 2s ease-out;
}

@keyframes price-up {
    0%, 60% { background-color: var(--am-flash-up); }
    100% { background-color: transparent; }
}

@keyframes price-down {
    0%, 60% { background-color: var(--am-flash-down); }
    100% { background-color: transparent; }
}

/* A live pill keeps its colour when its price changes: it brightens instead, as in
   TradeMatchUI (flashmode2liveprice) */
.price-table [data-field].live.changed,
.price-table [data-field].live.changed-up,
.price-table [data-field].live.changed-down {
    animation: price-live 2s linear;
}

@keyframes price-live {
    0%, 60% { filter: brightness(1.8); }
    100% { filter: brightness(1); }
}

/* Workspace: panels in a Gridstack grid, each filling its grid cell and scrolling inside it */

.workspace .grid-stack {
    min-height: 2rem;
}

/* Not clipped, so the panel's shadow shows; the panel itself scrolls inside (below). */
.workspace .grid-stack-item-content {
    overflow: visible !important;
}

.workspace .grid-stack-item-content > .market-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workspace .market-panel > .card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.workspace .panel-header {
    cursor: move;
}

/* "Layout saved": shown, then faded out (workspace.js) */
[data-role="save-state"] {
    transition: opacity 0.6s ease;
}

[data-role="save-state"].save-state-faded {
    opacity: 0;
}

.workspace .panel-header button,
.workspace .panel-header select {
    cursor: pointer;
}

/* Event strip: the last few market events under a panel's prices */

.event-strip {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.9em;
    line-height: 1.25;
    background-color: var(--am-header-bg);
    border-top-color: var(--am-panel-border);
}

.event-lines {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.event-lines li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsed: only the last 1, 2 or 3 lines */
.event-strip.lines-1:not(.expanded) .event-lines li:nth-last-child(n+2),
.event-strip.lines-2:not(.expanded) .event-lines li:nth-last-child(n+3),
.event-strip.lines-3:not(.expanded) .event-lines li:nth-last-child(n+4) {
    display: none;
}

/* Expanded: the whole day, scrolling */
.event-strip.expanded .event-lines {
    max-height: 12em;
    overflow-y: auto;
}

.event-strip.expanded .event-lines li {
    white-space: normal;
}

.event-time {
    color: var(--am-size);
    margin-right: 0.35em;
    font-variant-numeric: tabular-nums;
}

.event-none {
    color: var(--am-size);
}

.event-match { color: var(--am-good); font-weight: 600; }
.event-approved { color: var(--am-good); }
.event-mid { color: var(--am-mid); }
.event-notice { color: var(--am-alert); }

.event-lines li.event-new {
    animation: price-changed 2s ease-out;
}

.event-tools {
    display: flex;
    gap: 0.2rem;
    flex: 0 0 auto;
}

.event-tools .btn {
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 0.2rem;
    --bs-btn-font-size: 0.9em;
    text-decoration: none;
    color: var(--am-size);
}

.event-tools .btn:hover,
.event-tools .btn[aria-expanded="true"] {
    color: var(--am-hover);
}

/* Matches */

.matches-table .match-pending > td {
    background-color: var(--am-stripe);
}

.matches-table td > div + div {
    margin-top: 0.1rem;
}

/* Orders and matches tabs under the panels (src/views/market/tables.php) */

.tables-header {
    padding: 0.15rem 0.4rem 0;
}

.market-tabs {
    border-bottom: 0;
    font-size: 0.9rem;
}

.market-tabs .nav-link {
    padding: 0.2rem 0.8rem;
    margin-right: 0.5rem;
}

/* TradeMatchUI's count badge at the top right of the Matched Orders tab */
.market-tabs .tab-badge {
    top: 0.35rem;
    left: 100%;
    font-size: 0.7rem;
}

/* Each tab: the table between its bars, with room around them */
.market-tables .tab-pane {
    padding: 0.5rem 0.75rem;
}

.market-tables .tab-pane .table-responsive {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-sm);
}

.market-tables .table > :not(caption) > * > * {
    padding: 0.25rem 0.5rem;
}

/* Every row at least this tall (a cell's height is its minimum), whatever is in it */
.market-tables .table > tbody > tr > td {
    height: 2rem;
}

.market-tables .table > tbody > tr:last-child > * {
    border-bottom-width: 0;
}

/* Row buttons (Modify, Cancel, Process) no taller than a line of text, so every row,
   and the blank ones below, are the same height */
.market-tables tbody .btn-sm {
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 0.4rem;
    --bs-btn-font-size: 0.8rem;
    --bs-btn-border-width: 0;
    line-height: 1.25;
    box-shadow: inset 0 0 0 1px var(--bs-btn-border-color);
}

/* Blank rows that keep a short page as tall as a full one */
.market-tables .table > tbody > tr.filler-row > * {
    --bs-table-bg-type: transparent;
    --bs-table-bg-state: transparent;
    border-bottom-color: transparent;
}

.table-pager {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0 0.4rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.table-pager-bottom {
    padding: 0.4rem 0 0;
}

/* Above the table the filter is on the right; below it the page buttons are */
.table-pager .pager-filter {
    margin-left: auto;
}

.table-pager .pager-size {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
}

/* The page size and the filter: the same height */
.table-pager .form-select,
.table-pager .pager-filter {
    height: 1.9rem;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.85rem;
}

.table-pager .form-select {
    width: auto;
}

.table-pager .pager-filter {
    width: 16rem;
}

.table-pager .pager-nav {
    margin-left: auto;
    display: flex;
    gap: 0.2rem;
}

.table-pager .btn {
    padding: 0 0.6rem;
}

/* A group heading in a market panel (a market grouped by a field, e.g. country) */
.price-table .group-row > th {
    padding-top: 0.2rem;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bs-secondary-color);
    background-color: var(--am-header-bg);
}

/* A broker's Copy menu in a panel's title bar: each item on one line, its shortcut on
   the right; the options' tick boxes inside the menu's padding */
.copy-menu {
    min-width: 17rem;
    font-size: 0.85rem;
}

.copy-menu .dropdown-item {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    white-space: nowrap;
}

.copy-menu .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    white-space: nowrap;
    cursor: pointer;
}

.copy-menu .form-check .form-check-input {
    float: none;
    margin: 0;
}

/* Pop-up messages, every notice on every page (public/assets/js/toasts.js), drawn as
   TradeMatchUI draws them: Bootstrap's toasts in their kind's colour, in a 300px column
   top right, below the header (its footer.php: margin-top 100px, width 300px). */
.alert-toasts {
    z-index: 1090;
    margin-top: 100px;
    width: 300px;
}

/* Brokers: "n matches require attention" (TradeMatchUI's red pill) */
.match-attention {
    border: 0;
    font-size: 0.85rem;
    cursor: pointer;
}

/* A desk admin's tool dialogs */
.desk-tool-table td {
    vertical-align: middle;
}

/* TradeMatchUI's clear and copy buttons: solid, with an icon, easy to hit */
.desk-tool-button {
    --bs-btn-padding-y: 0.3rem;
    --bs-btn-padding-x: 0.65rem;
    font-size: 1.15rem;
    line-height: 1;
}

.desk-tool-button + .desk-tool-button {
    margin-left: 0.25rem;
}

/* Risk factors and mid prices tables: faint lines after the instrument and after the
   buttons (both tables have the buttons in column 5) */
#risk-form .desk-tool-table th:nth-child(2),
#risk-form .desk-tool-table td:nth-child(2),
#risk-form .desk-tool-table th:nth-child(6),
#risk-form .desk-tool-table td:nth-child(6),
#mids-form .desk-tool-table th:nth-child(2),
#mids-form .desk-tool-table td:nth-child(2),
#mids-form .desk-tool-table th:nth-child(6),
#mids-form .desk-tool-table td:nth-child(6) {
    border-left: 1px solid var(--bs-border-color);
}

/* Room between the buttons and the column before them, and the input after them */
.desk-tool-table td.desk-tool-actions {
    padding-left: 1.5rem;
    padding-right: 0.75rem;
}

.desk-bond-settings {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.desk-tool-input {
    max-width: 8rem;
}

.side-bid { color: var(--am-bid); }
.side-ask { color: var(--am-ask); }

/* Brokers: a match in the event strip opens the approval dialog */
.event-lines li[data-match] {
    cursor: pointer;
}

.event-lines li[data-match]:hover,
.event-lines li[data-match]:focus {
    text-decoration: underline;
}

.theme-picker {
    max-width: 11rem;
}

.panel-close {
    font-size: 0.6rem;
    padding: 0.3rem;
    align-self: center;
}

.workspace .grid-stack-placeholder > .placeholder-content {
    border: 1px dashed var(--am-hover);
    background: var(--am-stripe);
}

.custom-minutes {
    max-width: 12rem;
}

/* The order form, as TradeMatchUI's: narrow, the current prices in boxes (a screen price
   can be clicked to use it), and a Bid / Offer choice that turns green or red. */
.order-dialog {
    max-width: 28rem;
}

/* The instrument, the size of the heading, above its prices */
.order-instrument {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.2;
}

.order-prices .order-price {
    display: inline-block;
    min-width: 4.5rem;
    padding: 0.1rem 0.4rem;
    margin: 0 0.15rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2px;
    text-align: center;
    font-weight: 600;
}

.order-prices .order-price.clickable {
    cursor: pointer;
}

.order-prices .order-price.clickable:hover {
    border-color: var(--am-hover);
}

/* Neutral text on both; only the background shows which side is chosen */
.side-choice .btn,
.side-choice .btn:hover {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 5.5rem;
    color: var(--bs-body-color);
}

.side-choice .btn-check:checked + .side-bid {
    background-color: var(--am-status-on);
    border-color: var(--am-status-on);
    color: var(--am-status-text);
}

.side-choice .btn-check:checked + .side-ask {
    background-color: var(--am-status-off);
    border-color: var(--am-status-off);
    color: var(--am-status-text);
}

/* Administration (clients, desks, users): list on the left, detail on the right */
.admin-tabs {
    margin-bottom: 1rem !important;
}

.admin-tabs .nav-link {
    padding: 0.4rem 1rem;
}

/* Each admin tab's title, under the tabs (src/views/admin/tabs.php) */
.admin-title {
    margin-bottom: 1rem;
}

.admin-list {
    max-height: calc(100vh - 16rem);
    overflow-y: auto;
}

.admin-list .list-group-item {
    padding: 0.45rem 0.75rem;
}

/* The admin pages have room: screen space is precious on the trading screens (the
   workspace and market pages), not here (decided 3 December 2026). They reuse the
   trading screen's compact parts, so these give them back ordinary Bootstrap spacing,
   as the License page has: headers, tables, form rows and buttons. */
main:has(.admin-page),
main:has(.admin-tabs) {
    padding: 1rem 1.5rem !important;   /* the page frame's narrow trading margin, widened */
}

.admin-page .panel-header {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    font-size: 1rem;
}

.admin-page .panel-header h2 {
    font-size: 1.05rem;
}

.admin-page .table-dense:not(.instrument-grid):not(.access-grid) > :not(caption) > * > * {
    padding: 0.3rem 0.5rem;
}

.admin-page .table-dense .btn {
    --bs-btn-padding-y: 0.1rem;
    --bs-btn-padding-x: 0.5rem;
}

.admin-page .row.g-1 {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
}

.admin-page .form-label {
    margin-bottom: 0.2rem !important;
}

.admin-page .card-body > .mb-2,
.admin-page .card-body > form > .mb-2 {
    margin-bottom: 0.75rem !important;
}

.admin-list-meta {
    color: var(--bs-secondary-color);
}

/* A list as a table, one row per item (Markets): every cell is a link to the item, the
   chosen row highlighted, long text cut short with the whole of it on hover. */
.admin-list-table {
    table-layout: fixed;
}

.admin-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 500;
    color: var(--bs-secondary-color);
}

.admin-list-table td {
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-list-table td > a {
    display: block;
    padding: 0.35rem 0.5rem;
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A user's status (Users list, a client's traders, a desk's brokers): Active, Invited
   and Closed all one width, so the column lines up */
.user-status {
    display: inline-block;
    width: 4.2rem;
    text-align: center;
}

/* Secondary columns muted (Bootstrap's table colour would otherwise win) */
.admin-list-table > tbody > tr > td.admin-list-meta,
.admin-list-table > tbody > tr > td.admin-list-meta > a {
    color: var(--bs-secondary-color);
}


.admin-list-table tr[aria-current] td {
    box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--am-hover) 22%, transparent);
}

.admin-list .active .admin-list-meta {
    color: inherit;
}

/* The Platform page, laid out as TradeMatchUI's platform dashboard. Not a trading
   screen, so the panels have room: four of one height, each a title, a chart, a gap,
   and two legend rows. */
.platform-panel .card-body {
    position: relative;
    height: 200px;
}

.platform-panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0;
}

.platform-panel-menu {
    position: absolute;
    top: 0;
    right: 0;
    padding: 5px;
}

.platform-panel-menu .panel-menu {
    font-size: 1.6rem;
}

.platform-chart {
    height: 95px;
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

.legend-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.legend-name {
    flex: 1;
}

.health-good {
    color: var(--am-status-on);
}

.health-bad {
    color: var(--am-status-off);
}

/* Legend bullets match the chart series (public/assets/js/platform.js uses the same colours). */
.legend-swatch {
    display: inline-block;
    width: 1rem;
    height: 0.5rem;
    border-radius: 2px;
    margin-right: 0.5rem;
}
.legend-swatch[data-swatch="queued"],
.legend-swatch[data-swatch="load"] {
    background: var(--am-chart-1);
}

.legend-swatch[data-swatch="sent"],
.legend-swatch[data-swatch="completed"] {
    background: var(--am-chart-2);
}

.legend-swatch[data-swatch="open"],
.legend-swatch[data-swatch="memory"] {
    background: var(--am-chart-3);
}

.legend-swatch[data-swatch="failed"] {
    background: var(--am-status-off);
}

.panel-menu {
    color: var(--bs-secondary-color);
    line-height: 1;
}

.panel-menu:hover,
.panel-menu:focus {
    color: var(--bs-body-color);
}

.platform-menu {
    min-width: 15rem;
}

.platform-menu form {
    margin: 0;
}

.platform-events {
    max-height: 24rem;
    overflow-y: auto;
}

/* Broker fees on matched principal matches: the box in the approval dialog, and the fee
   shown after a leg's price in the matches tables (never part of the price). */
.match-fee-input {
    width: 6em;
}

.match-fee-note {
    color: var(--bs-secondary-color);
    font-size: 0.85em;
    margin-left: 0.3em;
}

/* A matched principal market, named in its panel's title bar (name give-up markets are not
   labelled: every market was name give-up before). Outlined in the broker colour, as the
   broker stands in the middle of each deal. */
.market-panel .broking-model-mp {
    color: var(--am-broker);
    border: 1px solid var(--am-broker);
    background-color: transparent;
    font-weight: 600;
}

/* Market status as TradeMatchUI shows it: green on, red off, grey paused, all one width. */
.status-pill {
    display: inline-block;
    width: 4.5rem;
    padding: 0.1rem 0;
    border-radius: 0.25rem;
    text-align: center;
    font-weight: 600;
    color: var(--am-status-text);
}

/* In a market panel's title bar: a little smaller, at the right */
.panel-header .status-pill {
    width: 4rem;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.5;
}

.status-pill.status-on {
    background: var(--am-status-on);
}

.status-pill.status-off {
    background: var(--am-status-off);
}

.status-pill.status-paused {
    background: var(--am-status-paused);
}

/* A market not yet activated (Markets admin page): outlined, not a status colour */
.status-pill.status-setup {
    width: auto;
    padding: 0 0.4rem;
    background: transparent;
    color: var(--bs-secondary-color);
    border: 1px solid var(--am-status-paused);
    font-weight: 500;
}

/* Admin pages: smaller; in the lists, no padding either */
.admin-page .status-pill {
    font-size: 0.8rem;
    width: 3.5rem;
}

.admin-page .status-pill.status-setup {
    width: auto;
}

.admin-list .status-pill {
    padding: 0;
}

.admin-list .status-pill.status-setup {
    padding: 0 0.3rem;
}

/* Markets admin page: the quantity boxes, each with its label above */
.quantity-box {
    min-width: 0;
}

.instrument-count {
    font-size: inherit;
    text-decoration: underline dotted;
}

/* The instrument list that opens from a market's instrument count (Tooltipster), in the theme's colours. */
.tooltipster-sidetip.tooltipster-base .tooltipster-box {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    box-shadow: var(--am-panel-shadow, none);
}

.tooltipster-sidetip.tooltipster-base .tooltipster-content {
    color: var(--bs-body-color);
    font-size: 0.9rem;
    max-height: 22rem;
    overflow-y: auto;
}

/* It opens to the right of the count (platform.js), or the left when there is no room. */
.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-background {
    border-right-color: var(--bs-body-bg);
}

.tooltipster-sidetip.tooltipster-right .tooltipster-arrow-border {
    border-right-color: var(--bs-border-color);
}

.tooltipster-sidetip.tooltipster-left .tooltipster-arrow-background {
    border-left-color: var(--bs-body-bg);
}

.tooltipster-sidetip.tooltipster-left .tooltipster-arrow-border {
    border-left-color: var(--bs-border-color);
}

.instrument-tip ol {
    padding-left: 1.4rem;
}

/* An instrument's details on its name in a market panel: as big as its content, no
   scrollbar, compact rows */
.tooltipster-sidetip.instrument-details-tip .tooltipster-content {
    max-height: none;
    overflow: visible;
    padding: 0.35rem 0.5rem;
}

.instrument-details-tip table {
    width: auto;
    font-size: 0.85rem;
}

.instrument-details-tip td,
.instrument-details-tip th {
    padding: 0.1rem 0.5rem;
    white-space: nowrap;
}

.price-table .instrument-name {
    cursor: default;
}

/* Overview (brokers and traders). Not a trading screen, so lists have room. */
.activity-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--am-status-paused);
    opacity: 0.45;
    vertical-align: middle;
}

.activity-dot.is-active {
    background: var(--am-status-on);
    opacity: 1;
}

.overview-activity {
    max-height: 30rem;
    overflow-y: auto;
}

/* Market rows stripe by market: each market (with its hidden participants row) is one tbody. */
.overview-markets > tbody:nth-of-type(odd) > tr[data-market] > * {
    --bs-table-color-type: var(--bs-table-striped-color);
    --bs-table-bg-type: var(--bs-table-striped-bg);
}

.participants-row > td {
    background: var(--bs-tertiary-bg);
    padding: 0.4rem 0.75rem;
}

.participants-table {
    background: transparent;
}

.participants-toggle {
    font-size: inherit;
    text-decoration: underline dotted;
}

/* A search box in a panel header (Restrictions). */
.admin-filter {
    max-width: 16rem;
}

.admin-page .panel-actions .btn {
    padding: 0.05rem 0.5rem;
}

/* Market access grid (Clients page): narrow, equal market columns; the trader column
   stays in place while the markets scroll sideways; cells with access get a gentle tint. */
.access-grid {
    width: auto;
}

.access-grid > * > tr > .access-trader {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: var(--am-panel-bg);
    box-shadow: inset -1px 0 0 var(--bs-border-color),
        inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
}

.access-grid .access-market,
.access-grid .access-cell {
    width: 9.5em;
    min-width: 9.5em;
    max-width: 9.5em;
}

.access-grid .access-market {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.access-grid td.has-access {
    background-color: color-mix(in srgb, var(--am-hover) 18%, transparent);
}

.access-summary {
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 0.3rem;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bs-secondary-color);
    border: 1px dashed transparent;
}

.access-cell.has-access .access-summary {
    color: var(--bs-body-color);
    font-weight: 500;
}

.access-summary:hover,
.access-summary[aria-expanded="true"] {
    border-color: var(--bs-border-color);
}

.access-menu .access-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.access-menu .access-option .form-check-input {
    margin: 0;
}

.access-check {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin: 0 0.25rem;
    cursor: pointer;
}

/* Administration: brokers and traders told apart by colour */
.admin-list .user-broker { border-left: 3px solid var(--am-broker); }
.admin-list .user-trader { border-left: 3px solid var(--am-trader); }
.admin-list .user-broker:not(.active) { background-color: color-mix(in srgb, var(--am-broker) 12%, transparent); }
.admin-list .user-trader:not(.active) { background-color: color-mix(in srgb, var(--am-trader) 12%, transparent); }
.admin-list .user-broker:not(.active):hover { background-color: color-mix(in srgb, var(--am-broker) 22%, transparent); }
.admin-list .user-trader:not(.active):hover { background-color: color-mix(in srgb, var(--am-trader) 22%, transparent); }
.user-type-broker { color: var(--am-broker); font-weight: 600; }
.user-type-trader { color: var(--am-trader); font-weight: 600; }
.admin-list .active .user-type-broker,
.admin-list .active .user-type-trader { color: inherit; }

/* Administration: the instruments grid, one row per instrument, edited in place */
.instrument-grid td { padding: 1px 2px; vertical-align: middle; }
.instrument-grid .form-control,
.instrument-grid .form-select { min-width: 7rem; padding-top: 0.05rem; padding-bottom: 0.05rem; }
.instrument-grid .col-order .form-control { min-width: 3.5rem; width: 3.5rem; }
.instrument-grid input[type="date"] { min-width: 8.5rem; }
