/* Shared control and table appearance. Load with exactly one controls theme.
   Page styles own layout; keep control sizing, colors and focus styles here. */
input,
select,
textarea,
button,
.app-button {
  box-sizing: border-box;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid var(--control-border);
  border-radius: 3px;
  background: var(--control-bg);
  color: var(--control-text);
  font: 14px Arial, sans-serif;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
select,
button,
.app-button {
  height: 28px;
}

textarea {
  min-height: 56px;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.app-button {
  cursor: pointer;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
.app-button:focus-visible {
  outline: 2px solid var(--control-focus);
  outline-offset: 1px;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled,
.app-button[aria-disabled="true"],
.app-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Selection is indicated without replacing the theme's control colors. */
button.active,
.app-button.active,
button[aria-selected="true"],
.accounts-list-item.selected > button {
  background: var(--theme-selected);
  box-shadow: inset 0 2px 0 var(--control-focus);
}

button:enabled:hover,
.app-button:not([aria-disabled="true"]):hover {
  border-color: var(--control-focus);
}

input::placeholder,
textarea::placeholder {
  color: var(--theme-muted);
  opacity: 0.75;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--control-focus);
}

.app-button-primary {
  background: var(--theme-primary);
  border-color: var(--control-focus);
  color: #ffffff;
}

/* BUY indicators and enabled positive actions share the bid accent. */
.dealer-ticket-side-options span {
  background: var(--theme-surface);
}

.app-button-success,
td.side-buy,
.dealer-ticket-side-options .dealer-side-buy {
  background: var(--theme-positive);
}

.app-button-success {
  border-color: var(--theme-positive);
}

/* Use a muted BUY accent when a positive action is unavailable.
   Ticket submit buttons use aria-disabled; other actions use native disabled. */
.app-button.app-button-success:is(:disabled, [aria-disabled="true"], .disabled) {
  background: var(--theme-positive-bg);
  border-color: var(--control-border);
  opacity: 1;
  cursor: not-allowed;
}

.login-submit-button {
  background: var(--theme-primary);
  border-color: var(--control-focus);
  color: #ffffff;
}

.app-button-danger,
td.side-sell,
.dealer-ticket-side-options .dealer-side-sell {
  background: var(--theme-negative);
  color: var(--theme-on-negative);
}

.app-button-danger {
  border-color: var(--theme-negative);
}

/* SELL follows the same enabled/disabled pattern as BUY. */
.app-button.app-button-danger:is(:disabled, [aria-disabled="true"], .disabled) {
  background: var(--theme-negative-bg);
  border-color: var(--control-border);
  color: var(--theme-on-negative);
  opacity: 1;
  cursor: not-allowed;
}

.app-button-mustard {
  background: var(--theme-warning-bg);
  border-color: var(--theme-warning);
  color: var(--theme-warning);
}

/* Text actions inside dense tables do not increase the row height. */
button.dealer-symbol-btn,
button.broker-name-link,
button.sort-button,
button.see-more,
button.see-trades-btn {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

button.see-more,
button.see-trades-btn {
  color: var(--theme-link);
}

/* Embedded price arrows share the input's 28px height. */
.ticket-price-input,
.order-price-input {
  position: relative;
  min-width: 0;
}

.ticket-price-input > input,
.order-price-input > input {
  padding-right: 26px;
  min-width: 0;
}

.ticket-price-controls,
.order-price-controls {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 22px;
  display: flex;
  flex-direction: column;
}

.ticket-price-controls > button,
.order-price-controls > button {
  flex: 1 1 0;
  min-height: 0;
  height: 13px;
  width: 100%;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--control-border);
  border-radius: 0;
  font-size: 9px;
  line-height: 1;
  color: var(--theme-muted);
}

.ticket-price-controls > button + button,
.order-price-controls > button + button {
  border-top: 1px solid var(--control-border);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--table-bg);
  color: var(--control-text);
  font: 14px Arial, sans-serif;
}

th,
td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--theme-border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--table-header);
  color: var(--theme-muted);
  font-weight: normal;
}

tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

tbody tr:hover {
  background: var(--theme-selected);
}

@font-face {
    font-family: 'Fast OMS';
    src: url(../site/fonts/FiraCode-Regular.ttf);
    font-weight: normal;
}

@font-face {
    font-family: 'Fast OMS';
    src: url(../site/fonts/FiraCode-Bold.ttf);
    font-weight: bold;
}

@font-face {
    font-family: 'Fast OMS';
    src: url(../site/fonts/FiraCode-Light.ttf);
    font-style: italic;
}

:root {
    --app-black: var(--control-text);
    --app-font-family: Arial, sans-serif;
    --app-font-size: 14px;
    --app-green: #2da20f;
    --app-red: #dd333f;
    --app-alert-danger-bg: var(--theme-negative-bg);
    --app-table-header-bg: var(--table-header);
    --app-table-header-color: var(--theme-muted);
    --app-table-header-padding: 5px 8px;
    --app-spinner-size: 28px;
    --app-spinner-border-width: 3px;
    --app-spinner-track-color: rgba(59, 130, 246, 0.2);
    --app-spinner-active-color: #3b82f6;
    --app-primary: var(--theme-link);
    --app-selected-bg: var(--theme-selected);
    --app-selected-surface: var(--theme-selected);
    --app-secondary: var(--theme-muted);
    --app-muted: var(--theme-muted);
    --app-border-color: var(--theme-border);
}

