/*
 * Chart datum: shell and shared components. Depends on tokens.css.
 *
 * Rules the classes below encode (see the design proposal):
 *  - Settled values are upright; forward, forecast and estimated values get .fwd.
 *  - One bordered .panel per view for the primary content. Secondary content is
 *    an open .section divided by rules. Shadows only on floating layers.
 *  - Labels are sentence case. No tracked capitals, no icons on headings.
 */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--shallows);
    color: var(--ink);
    font: 400 var(--size-body)/1.45 var(--font);
    font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: var(--size-page); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: var(--size-panel); line-height: 1.25; font-weight: 700; }
h3 { font-size: var(--size-body); line-height: 1.3; font-weight: 700; }
p { margin: 0 0 8px; }
svg text { font-family: var(--font); }

a { color: var(--ink); }
a.link { font-weight: 600; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a.link:hover { text-decoration-color: var(--magenta); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Meaning */
.fwd { font-style: italic; }
.unit { color: var(--ink-3); font-size: .8em; font-weight: 400; margin-left: 3px; font-style: normal; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.nodata { color: var(--ink-3); font-weight: 400; }
.up, .fd-delta--pos { color: var(--favourable); }
.down, .fd-delta--neg { color: var(--adverse); }
.flat, .fd-delta--flat { color: var(--ink-2); }
.neutral-move { color: var(--ink-2); }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex: none; }
.sw--capesize { background: var(--capesize); }
.sw--panamax { background: var(--panamax); }
.sw--supramax { background: var(--supramax); }
.sw--handysize { background: var(--handysize); }

/* ---------------------------------------------------------------- shell */
.shell-header { position: sticky; top: 0; z-index: 30; }
.topbar {
    background: var(--sea);
    border-bottom: 1px solid var(--rule-soft);
    display: flex; align-items: center; gap: 20px;
    height: var(--topbar-height);
    padding-inline: var(--gutter);
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; text-decoration: none; }
.nav { display: flex; align-items: stretch; height: 100%; gap: 2px; min-width: 0; }
.nav > a, .nav summary {
    display: flex; align-items: center; height: 100%;
    padding-inline: 10px;
    color: var(--ink-2); text-decoration: none; white-space: nowrap;
    border-bottom: 2px solid transparent;
    cursor: pointer; list-style: none;
}
.nav summary::-webkit-details-marker { display: none; }
.nav summary::marker { content: ""; }
.nav summary::after {
    content: ""; width: 5px; height: 5px; margin-left: 7px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}
.nav > a:hover, .nav summary:hover { color: var(--ink); }
.nav .is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--magenta); }
.nav details { position: relative; height: 100%; }
.menu {
    position: absolute; top: 100%; left: 0; z-index: 40;
    min-width: 240px; padding: 6px;
    display: grid;
    background: var(--sea); border: 1px solid var(--rule); border-radius: var(--radius-panel);
    box-shadow: var(--shadow-float);
}
.menu a, .menu button.menu-item {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    padding: 7px 10px; border-radius: 4px;
    color: var(--ink); text-decoration: none; white-space: nowrap;
    font: inherit; background: none; border: 0; text-align: left; cursor: pointer; width: 100%;
}
.menu a:hover, .menu button.menu-item:hover { background: var(--shallows); }
.menu a[aria-current="page"] { font-weight: 600; box-shadow: inset 2px 0 0 var(--magenta); }
.menu hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 4px 0; }
.menu form { margin: 0; }
.topbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.goto {
    display: flex; align-items: center; gap: 10px;
    height: 30px; min-width: 200px; padding-inline: 10px;
    border: 1px solid var(--rule); border-radius: var(--radius-input);
    background: var(--shallows); color: var(--ink-2);
    font: inherit; font-size: 13px; cursor: pointer;
}
kbd { font: inherit; font-size: 11px; padding: 0 5px; margin-left: auto; border: 1px solid var(--rule); border-radius: 3px; background: var(--sea); color: var(--ink-2); }
.account { position: relative; }
.account summary { list-style: none; cursor: pointer; }
.account summary::-webkit-details-marker { display: none; }
.account .menu, .mobile-nav .menu { left: auto; right: 0; top: calc(100% + 8px); }
.avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.mobile-nav { display: none; position: relative; }
.mobile-nav summary { list-style: none; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav .menu { max-height: 70vh; overflow-y: auto; }
.menu-group-label { padding: 8px 10px 2px; font-size: var(--size-label); color: var(--ink-3); }

/* Context strip: the Baltic close, on every page */
.strip {
    background: var(--sea); border-bottom: 1px solid var(--rule);
    display: flex; align-items: center; gap: 28px;
    min-height: var(--strip-height); padding-inline: var(--gutter);
    font-size: 13px; overflow-x: auto;
}
.strip-item { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; color: inherit; text-decoration: none; }
.strip-item:hover .strip-name { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.strip-item .sw { align-self: center; }
.strip-name { color: var(--ink-2); }
.strip-val { font-weight: 600; }
.strip-end { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--ink-2); white-space: nowrap; }

/* Status chips: always icon + label */
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 1px 9px 1px 7px;
    border: 1px solid var(--rule); border-radius: 999px;
    background: var(--sea); color: var(--ink-2);
    font-size: var(--size-label); white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; flex: none; }
