/* App-level styles. Values come from tokens.css. */

body {
  font-variant-numeric: tabular-nums;
}

.fi-shell-header,
.fi-shell-navbar {
  background-color: var(--fi-surface);
  border-color: var(--fi-rule);
  color: var(--fi-ink);
}

/* The desktop navigation toggle: a sidebar with an arrow pointing the way it will fold (Lucide's
   panel-left-close / panel-left-open, ISC licence), drawn in the text colour. */
.fi-nav-icon {
  display: block;
  width: 20px;
  height: 20px;
  background-color: var(--fi-ink-2);
  -webkit-mask: var(--fi-nav-icon) center / contain no-repeat;
  mask: var(--fi-nav-icon) center / contain no-repeat;
  --fi-nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Cpath d='M9 3v18'/%3E%3Cpath d='m16 15-3-3 3-3'/%3E%3C/svg%3E");
}

.fi-nav-closed .fi-nav-icon {
  --fi-nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Cpath d='M9 3v18'/%3E%3Cpath d='m14 9 3 3-3 3'/%3E%3C/svg%3E");
}

.fi-nav-toggle:hover .fi-nav-icon {
  background-color: var(--fi-ink);
}

.fi-shell-main {
  background-color: var(--fi-paper);
  color: var(--fi-ink);
}

/* Page layout: empty message slots (warnings, notices) take no space in the page stack. */

.fi-page > div:empty {
  display: none;
}

/* Page tabs (components/page_tabs.py): the views of one sidebar entry, as links on a rule across
   the top of the page. Larger and on the page's own rule, so they read as navigation, apart from
   the discharge-port tabs inside the page. */
.fi-page-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--fi-rule);
}

html .fi-page-tab {
  padding: 4px 0 10px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--fi-ink-2);
  font-size: 15px;
  font-weight: 500;
}

html .fi-page-tab:hover {
  color: var(--fi-ink);
  border-bottom-color: var(--fi-rule);
}

/* The open tab ("page"), or the tab whose views the page is one of ("true"). */
html .fi-page-tab[aria-current] {
  color: var(--fi-accent);
  border-bottom-color: var(--fi-accent);
  font-weight: 600;
}

/* The tab bars' container (components/page_tabs.py). */
.fi-page-tab-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* "Voyage rates, USD/mt · As of 25 Sep 2026, 16:59 UTC" */
.fi-meta-item:not(:empty)::after {
  content: "·";
  margin-inline-start: 8px;
  color: var(--fi-ink-3);
}

/* Sign-in */

.fi-login-card {
  width: min(100%, 380px);
  padding: 28px 28px 24px;
  background-color: var(--fi-surface);
  border: 1px solid var(--fi-rule);
  border-radius: var(--fi-radius);
}

/* Toolbars: a small label above each control, controls on one line where they fit. */

.fi-field-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fi-ink-2);
}

.fi-toolbar {
  row-gap: 12px;
}

/* Rates grid */

.fi-num {
  font-variant-numeric: tabular-nums;
}

/* Centre every header and value. */
.fi-center {
  text-align: center;
  justify-content: center;
}

.fi-header-center .ag-header-cell-label {
  justify-content: center;
}

/* A merged load-port cell centres its label across the rows it spans. The selector matches
   AG Grid's own `.ag-spanned-cell-wrapper > .ag-spanned-cell { display: block }` and wins. */
.ag-spanned-cell-wrapper > .ag-spanned-cell.fi-center {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Short grids end at their last row: AG Grid gives auto-height grids a 150px minimum body.
   Modals render outside .fi-page, so the matrix's route modal is named too. */
.fi-page .ag-layout-auto-height .ag-center-cols-viewport,
.fi-route-modal .ag-layout-auto-height .ag-center-cols-viewport {
  min-height: 0;
}

/* Multi-line cell tooltips (route, voyage and rate, curve time, a fixture's calculation chain).
   pre-wrap keeps the chain's indented lines under each step. */
.ag-tooltip {
  white-space: pre-wrap;
  line-height: 1.45;
}

/* Where the fixtures page's grids open tooltips (dashAgGridFunctions.js, fiPopupParent): the
   window's size, so tooltips stay on screen. Only the tooltips themselves take the pointer. */
#fi-popup-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

#fi-popup-layer > * {
  pointer-events: auto;
}

