/* Global reset + base look */

* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    background: #0f172a;        /* dark navy */
    color: #e5e7eb;
}

/* Top bar */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #020617;
    border-bottom: 1px solid #1e293b;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    font-weight: 600;
    letter-spacing: 0.05em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-link,
.topbar-menu summary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid #1e293b;
    color: #cbd5f5;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}

.topbar-link:hover,
.topbar-menu summary:hover {
    background: #0b1220;
}

.topbar-menu {
    position: relative;
}

.topbar-menu summary {
    list-style: none;
}

.topbar-menu summary::-webkit-details-marker {
    display: none;
}

.topbar-menu[open] summary {
    background: #0b1220;
    border-color: #334155;
}

.topbar-panel {
    position: absolute;
    left: 0;
    top: calc(100% + 0.5rem);
    min-width: 520px;
    max-width: 90vw;
    margin: 0;
    padding: 1rem;
    z-index: 50;
    max-height: 70vh;
    overflow: auto;
}

.topbar-panel.card {
    margin-bottom: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.btn-compact {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.topbar-panel .table {
    margin-top: 0;
    font-size: 0.8rem;
}

.topbar-panel .table th,
.topbar-panel .table td {
    padding: 0.35rem 0.45rem;
}

.panel-empty {
    color: #9ca3af;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.panel-footer {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.panel-footer a {
    color: #93c5fd;
    text-decoration: none;
}

.panel-footer a:hover {
    text-decoration: underline;
}

.topbar nav a {
    margin-left: 1rem;
    text-decoration: none;
    color: #cbd5f5;
    font-size: 0.95rem;
}

.topbar nav a:hover {
    text-decoration: underline;
}

.user-tag {
    margin-left: 1rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #1e293b;
    font-size: 0.8rem;
}

@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .topbar-left {
        flex-wrap: wrap;
    }
    .topbar-panel {
        min-width: 90vw;
    }
}

/* Main container – slightly left-aligned */

.container {
    max-width: 1200px;
    margin: 1.5rem 0 1.5rem 2rem;  /* top, right, bottom, left */
    padding-right: 1rem;
}

/* Cards, headers, forms, tables */

.card {
    background: #020617;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid #1e293b;
    box-shadow: 0 18px 45px rgba(0,0,0,0.35);
    margin-bottom: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.page-header--stacked {
    align-items: flex-start;
    gap: 1rem;
}

.page-header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
}

.date-range-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.date-range-form input[type="text"] {
    width: 9rem;
}

h1, h2 {
    margin: 0 0 0.75rem;
}

.form label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid #1e293b;
    background: #020617;
    color: #e5e7eb;
}

.form-grid {
    display: grid;
    gap: 0.75rem;
}

.form-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-section {
    margin-top: 1rem;
}