.chip--warn { background: var(--status-warn-wash); border-color: var(--status-warn-rule); color: var(--status-warn-ink); }

/* ---------------------------------------------------------------- page */
.page { padding-block: 20px 56px; padding-inline: var(--gutter); max-width: 1440px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.page-sub { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; }

.notice {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 14px; margin-bottom: 14px;
    border: 1px solid var(--rule); border-radius: var(--radius-panel);
    background: var(--sea); color: var(--ink); font-size: 13px;
}
.notice svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.notice--warn { background: var(--status-warn-wash); border-color: var(--status-warn-rule); color: var(--status-warn-ink); }
.notice p { margin: 0; }

.panel { background: var(--sea); border: 1px solid var(--rule); border-radius: var(--radius-panel); }
.panel-pad { padding: 14px 16px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.note { font-size: var(--size-label); color: var(--ink-3); }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); font-size: 13px; }
.empty a { font-weight: 600; }

/* ---------------------------------------------------------------- controls */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding-inline: 12px;
    border: 1px solid var(--rule); border-radius: var(--radius-input);
    background: var(--sea); color: var(--ink);
    font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap;
    text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2E3D4D; border-color: #2E3D4D; }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); padding-inline: 6px; }
.btn-quiet:hover { color: var(--ink); border-color: transparent; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: var(--radius-input); background: var(--sea); overflow: hidden; }
.seg > button, .seg > a {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 5px 12px;
    border: 0; border-right: 1px solid var(--rule); background: none;
    color: var(--ink-2); font: inherit; font-size: 13px; white-space: nowrap;
    text-decoration: none; cursor: pointer;
}
.seg > :last-child { border-right: 0; }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--magenta-wash); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--magenta); }
.seg--full { display: flex; }
.seg--full > * { flex: 1; }

.input {
    width: 100%; height: 32px; padding-inline: 8px;
    border: 1px solid var(--rule); border-radius: var(--radius-input);
    background: var(--sea); color: var(--ink);
    font: inherit; font-size: 13px;
}
.input:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 1px var(--magenta); }
textarea.input { height: auto; min-height: 120px; padding: 8px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 4px; }
.input--auto { width: auto; }
.field { display: grid; gap: 4px; }
.field > label, .field > .label, .label { font-size: var(--size-label); color: var(--ink-2); }
.field-error { font-size: var(--size-label); color: var(--adverse); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--magenta); width: 15px; height: 15px; margin: 0; }

