:root {
    --csm-company-ink: var(--rewa-ink, #172627);
    --csm-company-muted: var(--rewa-muted, #56696b);
    --csm-company-line: var(--rewa-line, #d4dddb);
    --csm-company-bg: var(--rewa-surface-2, #f4f7f6);
    --csm-company-surface: var(--rewa-surface, #ffffff);
    --csm-company-teal: var(--rewa-teal, #0b766e);
    --csm-company-teal-dark: #075f59;
    --csm-company-cyan: #227f91;
    --csm-company-red: var(--rewa-red, #b23b3b);
    --csm-company-amber: var(--rewa-amber, #955b10);
}

.csm-saas-shell { max-width: 100%; overflow-x: clip; }
.csm-main-workspace,
.csm-scroll-area,
.csm-sub-view,
.csm-table-shell { min-width: 0; max-width: 100%; }
.csm-table-shell { overscroll-behavior-inline: contain; }

.csm-logo-mark.has-company-logo { padding: 3px; overflow: hidden; }
.csm-logo-mark.has-company-logo img { width: 100%; height: 100%; object-fit: contain; }

.csm-fleet-workspace {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    min-height: calc(100vh - 150px);
    margin: -24px;
}
.csm-fleet-rail {
    padding: 28px 20px;
    background: var(--rewa-surface-2, #f4f7f6);
    border-right: 1px solid var(--csm-company-line);
}
.csm-fleet-rail-head h2,
.csm-page-intro h2,
.csm-profile-form h2,
.csm-fleet-heading h2 { margin: 0; color: var(--csm-company-ink); font-size: 24px; line-height: 1.2; }
.csm-fleet-rail-head p,
.csm-page-intro p,
.csm-section-heading p,
.csm-role-toolbar p,
.csm-modal-heading p { margin: 6px 0 0; color: var(--csm-company-muted); font-size: 14px; line-height: 1.5; }
.csm-fleet-search {
    width: 100%;
    min-width: 0;
    margin: 22px 0 16px;
    padding: 0 13px;
    border-color: var(--csm-company-line);
    background: var(--csm-company-surface);
}
.csm-saas-shell .csm-fleet-search input[type="search"] {
    min-width: 0;
    min-height: 42px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.csm-fleet-search .dashicons { flex: 0 0 20px; color: #5f7784; }
.csm-fleet-list { display: grid; gap: 4px; }
.csm-fleet-list-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: center; border-left: 3px solid transparent; }
.csm-fleet-list-row.is-active { border-left-color: var(--fleet-color, var(--csm-company-teal)); }
.csm-fleet-filter {
    width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between;
    gap: 10px; border: 0; border-radius: 6px; padding: 0 12px; background: transparent;
    color: #304b5a; font: inherit; font-weight: 700; text-align: left; cursor: pointer;
}
.csm-fleet-filter:hover { background: #e8f1f4; }
.csm-fleet-filter.is-active,
.csm-fleet-list-row.is-active .csm-fleet-filter { background: #dff2f1; color: #075d5a; }
.csm-fleet-filter strong { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 50%; background: #dce7ec; font-size: 12px; }
.csm-fleet-menu { width: 32px; height: 32px; border: 0; background: transparent; color: #5b7482; cursor: pointer; }
.csm-fleet-plan-usage { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--csm-company-line); }
.csm-fleet-plan-usage > span { display: block; color: var(--csm-company-muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.csm-fleet-plan-usage > strong { display: block; margin: 5px 0 10px; color: var(--csm-company-ink); }
.csm-fleet-plan-usage > div { height: 6px; background: #dbe6eb; border-radius: 3px; overflow: hidden; }
.csm-fleet-plan-usage i { display: block; height: 100%; background: var(--csm-company-teal); }
.csm-fleet-results { min-width: 0; padding: 30px; background: var(--csm-company-bg); }
.csm-fleet-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.csm-fleet-heading .csm-select { width: 190px; }
#view-fleet .csm-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
#view-fleet .ship-box {
    min-height: 205px; padding: 22px; border: 1px solid var(--csm-company-line); border-radius: 8px;
    background: var(--csm-company-surface); color: var(--csm-company-ink); box-shadow: 0 8px 24px rgba(16,43,59,.06);
}
#view-fleet .ship-box:hover { border-color: #8cb6c3; box-shadow: 0 12px 28px rgba(16,43,59,.1); transform: translateY(-2px); }
.csm-vessel-card-tools { display: flex; gap: 6px; }
.csm-vessel-context { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.csm-vessel-context span { padding: 5px 8px; border-radius: 4px; background: #edf3f6; color: #476271; font-size: 12px; font-weight: 700; }
.csm-workspace-empty { place-items: center; min-height: 260px; color: var(--csm-company-muted); text-align: center; }
.csm-workspace-empty:not([hidden]) { display: grid; }
.csm-workspace-empty .dashicons { width: 44px; height: 44px; font-size: 44px; color: #8aa4b1; }
.csm-workspace-empty h3 { margin: 12px 0 0; color: var(--csm-company-ink); }
.csm-workspace-empty p { margin: 6px 0; }

/* Keep map navigation as one stable control group at every desktop width. */
.csm-cc-stage-copy { min-width: 0; }
.csm-map-controls { flex: 0 0 auto; flex-wrap: nowrap !important; white-space: nowrap; }
.csm-zone-back-btn {
    width: auto !important;
    min-width: 116px !important;
    min-height: 44px !important;
    flex: 0 0 auto;
    justify-content: center;
    padding: 0 13px !important;
    white-space: nowrap !important;
}
.csm-zone-back-btn .dashicons { flex: 0 0 20px; }

/* Evidence is an adaptive drawer, not a full-canvas wall. */
.csm-saas-shell .csm-gallery-overlay {
    inset: 16px auto auto 50% !important;
    width: min(1080px, calc(100% - 32px)) !important;
    height: auto !important;
    max-height: calc(100% - 32px) !important;
    transform: translate(-50%, 10px) !important;
}
.csm-saas-shell .csm-gallery-overlay.open { transform: translate(-50%, 0) !important; }
.csm-saas-shell .csm-gallery-overlay.is-compact,
.csm-saas-shell .csm-gallery-overlay.is-empty { width: min(720px, calc(100% - 32px)) !important; }
.csm-saas-shell .csm-gallery-overlay.is-compact .csm-gallery-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important; }
.csm-saas-shell .csm-gallery-overlay.is-compact .csm-gallery-grid,
.csm-saas-shell .csm-gallery-overlay.is-empty .csm-gallery-grid { flex: 0 1 auto !important; }
.csm-saas-shell .csm-gallery-grid { max-height: min(610px, calc(100vh - 300px)); }

#view-team, #view-subscription, #view-account { color: var(--csm-company-ink); }
.csm-page-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.csm-usage-summary { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px; border: 1px solid var(--csm-company-line); border-radius: 6px; background: #fff; }
.csm-usage-summary strong { color: var(--csm-company-ink); font-size: 20px; }
.csm-usage-summary span { color: var(--csm-company-muted); font-size: 13px; }
.csm-segmented { display: inline-flex; padding: 4px; margin-bottom: 18px; border: 1px solid var(--csm-company-line); border-radius: 7px; background: #e5eef2; }
.csm-segmented button { min-height: 38px; border: 0; border-radius: 5px; padding: 0 18px; background: transparent; color: #526b78; font: inherit; font-weight: 800; cursor: pointer; }
.csm-segmented button.is-active { background: #fff; color: var(--csm-company-ink); box-shadow: 0 2px 8px rgba(16,43,59,.1); }
.csm-team-panel { animation: csm-company-enter .22s ease-out; }
.csm-table-shell { overflow: auto; border: 1px solid var(--csm-company-line); border-radius: 8px; background: #fff; }
.csm-data-table { width: 100%; border-collapse: collapse; }
.csm-data-table th { padding: 13px 18px; background: #eaf1f4; color: #526b78; font-size: 11px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.csm-data-table td { padding: 16px 18px; border-top: 1px solid #dfE9ed; vertical-align: middle; }
.csm-data-table td:last-child { width: 48px; text-align: right; }
.csm-person-cell { display: flex; align-items: center; gap: 12px; }
.csm-person-cell > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #dff2f1; color: #075d5a; font-weight: 900; }
.csm-person-cell div { display: grid; gap: 3px; }
.csm-person-cell small { color: var(--csm-company-muted); }
.csm-member-role { min-width: 190px; }
.csm-status-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; color: #237454; }
.csm-status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #2b9b6d; }
.csm-pending-section { margin-top: 30px; }
.csm-pending-section .csm-section-heading { margin-bottom: 12px; }
.csm-pending-list { border-top: 1px solid var(--csm-company-line); }
.csm-pending-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 4px; border-bottom: 1px solid var(--csm-company-line); }
.csm-pending-row > div { display: flex; align-items: center; gap: 12px; }
.csm-pending-row > div:first-child > .dashicons { color: var(--csm-company-teal); }
.csm-pending-row strong, .csm-pending-row small { display: block; }
.csm-pending-row small { margin-top: 3px; color: var(--csm-company-muted); }
.csm-role-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.csm-role-toolbar h3 { margin: 0; }
.csm-role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 16px; }
.csm-role-card { display: grid; gap: 18px; padding: 20px; border: 1px solid var(--csm-company-line); border-radius: 8px; background: #fff; }
.csm-role-card h3 { margin: 0; }
.csm-role-card p { min-height: 42px; margin: 5px 0 0; color: var(--csm-company-muted); line-height: 1.5; }
.csm-role-meta { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: baseline; gap: 5px; padding: 12px 0; border-block: 1px solid #e2eaee; }
.csm-role-meta strong { font-size: 20px; }
.csm-role-meta span { color: var(--csm-company-muted); font-size: 12px; }
.csm-role-permission-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.csm-role-permission-preview span { padding: 5px 7px; border-radius: 4px; background: #edf4f6; color: #4d6876; font-size: 11px; font-weight: 700; }
.csm-role-actions { display: flex; justify-content: flex-end; gap: 8px; }
.csm-list-empty { padding: 22px; color: var(--csm-company-muted); text-align: center; }

.csm-sandbox-flag { padding: 7px 10px; border-radius: 4px; background: #fff5df; color: #8a5b16; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.csm-metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--csm-company-line); border-radius: 8px; background: #fff; overflow: hidden; }
.csm-metric-strip > div { display: grid; gap: 8px; padding: 18px; border-right: 1px solid var(--csm-company-line); }
.csm-metric-strip > div:last-child { border-right: 0; }
.csm-metric-strip span { color: var(--csm-company-muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.csm-metric-strip strong { font-size: 24px; }
.csm-metric-strip strong small { color: #8aa0ac; font-size: 13px; }
.csm-metric-strip i { height: 5px; border-radius: 3px; background: #dfe9ed; overflow: hidden; }
.csm-metric-strip b { display: block; height: 100%; background: var(--csm-company-teal); }
.csm-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.csm-plan { display: flex; flex-direction: column; min-height: 420px; padding: 24px; border: 1px solid var(--csm-company-line); border-radius: 8px; background: #fff; }
.csm-plan.is-current { border: 2px solid var(--csm-company-teal); padding: 23px; }
.csm-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.csm-plan-head h3 { margin: 0; font-size: 24px; }
.csm-plan-head span { padding: 5px 7px; border-radius: 4px; background: #dff2f1; color: #075d5a; font-size: 11px; font-weight: 900; }
.csm-plan > p { min-height: 64px; color: var(--csm-company-muted); line-height: 1.55; }
.csm-plan dl { margin: 12px 0 20px; }
.csm-plan dl div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #e4ecef; }
.csm-plan dt { color: var(--csm-company-muted); }
.csm-plan dd { margin: 0; font-weight: 900; }
.csm-plan ul { display: grid; gap: 10px; margin: 0 0 24px; padding: 0; list-style: none; }
.csm-plan li { display: flex; gap: 8px; color: #3f5b69; }
.csm-plan li .dashicons { color: var(--csm-company-teal); }
.csm-plan > .csm-btn { margin-top: auto; }

.csm-profile-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 30px; max-width: 1050px; }
.csm-profile-identity { align-self: start; padding: 24px; border: 1px solid var(--csm-company-line); border-radius: 8px; background: #f7fafb; text-align: center; }
.csm-company-logo-preview { display: grid; place-items: center; width: 112px; height: 112px; margin: 0 auto 16px; border: 1px solid var(--csm-company-line); border-radius: 8px; background: #fff; overflow: hidden; }
.csm-company-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.csm-company-logo-preview > span { color: var(--csm-company-teal); font-size: 42px; font-weight: 900; }
.csm-profile-identity h2 { margin: 0; }
.csm-profile-identity > p { margin: 6px 0 18px; color: var(--csm-company-muted); }
.csm-profile-member { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--csm-company-line); text-align: left; }
.csm-profile-member .dashicons { color: var(--csm-company-teal); }
.csm-profile-member div { display: grid; }
.csm-profile-member span:last-child { margin-top: 2px; color: var(--csm-company-muted); font-size: 12px; }
.csm-profile-form { padding: 26px; border: 1px solid var(--csm-company-line); border-radius: 8px; background: #fff; }
.csm-profile-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.csm-profile-fields:disabled { opacity: .78; }
.csm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.csm-field { display: grid; align-content: start; gap: 7px; margin: 0; }
.csm-field > span, .csm-layout-picker-field > span { color: #365463; font-size: 12px; font-weight: 900; }
.csm-field input, .csm-field select, .csm-field textarea, .csm-profile-form input, .csm-profile-form select {
    box-sizing: border-box; width: 100%; min-height: 44px; margin: 0; border: 1px solid #b9cdd6; border-radius: 6px;
    padding: 9px 11px; background: #fff; color: var(--csm-company-ink); font: inherit;
}
.csm-field textarea { resize: vertical; }
.csm-field input:focus, .csm-field select:focus, .csm-field textarea:focus { outline: 3px solid rgba(19,182,202,.16); border-color: var(--csm-company-cyan); }
.csm-field-wide { grid-column: 1 / -1; }
.csm-form-actions { display: flex; align-items: center; gap: 14px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--csm-company-line); }
.csm-inline-status { color: #28745a; font-size: 13px; }
.csm-inline-status.is-error, .csm-invite-result.is-error { color: var(--csm-company-red); }

.csm-structured-modal { color: var(--csm-company-ink); }
.csm-modal-medium { width: min(720px, calc(100vw - 40px)); max-height: calc(100vh - 50px); overflow: auto; padding: 28px; border-radius: 8px; background: #fff; box-shadow: 0 28px 80px rgba(4,30,45,.3); }
.csm-modal-heading { margin-bottom: 20px; }
.csm-modal-heading h3 { margin: 0; font-size: 24px; }
.csm-structured-modal .csm-field { margin-bottom: 15px; }
.csm-modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.csm-modal-action-spacer { flex: 1; }
.csm-layout-picker-field { display: grid; gap: 7px; }
.csm-layout-choice { display: grid; grid-template-columns: 36px minmax(0,1fr) 24px; align-items: center; gap: 10px; min-height: 62px; border: 1px solid #b9cdd6; border-radius: 6px; padding: 8px 12px; background: #fff; color: var(--csm-company-ink); text-align: left; cursor: pointer; }
.csm-layout-choice:hover { border-color: var(--csm-company-teal); background: #f4fbfa; }
.csm-layout-choice > .dashicons:first-child { color: var(--csm-company-teal); }
.csm-layout-choice span:nth-child(2) { display: grid; gap: 3px; }
.csm-layout-choice small { color: var(--csm-company-muted); }
.csm-invite-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 0; margin-top: 8px; color: #28745a; font-size: 13px; }
.csm-copy-invite-link { border: 0; background: transparent; color: var(--csm-company-teal-dark); font: inherit; font-weight: 900; cursor: pointer; }
.csm-permission-fieldset { margin: 20px 0 0; border: 1px solid var(--csm-company-line); border-radius: 8px; padding: 18px; }
.csm-permission-fieldset legend { padding: 0 8px; color: var(--csm-company-ink); font-weight: 900; }
.csm-permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.csm-permission-grid section { display: grid; align-content: start; gap: 7px; }
.csm-permission-grid h4 { margin: 0 0 4px; color: var(--csm-company-muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.csm-permission-grid label { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 7px 9px; border-radius: 5px; background: #f5f8f9; cursor: pointer; }
.csm-permission-grid input { width: 18px; height: 18px; accent-color: var(--csm-company-teal); }
.csm-permission-grid strong { font-size: 13px; }

.csm-catalogue-modal { display: grid; grid-template-rows: auto 1fr; width: min(1500px, calc(100vw - 36px)); height: min(900px, calc(100vh - 36px)); border-radius: 8px; overflow: hidden; background: #f6fafb; }
.csm-catalogue-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 82px; padding: 0 24px; border-bottom: 1px solid var(--csm-company-line); background: #fff; }
.csm-catalogue-header h2 { margin: 0; color: var(--csm-company-ink); }
.csm-catalogue-header p { margin: 5px 0 0; color: var(--csm-company-muted); }
.csm-catalogue-actions { display: flex; gap: 10px; }
.csm-catalogue-shell { display: grid; grid-template-columns: 360px minmax(0, 1fr); min-height: 0; }
.csm-catalogue-list-panel { min-height: 0; padding: 18px; border-right: 1px solid var(--csm-company-line); background: #fff; overflow: auto; }
.csm-catalogue-list-panel > .csm-search-field { position: sticky; top: 0; z-index: 2; margin-bottom: 12px; background: #fff; }
.csm-catalogue-list { display: grid; gap: 7px; }
.csm-catalogue-item { display: grid; grid-template-columns: 58px minmax(0,1fr) 22px; align-items: center; gap: 12px; min-height: 78px; border: 1px solid transparent; border-radius: 7px; padding: 8px; background: transparent; color: var(--csm-company-ink); text-align: left; cursor: pointer; }
.csm-catalogue-item:hover { background: #edf4f6; }
.csm-catalogue-item.is-active { border-color: #7fc7c3; background: #e4f5f3; }
.csm-catalogue-thumb { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 5px; background: #dce8ed; overflow: hidden; }
.csm-catalogue-thumb img { width: 100%; height: 100%; object-fit: contain; }
.csm-catalogue-item > span:nth-child(2) { display: grid; gap: 5px; }
.csm-catalogue-item small { color: var(--csm-company-muted); line-height: 1.35; }
.csm-catalogue-viewer { display: grid; grid-template-rows: auto minmax(0,1fr); min-width: 0; min-height: 0; }
.csm-catalogue-viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; padding: 0 20px; border-bottom: 1px solid var(--csm-company-line); background: #f9fbfc; }
.csm-catalogue-viewer-toolbar > div:first-child { display: grid; gap: 4px; }
.csm-catalogue-viewer-toolbar span { color: var(--csm-company-muted); font-size: 12px; }
.csm-catalogue-stage { position: relative; min-height: 0; overflow: hidden; background: #dce8ed; cursor: grab; touch-action: none; }
.csm-catalogue-stage.is-panning { cursor: grabbing; }
.csm-catalogue-canvas { position: absolute; top: 50%; left: 50%; width: min(36vh, 340px); aspect-ratio: 1 / 3; transform-origin: center; translate: -50% -50%; background: transparent; transition: transform .12s ease-out; }
.csm-catalogue-stage.is-panning .csm-catalogue-canvas { transition: none; }
.csm-catalogue-canvas > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#csm-catalogue-shapes { position: absolute; inset: 0; }
.csm-catalogue-shape { position: absolute; box-sizing: border-box; display: grid; place-items: center; transform-origin: center; }
.csm-catalogue-shape.is-zone { border: 1px solid #16a7b5; background: rgba(19,182,202,.10); color: #062c3c; }
.csm-catalogue-shape.is-zone span { padding: 2px 5px; border-radius: 3px; background: #092d40; color: #fff; font-size: 7px; font-weight: 800; }
.csm-catalogue-shape.is-component { border: 1px solid #c64b54; background: rgba(255,255,255,.92); color: #153747; }
.csm-catalogue-shape.is-component span { font-size: 6px; font-weight: 800; text-align: center; }
.csm-catalogue-shape.is-component svg { width: 45%; height: 45%; }
.csm-catalogue-shape.is-arrow { color: #10a8bd; }
.csm-catalogue-shape.is-arrow svg { width: 100%; height: 100%; }
.csm-catalogue-stage > .csm-workspace-empty { position: absolute; inset: 0; }

.csm-toast { position: fixed; right: 24px; bottom: 24px; z-index: 1000000; max-width: 380px; padding: 13px 16px; border-radius: 6px; background: #0d3448; color: #fff; box-shadow: 0 16px 42px rgba(5,30,44,.28); opacity: 0; transform: translateY(12px); transition: .2s ease; }
.csm-toast.is-visible { opacity: 1; transform: none; }
.csm-toast.is-error { background: #9f3039; }

@keyframes csm-company-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .csm-team-panel, .ship-box, .csm-toast, .csm-catalogue-canvas { animation: none !important; transition: none !important; } }

@media (max-width: 1100px) {
    .csm-fleet-workspace { grid-template-columns: 230px minmax(0, 1fr); }
    .csm-plan-grid { grid-template-columns: 1fr; }
    .csm-plan { min-height: 0; }
    .csm-profile-layout { grid-template-columns: 220px minmax(0,1fr); }
    .csm-catalogue-shell { grid-template-columns: 300px minmax(0,1fr); }
}
@media (max-width: 780px) {
    .csm-side-nav {
        grid-template-columns: 42px minmax(0, 1fr) !important;
        gap: 8px !important;
    }
    .csm-logo {
        width: 42px !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        border: 0 !important;
    }
    .csm-logo > span:last-child { display: none !important; }
    .csm-nav-list {
        display: flex !important;
        width: 100% !important;
        min-width: 0;
        flex-wrap: nowrap !important;
        justify-content: flex-end !important;
        gap: 4px !important;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .csm-nav-list::-webkit-scrollbar { display: none; }
    .csm-nav-item {
        width: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        justify-content: center;
    }
    .csm-fleet-workspace { display: block; margin: -16px; }
    .csm-fleet-rail { border-right: 0; border-bottom: 1px solid var(--csm-company-line); }
    .csm-fleet-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .csm-fleet-list-row { grid-template-columns: minmax(0,1fr) 34px; }
    .csm-fleet-results { padding: 20px 16px; }
    .csm-fleet-heading, .csm-page-intro, .csm-role-toolbar { align-items: stretch; flex-direction: column; }
    .csm-fleet-heading .csm-select { width: 100%; }
    .csm-metric-strip { grid-template-columns: repeat(2,1fr); }
    .csm-metric-strip > div:nth-child(2) { border-right: 0; }
    .csm-metric-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--csm-company-line); }
    .csm-profile-layout { grid-template-columns: 1fr; }
    .csm-form-grid, .csm-permission-grid { grid-template-columns: 1fr; }
    .csm-field-wide { grid-column: auto; }
    .csm-catalogue-shell { grid-template-columns: 1fr; grid-template-rows: 220px minmax(0,1fr); }
    .csm-catalogue-list-panel { border-right: 0; border-bottom: 1px solid var(--csm-company-line); }
    .csm-catalogue-viewer-toolbar { align-items: flex-start; padding-block: 10px; }
    .csm-data-table { min-width: 680px; }
    .csm-pending-row { align-items: flex-start; flex-direction: column; gap: 10px; }
    .csm-pending-row > div:last-child { align-self: stretch; justify-content: flex-end; }
    .csm-map-controls { width: 100%; overflow-x: auto; justify-content: flex-start !important; padding-bottom: 2px; scrollbar-width: none; }
    .csm-map-controls::-webkit-scrollbar { display: none; }
    .csm-zone-back-btn { min-width: 108px !important; }
    .csm-saas-shell .csm-gallery-overlay,
    .csm-saas-shell .csm-gallery-overlay.is-compact,
    .csm-saas-shell .csm-gallery-overlay.is-empty { inset: 8px 8px auto 8px !important; width: auto !important; max-height: calc(100% - 16px) !important; transform: translateY(10px) !important; }
    .csm-saas-shell .csm-gallery-overlay.open { transform: translateY(0) !important; }
    .csm-gallery-toolbar-actions { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; gap: 6px !important; }
    .csm-gallery-toolbar-meta { padding: 0 8px !important; font-size: 10px !important; }
    .csm-saas-shell .csm-gallery-grid { overflow-x: hidden !important; }
}

/* REWA 1.9.2 responsive and accessibility stabilization. */
.csm-command-zone,
.csm-command-component {
    margin: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.csm-command-zone:focus-visible,
.csm-command-component:focus-visible {
    outline: 3px solid #0b7f79 !important;
    outline-offset: 3px;
}

.csm-img-card-media img {
    object-fit: contain !important;
}

.csm-img-card[role="button"] {
    cursor: zoom-in;
}

@media (max-width: 780px) {
    .csm-saas-shell {
        min-height: 100dvh !important;
    }

    .csm-side-nav {
        position: fixed !important;
        z-index: 10000;
        inset: auto 0 0 0;
        display: block !important;
        width: 100% !important;
        min-height: 68px !important;
        height: 68px !important;
        padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)) !important;
        border-top: 1px solid rgba(255, 255, 255, .14);
        border-right: 0;
    }

    .csm-logo {
        display: none !important;
    }

    .csm-nav-list {
        display: grid !important;
        grid-auto-flow: column;
        grid-auto-columns: minmax(58px, 1fr);
        width: 100% !important;
        height: 56px;
        justify-content: stretch !important;
        gap: 2px !important;
        overscroll-behavior-inline: contain;
    }

    .csm-nav-item {
        display: flex !important;
        width: 100% !important;
        min-width: 58px !important;
        min-height: 56px !important;
        flex-direction: column;
        gap: 3px !important;
        padding: 5px 4px !important;
        font-size: 11px !important;
        line-height: 1.15;
    }

    .csm-nav-item > span:last-child {
        display: block !important;
        max-width: 68px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .csm-nav-item .dashicons {
        width: 19px;
        height: 19px;
        font-size: 19px;
    }

    .csm-main-workspace,
    .csm-scroll-area {
        min-height: 0;
    }

    .csm-main-workspace {
        width: 100% !important;
        height: calc(100dvh - 68px) !important;
    }

    .csm-scroll-area {
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        scrollbar-gutter: auto;
    }

    .csm-fleet-workspace {
        margin: -14px !important;
    }

    .csm-fleet-rail {
        padding: 16px 14px !important;
    }

    .csm-fleet-rail-head h2,
    .csm-fleet-heading h2 {
        font-size: 20px;
    }

    .csm-fleet-search {
        margin: 12px 0 10px;
    }

    .csm-fleet-filter {
        min-height: 40px;
        padding-inline: 9px;
        font-size: 13px;
    }

    .csm-fleet-plan-usage {
        margin-top: 14px;
        padding-top: 12px;
    }

    .csm-fleet-results {
        padding: 18px 14px 24px !important;
    }

    .csm-fleet-heading {
        gap: 12px;
        margin-bottom: 14px;
    }

    #view-fleet .csm-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #view-fleet .ship-box {
        min-height: 0;
        padding: 17px;
    }

    .csm-gallery-toolbar-copy {
        flex: 1 1 auto;
        min-width: 0;
    }

    #csm-active-point-name {
        display: -webkit-box;
        margin-top: 4px;
        overflow: hidden;
        font-size: 17px !important;
        line-height: 1.2;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .csm-gallery-toolbar-actions {
        flex: 0 0 auto;
        width: auto !important;
    }

    .csm-gallery-toolbar-meta {
        min-height: 38px !important;
    }

    .csm-saas-shell .csm-gallery-grid {
        max-height: calc(100dvh - 290px);
        overscroll-behavior: contain;
    }
}