.form-note {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.survey-options {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.survey-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.survey-date {
    margin-left: auto;
    font-size: 0.85rem;
    color: #93c5fd;
}

.relation-target {
    margin-top: 0.5rem;
}

.relation-target select[multiple] {
    min-height: 8rem;
}

button,
.btn-primary {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: #4f46e5;
    color: white;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

button:hover,
.btn-primary:hover {
    background: #6366f1;
}

.btn-secondary {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid #1e293b;
    cursor: pointer;
    background: #0b1220;
    color: #cbd5f5;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #111827;
}

.btn-danger {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: #b91c1c;
    color: white;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: #d97706;
    color: white;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-warning:hover {
    background: #f59e0b;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.inline-form {
    display: inline-flex;
}

.table-empty {
    text-align: center;
    color: #94a3b8;
}

.row-warning {
    background: #3f1d1d;
}

.row-disabled {
    color: #fca5a5;
}

.muted {
    color: #94a3b8;
}

.admin-link-grid a {
    text-align: center;
}

.admin-summary {
    margin-top: 0.75rem;
    color: #e2e8f0;
}

.inline-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-columns {
    margin-top: 0.5rem;
    align-self: stretch;
}

.export-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.export-columns-form-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.export-columns-form-inline .export-columns {
    margin-top: 0;
}

.export-columns-form-inline--extended {
    align-items: flex-start;
}

.export-columns-form-inline--extended .export-columns {
    align-self: flex-start;
}

.export-columns summary {
    list-style: none;
    cursor: pointer;
}

.export-columns summary::-webkit-details-marker {
    display: none;
}

.export-columns-form {
    margin-top: 0.5rem;
}

.export-columns-panel {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #1f2933;
    border-radius: 0.6rem;
    background: #0b1220;
}

.export-columns-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 0.5rem;
}

.export-columns-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.export-columns-title {
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.25rem;
}

.export-columns-actions {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table th,
.table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #1f2933;
}

.table th {
    text-align: left;
    font-weight: 500;
    color: #9ca3af;
}

.table th a {
    color: inherit;
}

.table th a.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
}

.table th a.sort-link:hover {
    text-decoration: none;
    color: #e5e7eb;
}

.table th a.sort-link .sort-arrow {
    font-size: 0.65rem;
    opacity: 0.35;
    transform: translateY(-1px);
}

.table th a.sort-link.active {
    color: #e5e7eb;
}

.table th a.sort-link.active .sort-arrow {
    opacity: 1;
    color: #93c5fd;
}

.table tr:hover {
    background: rgba(15,23,42,0.8);
}

.table tbody tr.clickable-row {
    cursor: pointer;
}

.table a {
    color: #93c5fd;
    text-decoration: none;
}
.table a:hover {
    text-decoration: underline;
}

@media (max-width: 720px) {
    .form-grid.two-col {
        grid-template-columns: 1fr;
    }
}

/* Flash messages */

.flash-area {
    margin-bottom: 1rem;
}

.flash {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.flash-error {
    background: rgba(248,113,113,0.15);
    border: 1px solid rgba(248,113,113,0.5);
}

.flash-success {
    background: rgba(52,211,153,0.15);
    border: 1px solid rgba(52,211,153,0.5);
}

/* Pills (priority, status) */

.pill {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid transparent;
}

.priority-low {
    background: rgba(34,197,94,0.26);
    border-color: rgba(34,197,94,0.55);
}
.priority-medium {
    background: rgba(234,179,8,0.26);
    border-color: rgba(234,179,8,0.55);
}
.priority-high {
    background: rgba(249,115,22,0.26);
    border-color: rgba(249,115,22,0.55);
}
.priority-critical {
    background: rgba(248,113,113,0.26);
    border-color: rgba(248,113,113,0.55);
}

.status-open { border: 1px solid #22c55e; }
.status-in_progress { border: 1px solid #eab308; }
.status-closed { border: 1px solid #64748b; }
.status-cancelled { border: 1px solid #ef4444; }

/* Shore dashboard layout with sidebar */

.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1rem;
    align-items: flex-start;
}

@media (max-width: 800px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    background: #020617;
    border-radius: 0.75rem;
    border: 1px solid #1e293b;
    padding: 0.75rem;
}

.sidebar-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9ca3af;
    margin: 0 0 0.5rem;
}

.ship-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ship-item {
    display: block;
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    text-decoration: none;
    color: #e5e7eb;
    font-size: 0.9rem;
}

.ship-item:hover {
    background: #030712;
}

.ship-item.active {
    background: #111827;
    border: 1px solid #4f46e5;
}

.ship-name {
    font-weight: 500;
}

.ship-code {
    font-size: 0.75rem;
    color: #9ca3af;
}

.main-panel {
    min-height: 280px;
}

/* Report detail layout & timeline (for the detail page) */

.report-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr);
    gap: 1rem;
}

@media (min-width: 900px) {
    .report-layout {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
        grid-template-rows: auto auto;
    }
    .report-layout > .card:nth-child(1) {
        grid-row: span 2;
    }
}

.description {
    white-space: pre-wrap;
    line-height: 1.5;
}

.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}
.timeline li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #1e293b;
}
.timeline-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #9ca3af;
}
.timeline-note {
    margin-top: 0.25rem;
    font-size: 0.9rem;
}
.timeline-status {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #a5b4fc;
}

/* Malfunction report form/view */

.malf-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.malf-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #cbd5f5;
}

.malf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.malf-table th,
.malf-table td {
    border: 1px solid #1e293b;
    padding: 0.45rem 0.55rem;
    vertical-align: top;
}

.malf-table th {
    background: #0b1220;
    font-weight: 600;
    text-align: left;
    width: 22%;
}

.malf-text-block {
    white-space: pre-wrap;
}

.malf-form-table input,
.malf-form-table textarea,
.malf-form-table select {
    margin-top: 0;
    width: 100%;
}

.malf-form-table textarea {
    resize: vertical;
}

.malf-readonly {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
    cursor: not-allowed;
}