.tokens { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.token { display: inline-flex; gap: 6px; align-items: center; padding: 3px 4px 3px 9px; background: var(--sea); border: 1px solid var(--rule); border-radius: var(--radius-input); font-size: 13px; }
.token button { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.token button:hover { color: var(--ink); }
.token-add { display: inline-flex; }
.token-add .input { width: 170px; height: 28px; border-style: dashed; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--size-table); }
table.data th {
    position: sticky; top: 0; z-index: 1;
    padding: 8px 10px; background: inherit;
    border-bottom: 1px solid var(--rule);
    color: var(--ink-2); font-size: var(--size-label); font-weight: 600; text-align: left; white-space: nowrap;
}
table.data td { padding: 6px 10px; height: 34px; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data .num { text-align: right; }
table.data tbody tr:hover td { background: rgba(238, 243, 247, .55); }
table.data tfoot td { font-weight: 600; border-bottom: 0; }
table.data .is-key td { font-weight: 600; }
.range { position: relative; display: inline-block; width: 104px; height: 10px; vertical-align: middle; }
.range::before { content: ""; position: absolute; left: 0; right: 0; top: 4px; border-top: 2px solid var(--rule); }
.range i { position: absolute; top: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); transform: translateX(-50%); }

.cell-input { width: 100%; min-width: 120px; padding: 2px 0; border: 0; border-bottom: 1px dashed var(--ink-3); background: transparent; color: var(--ink); font: inherit; font-size: var(--size-table); }
.cell-input.num { min-width: 0; text-align: right; }
.cell-input:focus { outline: none; border-bottom: 1px solid var(--magenta); background: var(--magenta-wash); }
.rm { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; }
.rm:hover { color: var(--adverse); }

/* ---------------------------------------------------------------- overrides */
/* The shared override widget (static/js/vessel-pct-widget.js) renders fd-vpw
   markup. Its override sits next to the calculated value, in magenta here. */
.fd-vpw { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.fd-vpw-auto { font-weight: 600; }
.fd-vpw-auto::after { content: "calculated"; margin-left: 6px; font-weight: 400; color: var(--ink-3); }
.fd-vpw-edit-btn { border: 0; background: none; color: var(--ink-2); cursor: pointer; font: inherit; font-size: var(--size-label); text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.fd-vpw-edit-btn i { display: none; }
.fd-vpw-edit-btn::before { content: "Set an override"; }
.fd-vpw-input-wrap { display: none; }
.fd-vpw-input { width: 80px; height: 28px; padding-inline: 6px; border: 1px solid var(--magenta); border-radius: var(--radius-input); font: inherit; font-size: 13px; text-align: right; }
.fd-vpw-override { display: none; align-items: baseline; gap: 4px; color: var(--magenta); font-weight: 600; }
.fd-vpw-override-value::after { content: " override"; font-weight: 400; }
.fd-vpw-override-clear { border: 0; background: none; color: var(--magenta); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }

/* ---------------------------------------------------------------- floating */
dialog.jump { padding: 0; width: min(480px, calc(100vw - 32px)); border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--sea); color: var(--ink); box-shadow: 0 18px 48px rgba(27, 39, 51, .24); }
dialog.jump::backdrop { background: rgba(27, 39, 51, .28); }
dialog.jump .input { height: 44px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; font-size: 15px; padding-inline: 14px; box-shadow: none; }
dialog.jump ul { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
dialog.jump a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 4px; text-decoration: none; }
dialog.jump a:hover, dialog.jump a:focus-visible, dialog.jump a.is-first { background: var(--shallows); }
dialog.jump small { color: var(--ink-3); }
dialog.jump .empty { padding: 14px; }

/* The EOD reminder (static/js/eod-reminder.js reveals and dismisses it). */
.eod-toast { width: 22rem; max-width: calc(100vw - 32px); padding: 12px 14px; display: grid; gap: 8px; justify-items: start; background: var(--sea); border: 1px solid var(--status-warn-rule); border-left: 3px solid var(--status-warn-ink); border-radius: var(--radius-panel); box-shadow: var(--shadow-float); font-size: 13px; }
.eod-toast__head { display: flex; align-items: center; gap: 8px; width: 100%; font-weight: 700; color: var(--status-warn-ink); }
.eod-toast__head svg { width: 16px; height: 16px; flex: none; }
.eod-toast__test { display: none; padding: 1px 7px; border-radius: 999px; background: var(--shallows); color: var(--ink-2); font-size: 11px; font-weight: 600; }
.eod-toast.is-test .eod-toast__test { display: inline-block; }
.eod-toast__close { margin-left: auto; border: 0; background: none; padding: 0 2px; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; }
.eod-toast__close:hover { color: var(--ink); }
.eod-toast__body { margin: 0; color: var(--ink-2); }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--rule); border-left: 3px solid var(--ink); border-radius: var(--radius-panel); background: var(--sea); box-shadow: var(--shadow-float); font-size: 13px; }
.toast--error { border-left-color: var(--adverse); }

@media (prefers-reduced-motion: no-preference) {
    .toast { animation: toast-in .18s ease-out; }
    @keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---------------------------------------------------------------- responsive */
/* The menu group names come from Menu Builder and can be long, so the search
   box gives up its label first and the whole bar folds into one menu next. */
@media (max-width: 1480px) {
    .goto { min-width: 0; }
    .goto .long { display: none; }
    .nav > a, .nav summary { padding-inline: 8px; }
    .topbar { gap: 14px; }
}
@media (max-width: 1240px) {
    .nav { display: none; }
    .mobile-nav { display: block; }
}
@media (max-width: 640px) {
    :root { --gutter: 16px; }
    .strip { display: none; }
    .goto .long { display: none; }
    .field-row { grid-template-columns: 1fr; }
}
