/* One decision per view. The selector never contains a shop or a long form. */
#enterprises-toggle { background:var(--panel-soft); color:var(--ink); border:1px solid var(--line); border-radius:8px; padding:10px 14px; white-space:nowrap; cursor:pointer; }
#enterprises-panel[hidden],#enterprises-panel [hidden] { display:none!important; }
#enterprises-panel { position:absolute; top:var(--sea-header-bottom,84px); right:16px; z-index:2650; width:min(570px,calc(100vw - 32px)); max-height:calc(100dvh - var(--sea-header-bottom,84px) - 20px); overflow:auto; box-sizing:border-box; padding:20px; border-radius:12px; border:1px solid var(--line); background:#153946; color:var(--ink); pointer-events:auto; font:14px/1.45 'Segoe UI',system-ui,sans-serif; }
#enterprises-panel header { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; }
#enterprises-panel h2 { margin:2px 0; font:26px Georgia,serif; color:var(--gold); }
#enterprises-panel small { color:var(--muted); }
#enterprises-panel button { padding:9px 12px; background:var(--panel-soft); border:1px solid var(--line); border-radius:8px; color:var(--ink); cursor:pointer; }
#enterprises-panel button:focus-visible { outline:2px solid var(--gold); outline-offset:3px; }
#enterprises-panel button:disabled { opacity:.45; cursor:default; }
.enterprise-totals { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.enterprise-totals div { display:grid; gap:4px; }
.enterprise-totals strong { font-size:20px; color:#aee7ff; }
.enterprise-explainer,#enterprises-panel footer { font-size:12px; color:var(--muted); margin:14px 0; }
.enterprise-list { display:grid; gap:12px; }
.enterprise-owned { padding:16px; border:1px solid var(--line); border-radius:10px; background:var(--panel-soft); }
.enterprise-owned h3 { font-size:17px; margin:0; color:var(--gold); overflow-wrap:anywhere; }
.enterprise-status { margin:4px 0 12px; font-size:12px; color:#aee7ff; }
.enterprise-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:12px 0; }
.enterprise-stats dt { font-size:11px; color:var(--muted); }
.enterprise-stats dd { margin:4px 0; font-size:17px; }
.enterprise-owned details { font-size:12px; margin:12px 0; color:var(--muted); }
.enterprise-owned summary { cursor:pointer; }
.enterprise-owned>button { width:100%; }
#enterprises-panel nav { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:12px; }
.sea-enterprises-open #sea-rail, .sea-enterprises-open #polar-container, body:has(#sea-tools[open]) #sea-rail { display:none!important; }
.sea-enterprises-open #sea-cockpit { left:16px; right:602px; width:auto; max-width:none; transform:none; }
@media(max-width:1100px) { .sea-enterprises-open #sea-cockpit { display:none; } }
/* The permanent business entry must not squeeze cargo into the mode buttons. */
@media(min-width:1151px) and (max-width:1600px) {
    #sea-header { flex-wrap:wrap; gap:10px 16px; }
    #sea-brand { margin-right:auto; width:auto; }
    #sea-captain { order:5; flex-basis:100%; padding-top:8px; border-top:1px solid var(--line); }
}
@media(max-height:650px) {
    #enterprises-panel { top:10px; max-height:calc(100dvh - 20px); z-index:2800; padding:16px; }
    #enterprises-panel header { margin-bottom:10px; }
    .enterprise-explainer,#enterprises-panel footer { margin:10px 0; }
}
#sea-fleet-panel { width:min(420px,calc(100vw - 32px)); box-sizing:border-box; padding:16px; overflow:auto; overscroll-behavior:contain; color:var(--ink); background:#153946; }
.sea-fleet-open #sea-rail,.sea-fleet-open #polar-container { display:none!important; }
.sea-fleet-open #sea-cockpit { left:16px; right:452px; width:auto; max-width:none; transform:none; }
@media(max-width:1000px) { .sea-fleet-open #sea-cockpit { display:none; } }
#sea-fleet-panel [hidden], #fleet-tree [hidden] { display:none!important; }
#sea-fleet-panel-header { position:static; margin:-16px -16px 0; padding:12px 16px; gap:10px; }
#sea-fleet-panel-title { flex:1; min-width:0; font-size:21px; overflow-wrap:anywhere; }
#sea-fleet-panel button { font:600 13px/1.35 'Segoe UI',system-ui,sans-serif; cursor:pointer; }
#sea-fleet-panel button:disabled { cursor:default; }
#sea-fleet-panel .fleet-back { color:var(--muted); background:transparent; padding:6px 0; border:0; }
.fleet-selector-hint,.vessel-subtitle,.vessel-note,.vessel-cargo-summary { color:var(--muted); font:13px/1.5 'Segoe UI',system-ui,sans-serif; margin:12px 0; }
.fleet-roster { display:grid; gap:8px; }
#sea-fleet-panel .fleet-vessel-row { display:grid; grid-template-columns:28px minmax(0,1fr); gap:2px 10px; text-align:left; align-items:center; padding:12px; min-height:80px; background:var(--panel-soft); border:1px solid var(--line); color:var(--ink); border-radius:9px; }
.fleet-vessel-symbol { grid-row:1/3; color:var(--gold); font-size:24px; }
.fleet-vessel-identity { display:grid; gap:4px; min-width:0; }
.fleet-vessel-identity strong { font-size:16px; overflow-wrap:anywhere; }
.fleet-vessel-identity small { font-size:12px; font-weight:400; color:var(--muted); overflow-wrap:anywhere; }
.fleet-vessel-action { grid-column:2; color:#b5e4fb; font-size:11px; }
#sea-fleet-panel .fleet-vessel-row[aria-current="true"] { border-color:var(--gold); }
.fleet-vessel-row[aria-current="true"] .fleet-vessel-action { color:var(--gold); }
.fleet-pagination { display:flex; justify-content:space-between; align-items:center; margin-top:12px; color:var(--muted); font-size:12px; }
.fleet-pagination button { background:var(--panel-soft); color:var(--ink); padding:5px 14px; }
.fleet-status-message { font-size:12px; color:var(--gold); margin:10px 0 0; }
.fleet-status-message:empty { display:none; }
.vessel-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:3px; padding:3px; background:#102f3c; border-radius:8px; margin-bottom:14px; }
#sea-fleet-panel .vessel-tabs button { border:0; padding:9px 3px; font-size:12px; background:transparent; color:var(--muted); }
#sea-fleet-panel .vessel-tabs button[aria-selected="true"] { background:var(--gold); color:var(--navy); }
.vessel-stats { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.vessel-stats div { display:grid; gap:4px; border-bottom:1px solid var(--line); padding-bottom:10px; }
.vessel-stats small { color:var(--muted); font-size:12px; }
.vessel-stats strong { font-size:20px; color:#dbf1fa; }
.vessel-cargo-summary { margin:8px 0 12px; }
.vessel-sheet .fleet-name-editor { border:0; border-radius:0; background:none; padding:0; margin:14px 0; }
.vessel-sheet .fleet-name-editor label { font-size:12px; font-weight:400; }
.vessel-sheet .fleet-name-editor input { font-family:inherit; font-size:14px; line-height:1.4; padding:9px; }
.vessel-sheet .fleet-name-editor button { padding:6px 10px; }
.vessel-crew .port-person { margin:12px 0; padding:8px; }
.vessel-crew .port-person img { width:42px; height:42px; }
.vessel-crew .port-person p { font-size:12px; }
#sea-fleet-panel .vessel-primary { width:100%; margin-top:8px; padding:11px; color:var(--navy); background:var(--gold); }
.vessel-sheet .upgrades-section { margin:0; padding:0; border:0; background:none; }
.vessel-sheet #upgrades-title { display:none; }
.vessel-sheet .upgrade-row { display:grid; grid-template-columns:1fr auto; gap:6px 8px; padding:13px 0; border-bottom:1px solid var(--line); }
.vessel-sheet .upgrade-name { grid-column:1/-1; color:var(--ink); font-size:14px; }
.vessel-sheet .upgrade-level { font-size:12px; color:var(--muted); align-self:center; }
.vessel-sheet .upgrade-btn { background:var(--gold); color:var(--navy); padding:8px; border:0; }
.vessel-sheet .upgrade-btn:disabled { background:var(--panel-soft); color:var(--muted); }
.vessel-sheet .trade-automation { margin:0; background:var(--panel-soft); color:var(--ink); border:1px solid var(--line); box-shadow:none; padding:12px; }
.vessel-sheet .trade-automation-heading strong { color:var(--ink); font-size:14px; }
.vessel-sheet .trade-automation-heading small { display:none; }
.vessel-sheet .trade-automation-flow { grid-template-columns:1fr; gap:9px; }
.vessel-sheet .trade-automation-flow label { display:grid; grid-template-columns:105px minmax(0,1fr); gap:8px; align-items:center; }
.vessel-sheet .trade-automation-flow select { min-width:0; width:100%; }
.vessel-sheet .trade-automation-flow b { font-size:11px; color:var(--muted); }
.vessel-sheet .trade-automation-arrow { display:none; }
.vessel-sheet .trade-automation select { font-size:13px; padding:8px; }
.vessel-sheet .trade-automation-footer { display:block; border-color:var(--line); }
.vessel-sheet .trade-automation-footer label { font-size:12px; color:var(--muted); }
.vessel-sheet #trade-automation-status { text-align:left; margin:8px 0 0; font-size:12px; color:var(--muted); }
.vessel-sheet .captain-preview { padding:8px; gap:6px; }
.vessel-sheet .captain-preview small { font-size:11px; }
.vessel-sheet .captain-preview>span { display:none; }
.vessel-sheet .captain-preview { grid-template-columns:1fr auto; }
#trade-dialog[data-section] > [data-port-section] { display:none; }
#trade-dialog[data-section="market"] > [data-port-section="market"],
#trade-dialog[data-section="passengers"] > [data-port-section="passengers"],
#trade-dialog[data-section="shipyard"] > [data-port-section="shipyard"],
#trade-dialog[data-section="businesses"] > [data-port-section="businesses"] { display:block; }
#trade-dialog[data-section="market"] > .trade-grid-6 { display:grid; }
#trade-dialog[data-section]:not([data-section="market"]) > #active-contracts-panel { display:none!important; }
.port-section-links button[aria-pressed="true"] { background:var(--gold); color:var(--navy); border-color:var(--gold); }
#trade-dialog #fleet-tree { padding:0; background:none; border:0; }
#trade-dialog #fleet-tree .fleet-node { display:grid; grid-template-columns:74px 1fr; gap:6px 12px; padding:12px; }
#trade-dialog #fleet-tree .fleet-node .moment-art { grid-column:1; grid-row:1; width:74px; height:54px; object-fit:cover; margin:0; border-radius:6px; }
#trade-dialog #fleet-tree .fleet-identity { grid-column:2; }
#trade-dialog #fleet-tree .fleet-performance { grid-column:1/-1; text-align:left; gap:5px; }
#trade-dialog #fleet-tree .fleet-performance b { font-size:13px; }
#trade-dialog #fleet-tree .fleet-performance small,#trade-dialog #fleet-tree .fleet-performance em { font-size:11px; }
#trade-dialog #fleet-tree .fleet-action { width:100%; justify-self:stretch; min-height:38px; font-size:13px; }
.shipyard-picker { display:grid; gap:6px; margin:12px 0; color:var(--muted); font-size:12px; }
.vessel-resale { margin-top:16px; }
.vessel-resale button { display:block; width:100%; min-height:40px; margin-top:8px; }
.vessel-sheet #trade-auto-buy-qty { width:88px; margin-left:8px; padding:8px; border-radius:6px; border:1px solid var(--line); background:var(--navy); color:var(--ink); }
.vessel-sheet .trade-repeat { display:flex; gap:8px; align-items:center; margin-top:12px; line-height:1.5; }
.vessel-sheet #trade-auto-repeat { width:18px; height:18px; flex:0 0 auto; accent-color:var(--gold); }
#trade-dialog #fleet-tree .fleet-node:not(:has(.moment-art)) .fleet-identity { grid-column:1/-1; }
.shipyard-picker select { width:100%; border:1px solid var(--line); border-radius:6px; padding:9px; background:#f0eddf; color:var(--navy); font:600 14px/1.4 'Segoe UI',system-ui,sans-serif; }
#trade-dialog:not([data-section="market"])>.trade-footer { display:none; }
#trade-dialog[data-section]:not([data-section="market"]) { max-height:calc(100vh - var(--sea-header-bottom,84px) - 20px)!important; }
#trade-dialog[data-section="shipyard"] #trade-port-context { display:none; }
#trade-dialog[data-section="shipyard"] .fleet-intro,
#trade-dialog[data-section="shipyard"] #trade-quit { display:none; }
body:has(#trade-dialog:not(.hidden)[data-section]:not([data-section="market"])) #sea-cockpit,
body:has(#trade-dialog:not(.hidden)[data-section]:not([data-section="market"])) #polar-container,
body:has(#trade-dialog:not(.hidden)[data-section]:not([data-section="market"])) #sea-rail { display:none!important; }
@media(max-width:600px) {
    #sea-fleet-panel { left:auto; right:8px; width:calc(100vw - 16px); max-height:calc(100dvh - var(--sea-header-bottom,116px) - 12px); }
    #sea-fleet-panel-title { font-size:19px; }
}