.malf-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.attachment-list {
    margin: 0.35rem 0 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.25rem;
    font-size: 0.85rem;
    line-height: 1.2;
    white-space: normal;
}

.attachment-list li {
    margin: 0;
}

.attachment-list a {
    display: inline-block;
    color: #93c5fd;
    text-decoration: none;
}

.attachment-list a:hover {
    text-decoration: underline;
}
/* Ship silhouette visual */

.ship-visual {
    margin-bottom: 1rem;
}

.ship-visual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.ship-visual-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.ship-visual-subtitle {
    font-size: 0.8rem;
    color: #9ca3af;
}

.ship-visual-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* silhouette container */

.ship-outline {
    position: relative;
    display: inline-block;
    padding: 0.75rem;
    border-radius: 1rem;
    border: 2px solid #1e293b;
    background: #020617;
    overflow: hidden;
}
/* Base brightness based on overall ship severity */

.ship-outline-warning .ship-layer-base,
.ship-outline-critical .ship-layer-base {
    /* darken the white so the tinted overlay stands out */
    filter: brightness(0.3) contrast(1.3);
}

.ship-layer-base {
    display: block;
    width: 100%;
    height: auto;
    filter: brightness(0.25) contrast(1.3);  /* dark grey baseline */
}

/* brighten base slightly when everything is fine */
.ship-outline-ok .ship-layer-base {
    filter: brightness(0.5) contrast(1.3) drop-shadow(0 0 4px rgba(15,23,42,0.8));
}


/* Overlays – stacked exactly on top of base */
.ship-layer-bridge,
.ship-layer-hull {
    position: absolute;
    inset: 0;              /* top:0; right:0; bottom:0; left:0 */
    width: 97.2%;          /* your alignment tweak */
    height: auto;
    object-fit: contain;
    pointer-events: none;
    opacity: 0;            /* start hidden */
}

/* Fine-tuning alignment: small nudge without breaking absolute pos */
.ship-layer-bridge {
    transform: translate(1.5%, 5.5%);
}

.ship-layer-hull {
    transform: translate(1.5%, 5.5%);
}

/* BRIDGE / HULL colour by severity – explicit filter recipes */

/* OK – bright GREEN */
.ship-layer-bridge.ship-layer-state-ok,
.ship-layer-hull.ship-layer-state-ok {
    opacity: 1;
    filter:
        invert(63%)
        sepia(97%)
        saturate(626%)
        hue-rotate(76deg)
        brightness(101%)
        contrast(102%)
        drop-shadow(0 0 14px rgba(34,197,94,0.9));  /* green glow */
}

/* Medium / High – strong YELLOW */
.ship-layer-bridge.ship-layer-state-warning,
.ship-layer-hull.ship-layer-state-warning {
    opacity: 1;
    filter:
        invert(86%)
        sepia(63%)
        saturate(904%)
        hue-rotate(3deg)
        brightness(103%)
        contrast(104%)
        drop-shadow(0 0 16px rgba(234,179,8,0.95)); /* yellow glow */
}

/* Critical – deep RED */
.ship-layer-bridge.ship-layer-state-critical,
.ship-layer-hull.ship-layer-state-critical {
    opacity: 1;
    filter:
        invert(30%)
        sepia(93%)
        saturate(7429%)
        hue-rotate(-10deg)
        brightness(96%)
        contrast(122%)
        drop-shadow(0 0 18px rgba(248,113,113,1));  /* red glow */
}

/* clickable zones */

.ship-zone-hit {
    position: absolute;
    text-decoration: none;
    color: #e5e7eb;
}


/* positions that match your PNG geometry */

.zone-bridge {
    top: 10%;
    left: 12%;
    width: 10%;
    height: 45%;
}

.zone-hull {
    bottom: 0%;
    left: 0%;
    width: 100%;
    height: 44%;
}

/* tiny labels sitting in the middle of each hit area */

.zone-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15,23,42,0.9);
    padding: 0.1rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.8);
    pointer-events: none; /* so click still works anywhere */
    opacity: 0.9;
}
/* overall ship status pill */

