

/* ---------- Tables ---------- */

html body .table-wrap {
  border-radius: 12px;
  padding: 0.15rem 0.5rem 0.1rem !important;
}

html body table.table {
  border-collapse: separate;
  border-spacing: 0;
}

html body table.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.55rem 0.65rem;
  background: #f7f9fc !important;
  border-bottom: 1px solid #e8edf5 !important;
  color: var(--ui-muted) !important;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

html body table.table tbody td {
  padding: 0.52rem 0.65rem;
  border-bottom: 1px solid #f1f4f8;
  background: transparent;
  color: #1e293b;
  font-size: 0.83rem;
}

html body .num,
html body table.table th.num,
html body table.table td.num,
html body table.table td.kpi-positive,
html body table.table td.kpi-negative,
html body table.table td.num-flat,
html body table.table td.num-up,
html body table.table td.num-down {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

html body table.table th.num.is-sortable {
  padding-right: 1.4rem;
}

html body table.table tbody tr:nth-child(even) td {
  background: transparent;
}

html body table.table tbody tr:hover td,
html body table.table tbody tr:nth-child(even):hover td {
  background: #f7f9ff !important;
}

html body table.table tbody tr:last-child td {
  border-bottom: 0;
}

html body table.table a {
  color: var(--ui-accent-deep);
  font-weight: 600;
}

html body table.table th.is-sortable::after {
  right: 0.35rem;
  font-size: 0.6rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

html body table.table th.is-sortable:hover::after {
  opacity: 0.45;
}

html body table.table th.is-sortable.sort-asc::after,
html body table.table th.is-sortable.sort-desc::after {
  opacity: 0.8;
}

html body table.table .form-control,
html body table.table .form-select {
  min-height: 30px;
  height: 30px;
  padding: 0.12rem 0.45rem;
  border-radius: 7px;
  font-size: 0.8rem;
}

html[data-theme="dark"] body table.table thead th {
  background: #0b1424 !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
  color: #8b9bb4 !important;
}

html[data-theme="dark"] body table.table tbody td {
  border-bottom-color: rgba(148, 163, 184, 0.09);
  color: #dbe5f3;
}

html[data-theme="dark"] body table.table tbody tr:hover td,
html[data-theme="dark"] body table.table tbody tr:nth-child(even):hover td {
  background: rgba(96, 165, 250, 0.08) !important;
}

/* Pagination footer */
html body .table-paginate {
  padding: 0.5rem 0.55rem;
  border-top: 1px solid #eef1f6;
  color: var(--ui-muted);
  font-size: 0.76rem;
}

html body .table-paginate__btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border-color: var(--ui-border);
  background: #ffffff;
  color: var(--ui-text);
}

html body .table-paginate__btn:not(:disabled):hover {
  border-color: #bcd0f3;
  background: var(--ui-accent-soft);
  color: var(--ui-accent-deep);
}

html body .table-paginate__pagesize {
  height: 28px;
  border-radius: 8px;
  border-color: var(--ui-border);
  background: #ffffff;
  color: var(--ui-text);
}

html[data-theme="dark"] body .table-paginate {
  border-top-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] body .table-paginate__btn,
html[data-theme="dark"] body .table-paginate__pagesize {
  border-color: rgba(148, 163, 184, 0.22);
  background: #111a2b;
  color: #c7d2e3;
}

/* ---------- Buttons ---------- */

html body .btn {
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  box-shadow: none;
}

html body .btn:hover,
html body .btn:focus-visible {
  transform: none;
}

html body .btn:disabled,
html body .btn.disabled {
  border-color: var(--ui-border) !important;
  background: #f1f5f9 !important;
  color: var(--ui-subtle) !important;
  box-shadow: none !important;
  opacity: 1;
  cursor: not-allowed;
}

html[data-theme="dark"] body .btn:disabled,
html[data-theme="dark"] body .btn.disabled {
  border-color: rgba(148, 163, 184, 0.16) !important;
  background: rgba(148, 163, 184, 0.08) !important;
  color: #6b7c96 !important;
}

html body .btn-primary {
  border: 1px solid var(--ui-accent-deep);
  background: var(--ui-accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08),
              0 8px 18px -12px rgba(37, 99, 235, 0.9);
}

html body .btn-primary:hover,
html body .btn-primary:focus-visible {
  border-color: #1e40af;
  background: #1d4ed8;
  color: #ffffff;
}

html body .btn-outline-primary {
  border-color: #cdddfb;
  background: #ffffff;
  color: var(--ui-accent-deep);
}

html body .btn-outline-primary:hover,
html body .btn-outline-primary:focus-visible {
  border-color: #a9c4f5;
  background: var(--ui-accent-soft);
  color: var(--ui-accent-deep);
}

html body .btn-outline-secondary {
  border-color: var(--ui-border);
  background: #ffffff;
  color: var(--ui-text);
}

html body .btn-outline-secondary:hover,
html body .btn-outline-secondary:focus-visible {
  border-color: var(--ui-border-strong);
  background: #f8fafc;
  color: var(--ui-ink);
}

html body .btn-outline-danger {
  border-color: #fecdd3;
  background: #ffffff;
  color: #be123c;
}

html body .btn-outline-danger:hover,
html body .btn-outline-danger:focus-visible {
  border-color: #fda4af;
  background: #fff1f2;
  color: #9f1239;
}

html body .btn-sm {
  min-height: 30px;
  padding-inline: 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

html body .btn-outline-light {
  border-color: var(--ui-border);
  background: #ffffff;
  color: var(--ui-text);
}

html[data-theme="dark"] body .btn-primary {
  border-color: #3b82f6;
  background: #2563eb;
  box-shadow: 0 8px 22px -14px rgba(37, 99, 235, 0.9);
}

html[data-theme="dark"] body .btn-primary:hover {
  background: #1d4ed8;
}

html[data-theme="dark"] body .btn-outline-primary,
html[data-theme="dark"] body .btn-outline-secondary,
html[data-theme="dark"] body .btn-outline-danger {
  border-color: rgba(148, 163, 184, 0.24);
  background: #111a2b;
  color: #c7d2e3;
}

html[data-theme="dark"] body .btn-outline-primary:hover,
html[data-theme="dark"] body .btn-outline-secondary:hover {
  border-color: rgba(148, 163, 184, 0.4);
  background: #16223a;
  color: #ffffff;
}

html[data-theme="dark"] body .btn-outline-danger:hover {
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
  color: #fecdd3;
}

/* ---------- Form controls ---------- */

html body .form-control,
html body .form-select,
html body textarea.form-control {
  min-height: 38px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 10px;
  background-color: #ffffff;
  color: var(--ui-ink);
  font-size: 0.84rem;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.02);
}

html body .form-control::placeholder {
  color: #a8b3c4;
}

html body .form-control:focus,
html body .form-select:focus,
html body textarea.form-control:focus {
  border-color: #93b4f8;
  background-color: #ffffff;
  color: var(--ui-ink);
  box-shadow: var(--ui-ring);
}

html body .form-label {
  margin-bottom: 0.3rem;
  color: var(--ui-text);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

html[data-theme="dark"] body .form-control,
html[data-theme="dark"] body .form-select,
html[data-theme="dark"] body textarea.form-control {
  border-color: rgba(148, 163, 184, 0.24);
  background-color: #0f1929;
  color: #e8eefb;
}

html[data-theme="dark"] body .form-control:focus,
html[data-theme="dark"] body .form-select:focus {
  border-color: rgba(96, 165, 250, 0.55);
  background-color: #0f1929;
}

html body .form-text,
html body .form-note,
html body .helper-note {
  color: var(--ui-muted);
  font-size: 0.76rem;
}

html body .form-hint {
  margin-top: 0.3rem;
  color: var(--ui-subtle);
  font-size: 0.68rem;
  line-height: 1.4;
}

html body .position-edit-lots,
html body .position-edit-entry {
  text-align: right;
}

html body .form-control.is-invalid,
html body .form-select.is-invalid {
  border-color: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}

html body .param-field .form-label {
  margin-bottom: 0.32rem;
  font-size: 0.76rem;
  font-weight: 600;
}

html body .strategy-advanced-json > summary.card-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

html body .strategy-advanced-json .card-body {
  border-top: 1px solid var(--ui-border);
}

html body .form-check-label {
  color: var(--ui-text);
  font-size: 0.8rem;
}

html body .form-check-input {
  border-color: var(--ui-border-strong);
}

html body .form-check-input:checked {
  border-color: var(--ui-accent);
  background-color: var(--ui-accent);
}

html body .form-check-input:focus {
  border-color: #93b4f8;
  box-shadow: var(--ui-ring);
}

html[data-theme="dark"] body .form-check-input {
  border-color: rgba(148, 163, 184, 0.36);
  background-color: #0f1929;
}