body.uat-build .uat-temporary-hidden {
    display: none !important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    font-family: var(--app-font-family);
    font-size: var(--app-font-size);
    color: var(--app-black);
    background: var(--theme-canvas);
    scrollbar-color: var(--control-border) var(--theme-canvas);
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body :where(h1, h2, h3, h4, h5, h6, p, span, div, label, a, li, small, strong, caption) {
    font-size: var(--app-font-size);
}

a {
    color: var(--theme-link);
}

.header {
    background: var(--theme-surface);
}

.header-logo,
.profile-image {
    filter: var(--theme-logo-filter);
}

table {
    table-layout: fixed;
}

.app-table-container {
    width: 100%;
    min-width: 0;
    background: var(--table-bg);
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    overflow: auto;
}

.app-table-container > table {
    margin: 0;
}

.table-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper > table {
    margin: 0;
}

.table-wrapper .app-table thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 2;
}

.app-table-container-header {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: 0;
    padding: var(--app-table-header-padding);
    border-bottom: 1px solid var(--app-border-color);
    background: var(--app-table-header-bg);
    color: var(--app-table-header-color);
    letter-spacing: 0;
}

th, td {
    white-space: nowrap;
    text-align: left;
}

.app-table-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.loading-row td,
.empty-row td,
.no-data-row td {
    height: 90px;
    text-align: center;
}

.app-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
}

.app-button:hover {
    text-decoration: none;
}

.app-modal-close {
    width: 28px;
    position: relative;
}

.app-modal-close::before,
.app-modal-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 7px;
    right: 7px;
    height: 2px;
    background: currentColor;
}

.app-modal-close::before {
    transform: rotate(45deg);
}

.app-modal-close::after {
    transform: rotate(-45deg);
}

.spinner-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.spinner {
    display: block;
    width: var(--app-spinner-size);
    height: var(--app-spinner-size);
    margin: 8px auto;
    border: var(--app-spinner-border-width) solid var(--app-spinner-track-color);
    border-top-color: var(--app-spinner-active-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.app-spinner-border,
.app-spinner-sm {
    display: inline-block;
    width: var(--app-spinner-size);
    height: var(--app-spinner-size);
    border: var(--app-spinner-border-width) solid var(--app-spinner-track-color);
    border-top-color: var(--app-spinner-active-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.app-spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.app-field-label {
    display: inline-block;
    margin-bottom: 4px;
}

.app-input,
.app-select {
    display: block;
    width: 100%;
}

.app-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.app-search-input {
    width: 100%;
    min-width: 0;
    text-transform: uppercase;
}

.app-search-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.app-check {
    display: block;
    min-height: 1.2em;
}

.app-check-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.app-check-input {
    width: 13px;
}

.app-check-label {
    margin-bottom: 0;
}

.app-input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.app-alert {
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--theme-overlay);
}

.app-modal.is-visible {
    display: block;
}

.app-modal-dialog {
    position: relative;
    width: auto;
    max-width: 800px;
    margin: 24px auto;
    pointer-events: none;
}

.app-modal-dialog-centered {
    min-height: calc(100% - 48px);
    display: flex;
    align-items: center;
}

.app-modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    outline: 0;
    pointer-events: auto;
}

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--app-border-color);
}

.app-modal-title {
    font-weight: 600;
}

.app-modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 10px;
}

.app-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid var(--app-border-color);
}

body.app-modal-open {
    overflow: hidden;
}

.section-header {
    margin-bottom: 10px;
    border-radius: 5px;
    display: grid;
    grid-template-columns: 200px auto;
    width: 100%;
}

.section-header > div:first-child {
    font-weight: bold;
}

.section-header > div:last-child {
    display: flex;
    flex-direction: row;
    gap: 5px;
    justify-content: flex-end;
}

.content {
    height: 100%;
    min-height: 0;
}

.up-color {
    color: var(--app-green);
}

.dn-color {
    color: var(--app-red);
}

.app-alert-error,
.app-alert-success {
    padding: 5px;
    border-width: 1px;
    border-style: solid;
    border-radius: 4px;
    font-weight: 400;
}

.app-alert-error {
    color: var(--app-red);
    background-color: var(--app-alert-danger-bg);
    border-color: var(--app-red);
}

.app-alert-success {
    color: var(--app-green);
    background-color: transparent;
    border-color: var(--app-green);
}

.app-alert-info {
    color: var(--theme-muted);
    background-color: var(--theme-raised);
    border-color: var(--theme-border);
}

.app-alert-fade {
    transition: opacity 0.5s ease;
    opacity: 0;
}

.app-alert-danger {
    color: var(--app-red);
    background-color: var(--app-alert-danger-bg);
    border-color: var(--app-red);
}

.status-open {
    color: var(--app-green);
}

.status-closed {
    color: var(--app-red);
}

.status-frozen {
    color: #0dcaf0;
}

.status-halted {
    color: #ffc107;
}

.status-muted {
    color: var(--theme-muted);
}

h1:focus {
    outline: none;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLj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1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--app-red);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

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