.ship-status-label {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.ship-status-ok {
    background: rgba(34,197,94,0.15);
    border-color: rgba(34,197,94,0.7);
}

.ship-status-warning {
    background: rgba(234,179,8,0.15);
    border-color: rgba(234,179,8,0.7);
}

.ship-status-critical {
    background: rgba(248,113,113,0.15);
    border-color: rgba(248,113,113,0.7);
}

/* Ship row layout: silhouette card on the left, fluids + ETA stacked on the right */
/* Implementation: ship card stays full-width; fluids + ETA live in an overlay
   column on the right that does NOT shrink the ship silhouette. */

.ship-main-row {
    position: relative;      /* anchor for overlay */
    margin-bottom: 1.5rem;   /* gap before Reports card */
}

.card.ship-visual {
    width: 100%;             /* let the silhouette card span the whole main panel */
}

/* Overlay column on the right for fluids + schedule */
.ship-right-col {
    position: absolute;
    top: 0rem;            /* align with top of ship card content */
    right: -17.25rem;
    width: 260px;            /* width of the right column */
    max-width: 32%;
    display: flex;
    flex-direction: column;
    gap: 0rem;            /* space between fluids card and ETA card */
    z-index: 2;
}

/* Inside overlay, fluids and schedule are just stacked cards */
.card.fluid-card,
.card.schedule-card {
    position: static;
    width: 100%;
    max-width: 100%;
}

/* On small screens, disable overlay and stack everything */
@media (max-width: 900px) {
    .ship-main-row {
        position: static;
        margin-bottom: 1rem;
    }

    .ship-right-col {
        position: static;
        width: 100%;
        max-width: none;
        margin-top: 0.75rem;
    }

    .card.fluid-card,
    .card.schedule-card {
        width: 100%;
    }
}

/* AIS cards */

.ais-map-card {
    margin-top: 0.75rem;
}

.ais-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.ais-card-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.ais-card-meta {
    font-size: 0.78rem;
    color: #9ca3af;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ais-card-note {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #facc15;
}

.ais-map {
    height: 280px;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #1e293b;
}

.ais-arrow-icon {
    background: transparent;
    border: none;
}

.ais-ship {
    width: 20px;
    height: 28px;
    background: #f97316;
    clip-path: polygon(50% 0%, 80% 25%, 78% 100%, 22% 100%, 20% 25%);
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.6));
    transform-origin: 50% 70%;
    position: relative;
}

.ais-ship::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 6px;
    background: #fb923c;
    left: 50%;
    top: 40%;
    transform: translateX(-50%);
    border-radius: 1px;
}

.ais-map-footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.ais-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.ais-value {
    font-variant-numeric: tabular-nums;
    color: #e5e7eb;
    font-size: 0.92rem;
}

.ais-empty {
    padding: 0.75rem 0.5rem;
    font-size: 0.86rem;
    color: #94a3b8;
}

.ais-stats-card {
    margin-bottom: 0.6rem;
}

.ais-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem 0.75rem;
    margin: 0;
}

.ais-stats div {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.ais-stats dt {
    font-size: 0.8rem;
    color: #9ca3af;
}

.ais-stats dd {
    margin: 0;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.pill-warning {
    display: inline-block;
    margin-left: 0.35rem;
    background: rgba(234,179,8,0.15);
    border: 1px solid rgba(234,179,8,0.7);
    color: #facc15;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
}

/* Fluid card styling */

.card.fluid-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.fluid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.fluid-card-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.fluid-card-meta {
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: right;
}

.fluid-card-meta span {
    font-variant-numeric: tabular-nums;
}

/* Bars */

.fluid-bar {
    margin-bottom: 0.3rem;
}

.fluid-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
}

.fluid-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: #9ca3af;
}

.fluid-value {
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
}

.fluid-bar-track {
    width: 100%;
    height: 0.55rem;
    border-radius: 999px;
    border: 1px solid #1e293b;
    background: linear-gradient(90deg, rgba(15,23,42,0.9), rgba(15,23,42,0.8));
    overflow: hidden;
}

.fluid-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease-out;
}