/* Rates chart */

.fi-chart-panel {
  background-color: var(--fi-surface);
  border: 1px solid var(--fi-rule);
  border-radius: var(--fi-radius);
  padding: 14px 16px 8px;
}

.fi-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

/* Legend entries are buttons: click one to hide or show its series. */
.fi-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--fi-ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.fi-legend-item:focus-visible {
  outline: 2px solid var(--fi-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.fi-legend-item.is-hidden {
  color: var(--fi-ink-3);
  text-decoration: line-through;
}

.fi-legend-item.is-hidden .fi-legend-swatch {
  opacity: 0.35;
}

.fi-legend-static {
  color: var(--fi-ink-3);
  cursor: default;
}

.fi-legend-swatch {
  display: inline-block;
  width: 18px;
  border-top: 2px solid;
}

/* Umax and the smaller sizes: dashed, as their lines are. */
.fi-legend-swatch.is-dashed {
  border-top-style: dashed;
}

/* Comparison curves: dotted, as their lines are. */
.fi-legend-swatch.is-dotted {
  border-top-style: dotted;
  border-top-color: var(--fi-ink-3);
}

.fi-legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--fi-ink-3);
}

/* Rates chart: dots belong to fixture points only. DMC can't set dots per series, so every
   series has them and the rate lines hide theirs; a fixture series' colour carries the
   never-defined --fi-fixture variable as its marker (components/rates_chart.py). This hides the
   hover dots too, which is fine: the tooltip shows the values (Jack, 2026-09-28). */
.fi-rates-chart .recharts-dot:not([fill*="--fi-fixture"]) {
  display: none;
}

/* Voyage terms: headline value on the first line, detail beneath; one-line values centre
   vertically against the two-line ones. */
.fi-multiline {
  white-space: pre-line;
  line-height: 1.35;
  padding-top: 6px;
  padding-bottom: 6px;
}