/* colour mapping */
.fluid-ok {
    background: linear-gradient(90deg, #22c55e, #4ade80);
    box-shadow: 0 0 10px rgba(34,197,94,0.6);
}

.fluid-warning {
    background: linear-gradient(90deg, #eab308, #facc15);
    box-shadow: 0 0 10px rgba(234,179,8,0.6);
}

.fluid-critical {
    background: linear-gradient(90deg, #f97316, #ef4444);
    box-shadow: 0 0 10px rgba(248,113,113,0.7);
}

/* Log */

.fluid-log {
    margin-top: 0.25rem;
}

.fluid-log-title {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.2rem;
}

.fluid-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}

.fluid-log-table th,
.fluid-log-table td {
    padding: 0.15rem 0.2rem;
    border-bottom: 1px solid #1e293b;
}

.fluid-log-table th {
    text-align: left;
    color: #9ca3af;
}

.fluid-log-empty {
    font-size: 0.72rem;
    color: #6b7280;
}

/* Trend cards (Fuel Oil / D.O charts) */

.card.trend-card {
    padding: 1.1rem;
}

.trend-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.35rem;
    gap: 0.75rem;
}

.trend-card-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.trend-card-meta {
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.trend-chart {
    width: 100%;
    height: 112px;
    display: block;
}

.trend-empty {
    font-size: 0.72rem;
    color: #6b7280;
}

/* Form */

.fluid-form {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px dashed #1f2937;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem 0.6rem;
    align-items: end;
}

@media (max-width: 900px) {
    .fluid-form {
        grid-template-columns: 1fr;
    }
}

.fluid-form-row label {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    margin-bottom: 0.1rem;
}

.fluid-form-row input {
    width: 100%;
}

.fluid-form-button {
    justify-self: flex-end;
    font-size: 0.8rem;
    padding: 0.35rem 0.9rem;
}

/* Crew dashboard: wide reports table + floating fluids card */
.crew-dashboard-row {
    position: relative;
    margin-top: 1rem;
}

/* Left side: reports card takes almost full width */
.crew-main-reports {
    margin-right: 320px;   /* width of fluid card + gap */
}

.crew-main-reports .card {
    width: 100%;
}

/* Right side: fluids card pinned to the right */
.card.fluid-card-standalone {
    position: absolute;
    top: 0;
    right: 1.5rem;
    width: 280px;
    max-width: 280px;
}

/* On small screens, stack vertically */
@media (max-width: 900px) {
    .crew-dashboard-row {
        position: static;
    }
    .crew-main-reports {
        margin-right: 0;
    }
    .card.fluid-card-standalone {
        position: static;
        width: 100%;
        max-width: none;
        margin-top: 1rem;
    }
}

/* Noon report layout */

.noon-form label {
    font-size: 0.85rem;
}

.noon-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
}

.coord-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.coord-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.coord-input {
    flex: 1;
    min-width: 0;
}

.coord-hem-toggle {
    display: inline-flex;
    position: relative;
    border: 1px solid #1f2a44;
    border-radius: 999px;
    overflow: hidden;
    background: #0f172a;
}

.coord-hem-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.coord-hem-toggle label {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.coord-hem-toggle input:checked + label {
    background: #3b82f6;
    color: #0b1120;
}

@media (max-width: 900px) {
    .noon-grid {
        grid-template-columns: 1fr;
    }

    .coord-pair {
        grid-template-columns: 1fr;
    }
}

.noon-bunkers-table input.noon-input {
    width: 100%;
    font-size: 0.8rem;
    margin-top: 0;
    padding: 0.35rem 0.45rem;
}

.noon-input-readonly {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
    cursor: not-allowed;
}

/* Ensure any readonly fields in the noon form are visibly "greyed out" */
.noon-form input[readonly],
.noon-form textarea[readonly] {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
    cursor: not-allowed;
}

/* Make noon form reasonably printable */
@media print {
    body {
        background: #ffffff;
        color: #000000;
    }
    .topbar, .btn-primary {
        display: none !important;
    }
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* --- Noon report print view --- */

.noon-report-print {
    position: relative;
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    background-color: #020617; /* matches dark cards */
    color: #e5e7eb;
}

.noon-report-title {
    text-align: center;
    margin-bottom: 0.75rem;
    letter-spacing: 0.08em;
    font-size: 1.1rem;
}

/* Watermark */
.noon-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 4rem;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.14);
    pointer-events: none;
    z-index: 0;
}

.noon-report-print-content {
    position: relative;
    z-index: 1;
}

/* Tables */
.noon-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    background-color: #020617;
}

.noon-table th,
.noon-table td {
    border: 1px solid #1f2937;
    padding: 0.25rem 0.4rem;
    vertical-align: middle;
}

.noon-table th {
    text-align: center;
    font-weight: 600;
}

.noon-row-no {
    width: 2rem;
    text-align: center;
    white-space: nowrap;
}

.noon-master-name {
    margin-top: 1rem;
    font-size: 0.85rem;
}