.ag-row .ag-cell.fi-multiline {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ag-spanned-cell-wrapper > .ag-spanned-cell.fi-multiline {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Spreads */

.fi-spread-neg-1 { background-color: var(--fi-spread-neg-1); }
.fi-spread-neg-2 { background-color: var(--fi-spread-neg-2); }
.fi-spread-neg-3 { background-color: var(--fi-spread-neg-3); }
.fi-spread-pos-1 { background-color: var(--fi-spread-pos-1); }
.fi-spread-pos-2 { background-color: var(--fi-spread-pos-2); }
.fi-spread-pos-3 { background-color: var(--fi-spread-pos-3); }

/* Refresh flash (components/auto_refresh.py): held, then faded back to the cell's own shade.
   Each colour has an "a" and a "b" animation, alternating per refresh, so a cell that moves
   the same way twice running flashes both times. */
@keyframes fi-flash-up-a { 0%, 40% { background-color: var(--fi-flash-up); } }
@keyframes fi-flash-up-b { 0%, 40% { background-color: var(--fi-flash-up); } }
@keyframes fi-flash-down-a { 0%, 40% { background-color: var(--fi-flash-down); } }
@keyframes fi-flash-down-b { 0%, 40% { background-color: var(--fi-flash-down); } }
.ag-cell.fi-flash-up-a { animation: fi-flash-up-a 4s ease-out; }
.ag-cell.fi-flash-up-b { animation: fi-flash-up-b 4s ease-out; }
.ag-cell.fi-flash-down-a { animation: fi-flash-down-a 4s ease-out; }
.ag-cell.fi-flash-down-b { animation: fi-flash-down-b 4s ease-out; }

/* The baseline cell: outlined and bold, so every other value reads against it. */
.fi-baseline {
  box-shadow: inset 0 0 0 2px var(--fi-ink);
  font-weight: 600;
}

/* Prices that may be out of date: an Implied CFR origin's FOB update time when it's older than
   the others' (components/fob_view.py), and a CFR calculator premium more than 3 business days
   old. */
.fi-stale {
  background-color: var(--fi-warning-bg);
  color: var(--fi-warning-ink);
  font-weight: 500;
}

/* A CFR calculator premium a data provider filled in (Update premiums), not one the user
   entered: lighter text, and on a stale one, normal weight (Jack, 2026-11-03). */
.fi-provider {
  color: var(--fi-ink-2);
}

.fi-stale.fi-provider {
  font-weight: 400;
}

/* The CFR row of an Implied CFR build-up. */
.fi-total {
  font-weight: 600;
}

/* A CBOT row pinned above the ports (Implied CFR, and both CFR calculator grids): reference
   figures, so in the secondary ink. */
.fi-cbot-row {
  color: var(--fi-ink-2);
}

/* Crush margin: the rows worked out from a leg (meal × yield, oil × yield) and the processing
   cost, in the secondary ink; the margin row is bold (.fi-total). */
.fi-crush-derived {
  color: var(--fi-ink-2);
}

/* CFR calculator: the premium cells you can type in. */
.ag-cell.fi-editable {
  cursor: text;
}

.ag-cell.fi-editable:hover {
  box-shadow: inset 0 0 0 1px var(--fi-control);
}

/* CFR calculator: a port's name with the × that removes its row. The × is always shown, faintly
   (phones have no hover), and darkens on hover or keyboard focus. */
.fi-port-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.fi-port-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.fi-remove {
  flex: none;
  border: 0;
  background: none;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
  color: var(--fi-ink-3);
  opacity: 0.55;
  cursor: pointer;
}

.fi-remove:hover,
.fi-remove:focus-visible {
  opacity: 1;
  color: var(--fi-ink);
}

/* A month's header in the CFR calculator premiums: the label centred, with its × beside it. */
.fi-month-header {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.fi-month-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Build-up month cells: freight with its vessel size ("159.50 Kmax") needs the room. */
.ag-cell.fi-tight {
  padding-left: 4px;
  padding-right: 4px;
}

/* Cells that set the benchmark when clicked: month columns are "2027-03" on the spreads pages and
   "m0", "m1"… on the CFR calculator. */
.fi-clickable .ag-cell[col-id^="20"],
.fi-clickable .ag-cell[col-id^="m"] {
  cursor: pointer;
}

/* Fixtures: the whole page scrolls as one, form and lists alike, and each part (paste box,
   form, market rates, outputs) is a card on the page's paper (Pavle, 2026-11-18). */

.fi-section {
  background-color: var(--fi-surface);
  border: 1px solid var(--fi-rule);
  border-radius: var(--fi-radius);
  padding: 16px 20px 20px;
}

html .fi-paste.mantine-Accordion-root .mantine-Accordion-item {
  background-color: var(--fi-surface);
  border-color: var(--fi-rule);
  border-radius: var(--fi-radius);
}

.fi-fixture-row {
  row-gap: 8px;
}

/* The benchmark voyage: wide enough for the longest short name ("UpRiver+BB>Qingdao 66k SOY"),
   so the TC row fits on one line with the sidebar open. */
.fi-voyage-field {
  flex: 0 1 250px;
  min-width: 0;
}

/* Save and the preview of what it will save end the title row. */
.fi-save-group {
  margin-left: auto;
}

.fi-voyage-field .fi-field-help {
  max-width: none;
}

/* A TC vessel of another size than the benchmark voyage: a note, in the warning ink. */
.fi-size-hint {
  color: var(--fi-warning-ink);
}

/* Helper text under a field keeps its line, so rows don't jump as previews appear. */
.fi-field-help {
  min-height: 18px;
  max-width: 260px;
  line-height: 1.35;
  white-space: pre-line; /* a help in two lines, e.g. a worked-out ETA's */
}

.fi-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fi-help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--fi-control);
  color: var(--fi-ink-2);
  font-size: 10px;
  font-weight: 600;
  cursor: help;
}

.fi-help-dot:focus-visible {
  outline: 2px solid var(--fi-accent);
  outline-offset: 1px;
}

.fi-preview {
  min-height: 24px;
}

/* The benchmark equivalents beside Save: a caption over the figures, right-aligned to it. */
.fi-readout {
  text-align: right;
  line-height: 1.25;
  white-space: nowrap;
}

.fi-preview-note {
  max-width: 280px;
  text-align: right;
  line-height: 1.35;
}

/* The list is as tall as its rows; the page scrolls, not the list. */
.fi-fixtures-list {
  position: relative; /* for the loading overlay */
}

.ag-row.fi-row-failed .ag-cell {
  color: var(--fi-ink-3);
}

/* The Status cell is a dropdown (one click opens it): a caret says so. */
.ag-cell.fi-status-cell {
  cursor: pointer;
}

.ag-cell.fi-status-cell:not(.ag-cell-inline-editing)::after {
  content: "\25BE";
  margin-left: 4px;
  color: var(--fi-ink-3);
}

/* A just-saved row flashes once in the accent tint. */
@keyframes fi-row-flash {
  from {
    background-color: var(--fi-accent-tint-hover);
  }
  to {
    background-color: transparent;
  }
}

.ag-row.fi-row-new {
  animation: fi-row-flash 2.5s ease-out;
}

.fi-toast {
  background-color: var(--fi-surface);
  color: var(--fi-ink);
  border-color: var(--fi-rule);
}

@media (max-width: 768px) {
  .fi-fixture-row > *,
  .fi-fields > * {
    flex: 1 1 100%;
  }


}

/* The page shows its own, translated, empty message above the grid. */
.fi-fixtures-grid .ag-overlay-no-rows-wrapper {
  display: none;
}

/* The freight matrix (pages/matrix.py): a rate is clicked (to select it, and in spreads mode to
   make it the reference), a port or vessel double-clicked for the route's terms. */
.ag-cell.fi-matrix-cell {
  cursor: pointer;
}

/* A rate re-priced on the user's port terms: a light accent tint. */
.ag-cell.fi-matrix-calc {
  background-color: var(--fi-accent-tint);
}

/* Spreads mode: a reference route's row, outlined top and bottom across every cell (a reference
   cell is .fi-baseline). */
.ag-cell.fi-baseline-route {
  box-shadow: inset 0 2px 0 var(--fi-ink), inset 0 -2px 0 var(--fi-ink);
  font-weight: 600;
}

/* A row's chart tick (FiChartCell), in the accent colour. */
.fi-chart-tick {
  display: inline-flex;
  align-items: center;
}
.fi-chart-tick input {
  accent-color: var(--fi-accent);
  cursor: pointer;
  margin: 0;
}
.fi-chart-tick input:disabled {
  cursor: not-allowed;
}

/* The selected rate's action bar, above the grid. */
.fi-matrix-cell-bar {
  background-color: var(--fi-surface);
}

/* A port the user changed terms at: its name in the accent colour. */
.ag-cell.fi-matrix-port-edited {
  color: var(--fi-accent);
  font-weight: 600;
}

/* The Status page's catalog preview: a route waiting for an admin's choice. */
.ag-cell.fi-matrix-needs-choice {
  color: var(--fi-warning-ink);
  font-weight: 500;
}

/* The fixture page's "Paste a message" box (components/fixture_paste.py). */
.fi-paste-row {
  padding: 6px 0;
  border-top: 1px solid var(--fi-rule);
}

.fi-paste-source {
  font-style: italic;
  overflow-wrap: anywhere;
}

.fi-paste-warning {
  color: var(--fi-warning-ink);
}

/* Bids and offers, "Outputs" (components/quotes_panel.py) */

.fi-quote-action {
  color: var(--fi-accent);
  cursor: pointer;
}

.fi-row-failed .fi-quote-action {
  color: inherit;
  cursor: default;
}

.fi-quote-side {
  font-weight: 600;
}

/* Export CSV, at the top of each fixture page table (Pavle, 2026-11-23): a download arrow drawn
   in the button's own colour, so it follows the scheme and the disabled state. */
.fi-export-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11'/%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11'/%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
}