/* Print tweaks – for "Save as PDF" */
@media print {
    body {
        background: #ffffff;
        color: #000000;
    }

    .topbar,
    .sidebar,
    .btn-primary,
    .page-header {
        display: none !important;
    }

    .noon-report-print {
        padding: 0;
        margin: 0;
        max-width: none;
        background: #ffffff;
        color: #000000;
    }

    .noon-table {
        background: #ffffff;
    }

    .noon-table th,
    .noon-table td {
        border-color: #000000;
    }

    .noon-watermark {
        color: rgba(0, 0, 0, 0.07);
    }
}

/* Remove number spinners on noon numeric inputs */
.noon-form input[type=number]::-webkit-outer-spin-button,
.noon-form input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.noon-form input[type=number] {
    -webkit-appearance: textfield;
    appearance: textfield;
    -moz-appearance: textfield;
}

.cert-status {
    font-weight: 600;
}

.cert-unknown {
    color: #9ca3af; /* grey */
}

.cert-expired {
    color: #f97373; /* red-ish */
}

.cert-urgent {
    color: #fb923c; /* orange */
}

.cert-warning {
    color: #facc15; /* yellow */
}

.cert-ok {
    color: #4ade80; /* green */
}

.cert-tree {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.cert-node {
    --level: 0;
}

.cert-branch {
    margin-left: calc(var(--level) * 18px);
}

.cert-branch > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.5rem;
    color: #e2e8f0;
}

.cert-branch > summary:hover {
    background: #0b1220;
}

.cert-branch > summary::-webkit-details-marker {
    display: none;
}

.cert-branch > summary::before {
    content: ">";
    display: inline-block;
    width: 1rem;
    transform: rotate(0deg);
    transition: transform 0.15s ease;
    color: #94a3b8;
}

.cert-branch[open] > summary::before {
    transform: rotate(90deg);
}

.cert-branch > summary::marker {
    content: "";
}

.cert-branch-card {
    position: relative;
    margin-left: calc(var(--level) * 18px);
}

.cert-branch-card > summary {
    list-style: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: block;
    border-radius: 0;
    background: transparent;
}

.cert-branch-card > summary::-webkit-details-marker {
    display: none;
}

.cert-branch-card > summary::marker {
    content: "";
}

.cert-branch-card > summary::before {
    content: none;
}

.cert-branch-card > summary:hover {
    background: transparent;
}

.cert-branch-card > summary:focus {
    outline: none;
}

.cert-branch-card .cert-leaf {
    margin-left: 0;
}

.cert-branch-card .cert-leaf-toggle {
    position: relative;
    padding-left: 1.4rem;
    padding-right: 8rem;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.cert-branch-card .cert-leaf-toggle::before {
    content: ">";
    position: absolute;
    left: 0.5rem;
    top: 0.6rem;
    color: #94a3b8;
    transition: transform 0.15s ease;
}

.cert-branch-card[open] .cert-leaf-toggle::before {
    transform: rotate(90deg);
}

.cert-branch-card .cert-children {
    margin-left: 1.2rem;
    padding-left: 0.6rem;
    border-left: 1px solid rgba(30,41,59,0.6);
}

.cert-branch-title {
    font-weight: 600;
}

.cert-children {
    margin-top: 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.cert-leaf {
    margin-left: calc(var(--level) * 18px);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0.7rem;
    border-radius: 0.6rem;
    border: 1px solid #1e293b;
    background: #020617;
}

.cert-leaf-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cert-leaf-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
}

.cert-leaf-title {
    font-weight: 600;
    color: #e2e8f0;
    text-decoration: none;
}

.cert-leaf-title:hover {
    text-decoration: underline;
}

.cert-leaf-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #94a3b8;
}

.cert-role {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    border: 1px solid transparent;
}

.cert-role-parent {
    color: #93c5fd;
    border-color: rgba(147,197,253,0.35);
    background: rgba(59,130,246,0.12);
}

.cert-role-child {
    color: #c4b5fd;
    border-color: rgba(196,181,253,0.35);
    background: rgba(124,58,237,0.12);
}

.cert-leaf-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.cert-action-link {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.cert-action-link:hover {
    text-decoration: underline;
}

.cert-leaf-actions-float {
    position: absolute;
    top: 0.5rem;
    right: 0.7rem;
    z-index: 2;
}

@media (max-width: 900px) {
    .cert-leaf {
        flex-direction: column;
        align-items: flex-start;
    }

    .cert-branch-card .cert-leaf-toggle {
        padding-right: 1rem;
    }

    .cert-leaf-actions-float {
        position: static;
        margin-left: 1.4rem;
    }
}
