:root {
    --navy: #0d3b66;
    --navy-light: #1a5276;
    --sea: #3498db;
    --sea-light: #85c1e9;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
}

body {
    background-color: #f0f4f8;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-width: fit-content;
}

.bg-navy {
    background-color: var(--navy) !important;
}

.navbar-brand i {
    font-size: 1.3rem;
}

.nav-link {
    transition: background-color 0.2s;
    border-radius: 4px;
    margin: 0 2px;
    white-space: nowrap;
}

/* Allow navbar to wrap on wide screens with many items */
@media (min-width: 992px) {
    #navbarNav .navbar-nav {
        flex-wrap: wrap;
    }
    .nav-link {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem !important;
    }
}

.nav-link:hover, .nav-link.active {
    background-color: var(--navy-light);
}

/* Language switcher */
.lang-btn.active {
    background-color: white !important;
    color: var(--navy) !important;
    font-weight: 700;
    border-color: white !important;
}

/* Dashboard cards */
.stat-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.stat-card.bg-onboard {
    background: linear-gradient(135deg, var(--sea), var(--navy-light));
    color: white;
}

.stat-card.bg-pob-live {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.stat-card.bg-scheduled {
    background: linear-gradient(135deg, var(--warning), #e67e22);
    color: white;
}

.stat-card.bg-cabins {
    background: linear-gradient(135deg, var(--success), #1e8449);
    color: white;
}

.stat-card.bg-total {
    background: linear-gradient(135deg, #8e44ad, #6c3483);
    color: white;
}

/* Cabin grid */
.cabin-card {
    border-radius: 8px;
    border: 2px solid #dee2e6;
    transition: all 0.2s;
    cursor: pointer;
    min-height: 80px;
}

.cabin-card:hover {
    border-color: var(--sea);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.cabin-card.occupied {
    border-color: var(--warning);
    background-color: #fef9e7;
}

.cabin-card.full {
    border-color: var(--danger);
    background-color: #fdedec;
}

.cabin-card.free {
    border-color: var(--success);
    background-color: #eafaf1;
}

/* Tables */
.table-tamesis th {
    background-color: var(--navy);
    color: white;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-tamesis td {
    vertical-align: middle;
}

/* Status badges */
.badge-scheduled {
    background-color: var(--warning);
    color: #000;
}

.badge-onboard {
    background-color: var(--sea);
}

.badge-disembarked {
    background-color: #95a5a6;
}

.badge-noshow {
    background-color: #e74c3c;
}

/* Forecast bars */
.forecast-day {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: background-color 0.2s;
    cursor: pointer;
}

.forecast-day:hover {
    background-color: #eaf2f8;
}

.forecast-day.today {
    border-color: var(--sea);
    background-color: #eaf2f8;
}

.forecast-bar {
    height: 24px;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* QR Card */
.pax-card {
    border: 2px solid #333;
    border-radius: 12px;
    width: 340px;
    padding: 20px;
    background: white;
    page-break-inside: avoid;
}

.pax-card .card-ship {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--navy);
}

.pax-card .card-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.pax-card .qr-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.pax-card .qr-container img {
    width: 150px;
    height: 150px;
}

/* Muster */
.scan-result {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.scan-result.success {
    background-color: #d5f5e3;
    border-left: 4px solid var(--success);
}

.scan-result.duplicate {
    background-color: #fef9e7;
    border-left: 4px solid var(--warning);
}

.scan-result.error {
    background-color: #fdedec;
    border-left: 4px solid var(--danger);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Muster progress */
.muster-progress {
    height: 30px;
    border-radius: 15px;
    background-color: #eee;
    overflow: hidden;
}

.muster-progress .progress-bar {
    background: linear-gradient(90deg, var(--success), #2ecc71);
    transition: width 0.5s ease;
    font-weight: 600;
}

/* Deck Plan */
.deck-plan-wrapper {
    overflow-x: auto;
    padding-bottom: 10px;
}

.deck-section {
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    min-width: 700px;
}

.deck-title {
    text-align: center;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1rem;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--navy);
}

.deck-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    margin-bottom: 8px;
}

.deck-side {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.deck-side.port {
    justify-content: flex-end;
}

.deck-side.port .side-label {
    margin-right: auto;
}

.deck-side.stbd {
    justify-content: flex-start;
}

.deck-side.stbd .side-label {
    margin-left: auto;
}

.deck-cells {
    display: flex;
    gap: 3px;
}

.deck-gap {
    width: 40px;
    flex-shrink: 0;
}

.side-label {
    font-weight: 700;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--navy);
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    padding: 0 3px;
    text-align: center;
    opacity: 0.6;
}

.dp-cell {
    width: 105px;
    min-height: 58px;
    border-radius: 6px;
    border: 2px solid #dee2e6;
    padding: 3px 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dp-cell:hover {
    border-color: var(--sea);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    transform: translateY(-1px);
}

.dp-cell.dp-free {
    border-color: var(--success);
    background-color: #eafaf1;
}

.dp-cell.dp-partial {
    border-color: var(--warning);
    background-color: #fef9e7;
}

.dp-cell.dp-full {
    border-color: var(--danger);
    background-color: #fdedec;
}

.dp-cell.dp-unknown {
    border-color: #ccc;
    background-color: #f5f5f5;
    cursor: default;
}

.dp-cell.dp-unknown:hover {
    box-shadow: none;
    transform: none;
}

.dp-num {
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1.2;
}

.dp-assign {
    font-size: 0.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.2;
}

.dp-occ {
    font-size: 0.6rem;
    color: #666;
    line-height: 1;
}

/* Bed indicators in cabin plan */
.dp-beds {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 2px;
}

.dp-bed {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    text-align: center;
    line-height: 18px;
    margin: 0 1px;
}

.dp-bed.free {
    background-color: #d5f5e3;
    border: 1px solid var(--success);
    color: var(--success);
}

.dp-bed.occupied {
    background-color: var(--danger);
    border: 1px solid var(--danger);
    color: white;
}

/* Shift-based bed colors */
.dp-bed.shift-0012 {
    background-color: #2196F3;
    border: 1px solid #1976D2;
    color: white;
}

.dp-bed.shift-0618 {
    background-color: #FF9800;
    border: 1px solid #F57C00;
    color: white;
}

.dp-bed.shift-1224 {
    background-color: #9C27B0;
    border: 1px solid #7B1FA2;
    color: white;
}

.dp-bed.shift-1806 {
    background-color: #1A237E;
    border: 1px solid #0D1642;
    color: white;
}

/* Scheduled (not yet onboard) bed indicators */
.dp-bed-scheduled {
    opacity: 0.4;
    border-style: dashed !important;
    border-width: 2px !important;
}

/* Clickable bed indicators */
.dp-bed-clickable {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.dp-bed-clickable:hover {
    transform: scale(1.25);
    box-shadow: 0 0 6px rgba(52, 152, 219, 0.5);
    z-index: 1;
}

/* Clickable passenger name links */
.pax-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    cursor: pointer;
}

.pax-link:hover {
    color: var(--sea);
    border-bottom-style: solid;
}

/* Offline indicator */
.offline-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 8px;
    white-space: nowrap;
}

.offline-indicator.offline {
    background-color: var(--danger);
    color: white;
}

.offline-indicator.pending {
    background-color: var(--warning);
    color: #000;
}

.offline-indicator.syncing {
    background-color: var(--sea);
    color: white;
}

.offline-indicator .spin {
    animation: offlineSpin 1s linear infinite;
}

@keyframes offlineSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Server failover indicator */
.server-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 8px;
    white-space: nowrap;
    color: white;
}

.server-indicator.server-render {
    background-color: var(--success);
}

.server-indicator.server-local {
    background-color: var(--warning);
    color: #000;
}

.print-only { display: none !important; }
#print-frame  { display: none; }

/* Print styles */
@media print {
    @page { size: A4 portrait; margin: 10mm 12mm; }

    /* Hide the whole app UI — show only the print frame */
    .navbar, #app, #print-frame ~ * { display: none !important; }
    #print-frame { display: block !important; }

    /* Passenger cards (other print contexts) */
    .pax-card { border: 2px solid #000; margin: 10px; }
    body { background: white; }
}

/* Scanner overlay */
#scanner-container {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

/* Tablet: bigger scanner area */
@media (min-width: 900px) and (hover: none) and (pointer: coarse) {
    #scanner-container {
        max-width: 520px;
    }
}

#scanner-container video {
    width: 100%;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-card .stat-value {
        font-size: 1.8rem;
    }
    .pax-card {
        width: 100%;
        max-width: 340px;
    }

    /* Cabin plan mobile: stack PORT / STBD vertically */
    .deck-section {
        min-width: unset;
        padding: 10px 6px;
    }

    .deck-row {
        flex-direction: column;
        gap: 4px;
    }

    .deck-gap {
        display: none;
    }

    .deck-side {
        flex-direction: row;
        justify-content: flex-start !important;
        gap: 2px;
    }

    .deck-side.port {
        justify-content: flex-start !important;
    }

    .deck-cells {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
    }

    .side-label {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 0.6rem;
        padding: 2px 4px;
        min-width: 32px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--navy);
        color: white;
        border-radius: 3px;
        opacity: 1;
        align-self: stretch;
    }

    .dp-cell {
        width: 62px;
        min-height: 50px;
        padding: 2px 3px;
    }

    .dp-num {
        font-size: 0.6rem;
    }

    .dp-assign {
        font-size: 0.5rem;
    }

    .dp-occ {
        font-size: 0.5rem;
    }

    .dp-bed {
        width: 14px;
        height: 14px;
        font-size: 0.5rem;
        line-height: 14px;
    }

    .dp-beds {
        gap: 1px;
    }
}

/* ---- Muster Checker Simplified UI ---- */
body.muster-checker-mode #mainNav { display: none !important; }
body.muster-checker-mode #app { padding: 8px !important; }

.muster-checker-ui {
    padding-bottom: 80px; /* space for FAB */
}

.muster-compact-header {
    background: linear-gradient(135deg, #198754, #157347);
    color: white;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.muster-compact-header .muster-counts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 1.1rem;
}

.muster-station-counts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    text-align: center;
    font-size: 1rem;
}

.muster-compact-header .muster-count-big {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.muster-count-total {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.7;
}

.muster-compact-header .muster-progress {
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.3);
    margin-top: 8px;
    overflow: hidden;
}

.muster-compact-header .muster-progress-bar {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.muster-checker-ui #qr-reader {
    max-width: 100% !important;
    width: 100% !important;
}

.muster-checker-ui #qr-reader video {
    width: 100% !important;
    border-radius: 10px;
}

.muster-back-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1050;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.muster-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1050;
    transition: transform 0.2s;
}

.muster-fab:active {
    transform: scale(0.9);
}

.muster-fab.fab-list {
    background: #0d6efd;
}

.muster-fab.fab-scan {
    background: #198754;
}

.muster-fab.fab-start {
    background: #fd7e14;
}

/* Scan flash overlay */
.scan-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: flashIn 0.15s ease-out;
    pointer-events: none;
}

.scan-flash.fade-out {
    animation: flashOut 0.4s ease-in forwards;
}

.scan-flash.success {
    background: rgba(25, 135, 84, 0.92);
}

.scan-flash.warning {
    background: rgba(255, 193, 7, 0.92);
}

.scan-flash.error {
    background: rgba(220, 53, 69, 0.92);
}

.scan-flash .flash-icon {
    font-size: 4rem;
    color: white;
    margin-bottom: 12px;
}

.scan-flash.warning .flash-icon,
.scan-flash.warning .flash-text {
    color: #333;
}

.scan-flash .flash-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-align: center;
    padding: 0 20px;
}

.scan-flash .flash-subtext {
    font-size: 1rem;
    color: rgba(255,255,255,0.85);
    margin-top: 4px;
}

.scan-flash.warning .flash-subtext {
    color: rgba(0,0,0,0.6);
}

@keyframes flashIn {
    from { opacity: 0; transform: scale(1.05); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes flashOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- Gangway / Kiosk mode global styles ---- */
body.gangway-mode #mainNav { display: none !important; }
body.gangway-mode #app { padding: 8px !important; }
body.gangway-mode {
    background: linear-gradient(160deg, #0d1b2a 0%, #1b2838 40%, #0f2537 100%);
    min-height: 100vh;
    /* Disable pull-to-refresh on Chrome Android */
    overscroll-behavior-y: contain;
}

/* Disable pull-to-refresh and swipe-back in all kiosk modes */
body.gangway-mode,
body.muster-checker-mode {
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom;
}

/* ---- Kiosk Theme Toggle Button ---- */
.kiosk-theme-btn {
    font-size: 0.85rem !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    min-height: auto !important;
}
body.gangway-mode .kiosk-theme-btn {
    color: rgba(255,255,255,0.7) !important;
    border-color: rgba(255,255,255,0.3) !important;
    background: rgba(255,255,255,0.08) !important;
}
body.gangway-mode .kiosk-theme-btn:hover {
    color: white !important;
    background: rgba(255,255,255,0.15) !important;
}

/* ---- Kiosk Light Mode ---- */
body.gangway-mode.kiosk-light {
    background: linear-gradient(160deg, #e8edf2 0%, #f0f4f8 40%, #dfe6ed 100%);
    color: #1a2a3a;
}
body.kiosk-light .kiosk-theme-btn {
    color: #0d3b66 !important;
    border-color: rgba(13, 59, 102, 0.35) !important;
    background: rgba(13, 59, 102, 0.08) !important;
}
body.kiosk-light .kiosk-theme-btn:hover {
    background: rgba(13, 59, 102, 0.15) !important;
}
body.kiosk-light .kiosk-brand-title {
    color: #0d3b66;
    text-shadow: none;
}
body.kiosk-light .kiosk-brand-sub {
    color: rgba(13, 59, 102, 0.5);
}
body.kiosk-light .kiosk-brand-line {
    background: linear-gradient(90deg, transparent, #1a759f, transparent);
}
body.kiosk-light .kiosk-back-btn {
    color: #0d3b66 !important;
    border-color: rgba(13, 59, 102, 0.3) !important;
    background: transparent !important;
}
body.kiosk-light .kiosk-text-label,
body.kiosk-light label,
body.kiosk-light h4,
body.kiosk-light h5,
body.kiosk-light h6 {
    color: #1a2a3a !important;
}
body.kiosk-light .kiosk-text-muted,
body.kiosk-light small,
body.kiosk-light .text-muted {
    color: rgba(26, 42, 58, 0.6) !important;
}
/* Force ALL text inside gangway mode to dark in light theme */
body.kiosk-light,
body.kiosk-light * {
    color: #1a2a3a;
}
body.kiosk-light .gw-session-header {
    background: linear-gradient(135deg, #e2e8f0, #f0f4f8) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
    border: 1px solid rgba(13, 59, 102, 0.12);
}
body.kiosk-light .gw-session-header,
body.kiosk-light .gw-session-header h4,
body.kiosk-light .gw-session-header i {
    color: #0d3b66 !important;
}
body.kiosk-light .gw-session-header small {
    color: rgba(13, 59, 102, 0.6) !important;
}
/* Preserve colored badges and buttons */
body.kiosk-light .badge.bg-success { color: white !important; }
body.kiosk-light .badge.bg-danger { color: white !important; }
body.kiosk-light .badge.bg-warning { color: #333 !important; }
body.kiosk-light .badge.bg-primary { color: white !important; }
body.kiosk-light .badge.bg-info { color: white !important; }
body.kiosk-light .btn-danger,
body.kiosk-light .btn-success,
body.kiosk-light .btn-primary,
body.kiosk-light .btn-warning { color: white !important; }
body.kiosk-light .text-success { color: #198754 !important; }
body.kiosk-light .text-danger { color: #dc3545 !important; }
body.kiosk-light .text-warning { color: #ffc107 !important; }
body.kiosk-light .text-primary { color: #0d6efd !important; }
body.kiosk-light .card {
    background: white;
    border-color: rgba(13, 59, 102, 0.15);
    color: #1a2a3a;
}
body.kiosk-light .card-header {
    background: #f0f4f8 !important;
    color: #0d3b66 !important;
    border-color: rgba(13, 59, 102, 0.12) !important;
}
body.kiosk-light .gw-scan-list-tablet {
    background: rgba(255, 255, 255, 0.9);
}
/* Scan rows in list */
body.kiosk-light .gw-scan-row,
body.kiosk-light .gw-scan-list-tablet .d-flex {
    background: rgba(13, 59, 102, 0.03) !important;
    border-color: rgba(13, 59, 102, 0.08) !important;
    color: #1a2a3a !important;
}
body.kiosk-light .gw-scan-list-tablet span,
body.kiosk-light .gw-scan-list-tablet .flex-grow-1 {
    color: #1a2a3a !important;
}
/* Crew boat buttons */
body.kiosk-light .gw-boat-btn {
    background: white !important;
    color: #0d3b66 !important;
    border-color: #1a759f !important;
}
body.kiosk-light .gw-boat-btn:hover,
body.kiosk-light .gw-boat-btn:active {
    background: #1a759f !important;
    color: white !important;
}
/* Counter cards */
body.kiosk-light .gw-counter-card {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(13, 59, 102, 0.15) !important;
    border-radius: 12px;
}
/* Generic overrides for white-on-white */
body.kiosk-light .text-white {
    color: #1a2a3a !important;
}
body.kiosk-light .btn-outline-light {
    color: #0d3b66 !important;
    border-color: rgba(13, 59, 102, 0.3) !important;
}
body.kiosk-light .btn-outline-light:hover {
    background: rgba(13, 59, 102, 0.1) !important;
    color: #0d3b66 !important;
}
body.kiosk-light .btn-light {
    color: #0d3b66 !important;
}
body.kiosk-light .gw-scanner-card {
    background: white;
}
/* Today's closed session cards */
body.kiosk-light .gw-session-card {
    background: rgba(13, 59, 102, 0.05) !important;
    border-color: rgba(13, 59, 102, 0.15) !important;
    color: #1a2a3a !important;
}
body.kiosk-light .gw-session-card strong {
    color: #0d3b66 !important;
}
body.kiosk-light .gw-session-card small {
    color: rgba(13, 59, 102, 0.6) !important;
}
/* Session closed/open cards */
body.kiosk-light .gw-start-boat-selection span,
body.kiosk-light .gw-start-boat-selection div {
    color: #1a2a3a !important;
}
/* Visitor badge overlay / form */
body.kiosk-light #gwScanOverlay .card {
    background: white !important;
    color: #1a2a3a !important;
}
body.kiosk-light #gwScanOverlay .card-body {
    color: #1a2a3a !important;
}
body.kiosk-light #gwScanOverlay label,
body.kiosk-light #gwScanOverlay input,
body.kiosk-light #gwScanOverlay .form-control {
    color: #1a2a3a !important;
    background: white !important;
    border-color: rgba(13, 59, 102, 0.2) !important;
}
/* On-screen keyboard light mode */
body.kiosk-light #kioskKeyboard {
    background: rgba(240, 244, 248, 0.98) !important;
    border-left-color: rgba(13, 59, 102, 0.15) !important;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1) !important;
}
body.kiosk-light .kiosk-kb-header {
    border-bottom-color: rgba(13, 59, 102, 0.1) !important;
}
body.kiosk-light .kiosk-kb-preview {
    color: #0d3b66 !important;
}
body.kiosk-light .kiosk-kb-close {
    background: rgba(13, 59, 102, 0.08) !important;
    border-color: rgba(13, 59, 102, 0.2) !important;
    color: #0d3b66 !important;
}
body.kiosk-light .kiosk-kb-key {
    background: rgba(13, 59, 102, 0.08) !important;
    color: #0d3b66 !important;
    border: 1px solid rgba(13, 59, 102, 0.1);
}
body.kiosk-light .kiosk-kb-key:active {
    background: rgba(26, 117, 159, 0.3) !important;
}
body.kiosk-light .kiosk-kb-key.key-done {
    background: rgba(25, 135, 84, 0.15) !important;
    color: #198754 !important;
}
/* Footer / action buttons */
/* Scan overlay body (default dark) */
.gw-overlay-body {
    background: rgba(13,27,42,0.97);
}
.gw-overlay-text {
    color: #ffffff;
}
/* T-card search card (default dark) */
.gw-tcard-search-card {
    background: rgba(255,193,7,0.1) !important;
    border: 1px solid rgba(255,193,7,0.3) !important;
}
.gw-tcard-search-header {
    background: rgba(255,193,7,0.15) !important;
    border-bottom: 1px solid rgba(255,193,7,0.2) !important;
    color: #ffc107 !important;
}
.gw-tcard-input {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.2) !important;
    color: #fff !important;
}
/* LIGHT MODE: overlay, t-card search, badge form, misc */
body.kiosk-light .gw-overlay-body {
    background: rgba(255,255,255,0.97) !important;
}
body.kiosk-light .gw-overlay-text {
    color: #0d3b66 !important;
}
body.kiosk-light #gwScanOverlay .card-body,
body.kiosk-light #gwScanOverlay {
    color: #1a2a3a !important;
}
body.kiosk-light #gwAutoMsg,
body.kiosk-light #gwAutoMsg * {
    color: #1a2a3a !important;
}
body.kiosk-light #gwManualBtns .btn-success { color: white !important; }
body.kiosk-light #gwManualBtns .btn-danger { color: white !important; }
/* T-card search light */
body.kiosk-light .gw-tcard-search-card {
    background: rgba(255,193,7,0.08) !important;
    border-color: rgba(255,193,7,0.3) !important;
}
body.kiosk-light .gw-tcard-search-header {
    background: rgba(255,193,7,0.12) !important;
    color: #856404 !important;
}
body.kiosk-light .gw-tcard-input {
    background: white !important;
    border-color: rgba(13, 59, 102, 0.2) !important;
    color: #1a2a3a !important;
}
/* T-card results light */
body.kiosk-light .gw-tcard-result {
    background: rgba(13, 59, 102, 0.04) !important;
    border-color: rgba(13, 59, 102, 0.1) !important;
    color: #1a2a3a !important;
}
body.kiosk-light .gw-tcard-result strong {
    color: #0d3b66 !important;
}
/* Badge form light */
body.kiosk-light #gwBadgeForm .form-control {
    background: white !important;
    border-color: rgba(13, 59, 102, 0.3) !important;
    color: #1a2a3a !important;
}
body.kiosk-light #gwBadgeForm .form-control::placeholder {
    color: rgba(13, 59, 102, 0.45) !important;
}
body.kiosk-light #gwBadgeForm .form-control:focus {
    background: white !important;
    border-color: var(--sea) !important;
    color: #1a2a3a !important;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.25);
}
body.kiosk-light #gwBadgeForm label {
    color: #1a2a3a !important;
}
/* Kiosk text classes light */
body.kiosk-light .kiosk-text-white {
    color: #0d3b66 !important;
}
body.kiosk-light .kiosk-text-muted {
    color: rgba(13, 59, 102, 0.5) !important;
}
/* Lost T-card button light */
body.kiosk-light .gw-lost-tcard-btn {
    background: rgba(255,193,7,0.08) !important;
    border-color: rgba(255,193,7,0.4) !important;
    color: #856404 !important;
}
/* Logout button light */
body.kiosk-light .kiosk-logout-btn {
    border-color: rgba(13, 59, 102, 0.25) !important;
    color: rgba(13, 59, 102, 0.5) !important;
}
/* Footer / action buttons */
body.kiosk-light .gw-tablet-footer .btn {
    color: #0d3b66;
    border-color: rgba(13, 59, 102, 0.3);
}
body.kiosk-light .gw-tablet-footer .btn-danger {
    color: white !important;
}
/* PIN pad light mode */
body.kiosk-light .kiosk-pin-card {
    background: white !important;
    border-color: rgba(13, 59, 102, 0.2) !important;
}
body.kiosk-light .kiosk-pin-header {
    background: #0d3b66 !important;
}
body.kiosk-light .kiosk-pin-body {
    background: white !important;
}
body.kiosk-light .kiosk-pin-display {
    color: #0d3b66 !important;
    border-color: rgba(13, 59, 102, 0.2) !important;
    background: #f0f4f8 !important;
}
body.kiosk-light .kiosk-pin-grid .btn {
    color: #0d3b66 !important;
    border-color: rgba(13, 59, 102, 0.2) !important;
    background: white !important;
}
body.kiosk-light .kiosk-pin-grid .btn:active {
    background: #1a759f !important;
    color: white !important;
}
body.kiosk-light .kiosk-pin-grid .btn-success {
    background: #198754 !important;
    color: white !important;
    border-color: #198754 !important;
}

/* Company suggestion dropdown light mode */
body.kiosk-light .list-group-item-action {
    color: #1a2a3a !important;
    background: #fff !important;
    border-color: rgba(13, 59, 102, 0.15) !important;
}
body.kiosk-light .list-group-item-action:hover,
body.kiosk-light .list-group-item-action:focus {
    background: #e9ecef !important;
    color: #0d3b66 !important;
}
/* Seaman card light mode */
body.kiosk-light .seaman-card {
    background: white !important;
    border: 1px solid rgba(13, 59, 102, 0.15) !important;
    color: #0d3b66 !important;
}
body.kiosk-light .seaman-card:hover {
    background: #f0f4f8 !important;
}
body.kiosk-light .seaman-card-name {
    color: #0d3b66 !important;
}
body.kiosk-light .seaman-card-role {
    color: rgba(13, 59, 102, 0.6) !important;
}
/* Boat menu buttons light mode */
body.kiosk-light .boat-menu-btn {
    background: white !important;
    color: #0d3b66 !important;
    border: 1px solid rgba(13, 59, 102, 0.15) !important;
}
body.kiosk-light .boat-menu-btn:hover {
    background: #f0f4f8 !important;
}

/* ---- Kiosk branding header ---- */
.kiosk-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.kiosk-brand-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(52, 152, 219, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.kiosk-brand-title i {
    font-size: 1.8rem;
    color: var(--sea-light);
}

.kiosk-brand-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 4px;
}

.kiosk-brand-line {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--sea), transparent);
    margin: 12px auto 0;
    border-radius: 2px;
}

/* PIN screen */
.letter-spacing-2 { letter-spacing: 0.4em; }
.letter-spacing-3 { letter-spacing: 0.5em; }

/* Gangway scan overlay animation */
#gwScanOverlay {
    animation: slideIn 0.2s ease;
}

/* QR Scanner container in gangway */
#gangway-qr-reader {
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
}

#gangway-qr-reader video {
    width: 100% !important;
    border-radius: 12px;
}

/* ---- Seaman selection grid ---- */
.seaman-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.seaman-card {
    padding: 20px 16px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, box-shadow 0.25s;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.seaman-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.2s;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2), transparent 70%);
    pointer-events: none;
}

.seaman-card:active {
    transform: scale(0.96);
}

.seaman-card:active::before {
    opacity: 1;
}

.seaman-card-able_seaman {
    background: linear-gradient(145deg, rgba(13,59,102,0.85), rgba(26,82,118,0.9));
    border-color: rgba(52, 152, 219, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.seaman-card-muster {
    background: linear-gradient(145deg, rgba(25,135,84,0.75), rgba(21,115,71,0.85));
    border-color: rgba(39,174,96,0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.seaman-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.4rem;
    color: rgba(255,255,255,0.9);
}

.seaman-card-name {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 4px;
    color: #ffffff;
}

.seaman-card-role {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.6);
}

/* ---- PIN pad kiosk styling ---- */
.kiosk-pin-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.kiosk-pin-header {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.kiosk-pin-header .pin-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.8rem;
    color: white;
}

.kiosk-pin-header h5 {
    color: white;
    margin: 0;
    font-weight: 600;
}

.kiosk-pin-body {
    padding: 24px;
}

.kiosk-pin-display {
    font-size: 2.2rem;
    font-family: 'Segoe UI', monospace;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5em;
    margin-bottom: 20px;
    text-align: center;
}

.kiosk-pin-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 280px;
    margin: 0 auto;
}

.kiosk-pin-grid .btn {
    min-height: 60px;
    font-size: 1.4rem;
    font-weight: 600;
    border-radius: 12px;
    transition: transform 0.1s, background 0.15s;
}

.kiosk-pin-grid .btn:active {
    transform: scale(0.92);
}

.kiosk-pin-grid .btn-outline-light {
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
}

.kiosk-pin-grid .btn-outline-light:active,
.kiosk-pin-grid .btn-outline-light:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.kiosk-pin-grid .btn-success {
    background: linear-gradient(135deg, #198754, #157347);
    border: none;
}

/* ---- Boat landing menu buttons ---- */
.boat-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    min-height: 140px;
    color: white;
    border: none;
    transition: transform 0.15s, box-shadow 0.25s;
    position: relative;
    overflow: hidden;
}

.boat-menu-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.boat-menu-btn:hover {
    color: white;
}

.boat-menu-btn:active {
    transform: scale(0.97);
}

.boat-menu-muster {
    background: linear-gradient(145deg, #198754, #0f5132);
    box-shadow: 0 6px 24px rgba(25, 135, 84, 0.35);
}

.boat-menu-boatlanding {
    background: linear-gradient(145deg, #0d6efd, #0843a0);
    box-shadow: 0 6px 24px rgba(13, 110, 253, 0.35);
}

.boat-menu-isps {
    background: linear-gradient(145deg, #dc3545, #8b1a25);
    box-shadow: 0 6px 24px rgba(220, 53, 69, 0.35);
}

.boat-menu-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 1.8rem;
}

/* ---- Gangway start page ---- */
.gw-start-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 16px;
}

.gw-start-boat-selection {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.gw-start-boat-selection label {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gw-boat-btn {
    background: rgba(255,255,255,0.08) !important;
    border: 2px solid rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.85) !important;
    border-radius: 14px !important;
    transition: all 0.2s !important;
}

.gw-boat-btn:hover,
.gw-boat-btn:focus {
    background: rgba(255,255,255,0.12) !important;
    border-color: rgba(255,255,255,0.3) !important;
    color: #fff !important;
}

.gw-boat-btn.btn-primary {
    background: linear-gradient(135deg, var(--navy), var(--navy-light)) !important;
    border-color: var(--sea) !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(13, 110, 253, 0.35);
}

.gw-start-btn {
    background: linear-gradient(135deg, #198754, #0f5132) !important;
    border: none !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 20px rgba(25, 135, 84, 0.4);
    transition: transform 0.15s, box-shadow 0.15s !important;
}

.gw-start-btn:active {
    transform: scale(0.98);
}

.gw-start-btn:hover {
    background: linear-gradient(135deg, #1a9d60, #116937) !important;
}

/* Today's sessions in kiosk */
.gw-session-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    color: rgba(255,255,255,0.8);
}

.gw-session-card strong {
    color: #fff;
}

.gw-session-card small {
    color: rgba(255,255,255,0.5) !important;
}

/* ---- Active session professional styling ---- */
.gw-session-header {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    border-radius: 16px;
    padding: 16px 20px;
    color: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.gw-session-header h4 {
    color: #fff;
    margin: 0;
}

.gw-session-header small {
    color: rgba(255,255,255,0.6) !important;
}

.gw-counter-card {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 14px;
    min-width: 90px;
}

.gw-counter-card .card-body {
    padding: 12px 16px !important;
}

.gw-scanner-card {
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 16px !important;
    overflow: hidden;
}

.gw-tablet-right {
    color: rgba(255,255,255,0.85);
}

.gw-tablet-right h6 {
    color: rgba(255,255,255,0.7);
}

.gw-scan-list-tablet .list-group-item,
.gw-scan-list-tablet .d-flex.align-items-center {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.85);
}

.gw-close-session-btn {
    background: linear-gradient(135deg, #dc3545, #8b1a25) !important;
    border: none !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 16px rgba(220,53,69,0.3);
}

.gw-lost-tcard-btn {
    background: rgba(255,193,7,0.1) !important;
    border-color: rgba(255,193,7,0.4) !important;
    color: #ffc107 !important;
    border-radius: 12px !important;
}

.gw-lost-tcard-btn:hover,
.gw-lost-tcard-btn:active {
    background: rgba(255,193,7,0.2) !important;
}

/* Kiosk back button */
.kiosk-back-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    border-radius: 10px;
    transition: all 0.15s;
}

.kiosk-back-btn:hover,
.kiosk-back-btn:active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

/* Kiosk logout button */
.kiosk-logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.5);
    border-radius: 10px;
}

.kiosk-logout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.3);
}

/* Scan row in dark kiosk */
.gw-scan-row {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    margin-bottom: 5px;
    color: rgba(255,255,255,0.85);
    transition: background 0.15s;
}

.gw-scan-row:last-child {
    margin-bottom: 0;
}

.gw-scan-row .text-muted,
.gw-scan-row small {
    color: rgba(255,255,255,0.45) !important;
}

/* T-card search results in dark kiosk */
.gw-tcard-result {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    margin-bottom: 5px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    transition: background 0.15s;
}

.gw-tcard-result:active,
.gw-tcard-result:hover {
    background: rgba(255,255,255,0.12);
}

.gw-tcard-result strong {
    color: #fff;
}

/* Badge form inputs in dark overlay */
#gwBadgeForm .form-control {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}

#gwBadgeForm .form-control::placeholder {
    color: rgba(255,255,255,0.4);
}

#gwBadgeForm .form-control:focus {
    background: rgba(255,255,255,0.15);
    border-color: var(--sea);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.25);
}

/* Kiosk text colors */
.kiosk-text-muted { color: rgba(255,255,255,0.5) !important; }
.kiosk-text-label { color: rgba(255,255,255,0.7); }
.kiosk-text-white { color: #ffffff; }

/* ---- Live crew boat movement indicator ---- */
.live-pulse {
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- T-card lost badge ---- */
.badge-no-tcard {
    font-size: 0.7rem;
}

/* ---- Unnamed badge visitor highlight ---- */
.gw-unnamed-highlight {
    background-color: rgba(220, 53, 69, 0.15) !important;
    border-left: 3px solid #dc3545 !important;
}

.gw-unnamed-badge {
    opacity: 0.6;
}

/* ---- Closed session cards ---- */
.session-closed-card:hover {
    background-color: rgba(0, 0, 0, 0.03);
}
.session-chevron {
    transition: transform 0.2s;
    font-size: 0.8rem;
}

/* =====================================================================
   TABLET OPTIMIZATION — Samsung Galaxy Tab A9+ (11", 1920×1200)
   Targets landscape tablets (min 900px width, touch, coarse pointer)
   ===================================================================== */

/* Detect tablet: landscape with touch + coarse pointer (not mouse) */
@media (min-width: 900px) and (max-width: 1400px) and (hover: none) and (pointer: coarse) {
    /* ── Global touch-friendly defaults ── */
    body {
        font-size: 1.05rem;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    /* Bigger touch targets everywhere */
    .btn {
        min-height: 52px;
        font-size: 1.05rem;
        padding: 0.6rem 1.2rem;
    }

    .btn-sm {
        min-height: 42px;
        font-size: 0.95rem;
        padding: 0.45rem 0.9rem;
    }

    .btn-lg {
        min-height: 64px;
        font-size: 1.2rem;
        padding: 0.8rem 1.6rem;
    }

    /* Form controls */
    .form-control, .form-select {
        min-height: 52px;
        font-size: 1.05rem;
        padding: 0.6rem 0.9rem;
    }

    /* ── Gangway mode — optimized 2-column landscape layout ── */
    body.gangway-mode #app {
        padding: 12px 20px !important;
    }

    /* Crew boat selection buttons — bigger on tablet */
    .gw-boat-btn {
        min-height: 72px !important;
        font-size: 1.15rem !important;
        border-radius: 14px !important;
    }

    /* Gangway session — 2-column layout on tablet landscape */
    .gw-tablet-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 16px;
        height: calc(100vh - 24px);
        max-width: 100%;
        margin: 0;
    }

    .gw-tablet-header {
        grid-column: 1 / -1;
    }

    .gw-tablet-left {
        display: flex;
        flex-direction: column;
        gap: 12px;
        min-height: 0;
        overflow: hidden;
    }

    .gw-tablet-right {
        display: flex;
        flex-direction: column;
        gap: 12px;
        min-height: 0;
        overflow: hidden;
    }

    .gw-tablet-footer {
        grid-column: 1 / -1;
    }

    /* Counters on tablet — side by side, bigger */
    .gw-counter-card .card-body {
        padding: 1rem !important;
    }

    .gw-counter-value {
        font-size: 3.5rem !important;
        line-height: 1;
    }

    .gw-counter-label {
        font-size: 1.1rem;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-weight: 700;
    }

    /* QR scanner — fill left column */
    .gw-scanner-card {
        flex: 1;
        min-height: 0;
    }

    .gw-scanner-card .card-body {
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 8px !important;
    }

    #gangway-qr-reader {
        flex: 1;
        max-width: 100%;
        border-radius: 12px;
        overflow: hidden;
    }

    /* Scan overlay — bigger text on tablet */
    #gwScanOverlay .fw-bold {
        font-size: 2rem !important;
    }

    #gwScanOverlay .btn-lg {
        min-width: 160px !important;
        min-height: 72px !important;
        font-size: 1.3rem !important;
        border-radius: 14px !important;
    }

    /* Scan history — scrollable right column */
    .gw-scan-list-tablet {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: none !important;
    }

    .gw-scan-list-tablet .d-flex.align-items-center {
        min-height: 52px;
        padding: 8px 12px !important;
    }

    /* Lost T-card button */
    .gw-lost-tcard-btn {
        min-height: 52px !important;
        font-size: 1rem;
    }

    /* Close session button */
    .gw-close-session-btn {
        min-height: 64px !important;
        font-size: 1.15rem !important;
    }

    /* Seaman card avatar icon bigger on tablet */
    .seaman-card-icon {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }

    /* PIN pad bigger on tablet */
    .kiosk-pin-card { width: 400px !important; }
    .kiosk-pin-grid { max-width: 320px; }
    .kiosk-pin-grid .btn { min-height: 68px; font-size: 1.5rem; }
    .kiosk-pin-display { font-size: 2.8rem !important; }

    /* Boat menu icon bigger */
    .boat-menu-icon {
        width: 72px;
        height: 72px;
        font-size: 2rem;
    }

    /* ── Muster checker — tablet optimized ── */
    body.muster-checker-mode #app {
        padding: 12px 20px !important;
    }

    .muster-compact-header {
        padding: 16px 24px;
        border-radius: 14px;
    }

    .muster-compact-header .muster-counts {
        font-size: 1.3rem;
        gap: 24px;
    }

    .muster-compact-header .muster-count-big {
        font-size: 2.8rem;
    }

    .muster-station-counts {
        font-size: 1.15rem;
        gap: 8px;
    }

    /* Bigger muster FAB */
    .muster-fab {
        width: 76px;
        height: 76px;
        font-size: 2rem;
        bottom: 28px;
        right: 28px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    }

    .muster-back-btn {
        min-height: 48px;
        font-size: 1rem;
    }

    /* Scan flash on tablet — bigger text */
    .scan-flash .flash-icon {
        font-size: 6rem;
    }

    .scan-flash .flash-text {
        font-size: 2.2rem;
    }

    .scan-flash .flash-subtext {
        font-size: 1.3rem;
    }

    /* Scan results list — bigger rows */
    .scan-result {
        padding: 14px 16px;
        margin-bottom: 10px;
        font-size: 1.05rem;
    }

    /* ── Boat menu — bigger cards on tablet ── */
    .boat-menu-btn {
        min-height: 180px;
        border-radius: 20px;
        font-size: 1.1rem;
    }

    .boat-menu-btn i {
        font-size: 3rem !important;
    }

    /* Seaman selection grid — bigger cards */
    .seaman-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .seaman-card {
        padding: 24px 16px;
        border-radius: 16px;
        border-width: 3px;
    }

    .seaman-card-name {
        font-size: 1.3rem;
    }

    .seaman-card-role {
        font-size: 0.85rem;
    }

    /* ── Kiosk on-screen keyboard (right half overlay) ── */
    #kioskKeyboard {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 50%;
        z-index: 1050;
        background: rgba(13, 27, 42, 0.98);
        border-left: 2px solid rgba(52, 152, 219, 0.3);
        flex-direction: column;
        justify-content: center;
        padding: 10px 14px;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
    }

    #kioskKeyboard.active {
        display: flex;
    }

    .kiosk-kb-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 4px 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 10px;
    }

    .kiosk-kb-preview {
        flex: 1;
        font-size: 1.1rem;
        color: rgba(255, 255, 255, 0.7);
        font-family: 'Segoe UI', monospace;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding-right: 12px;
    }

    .kiosk-kb-close {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 10px;
        color: rgba(255, 255, 255, 0.6);
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .kiosk-kb-close:active {
        background: rgba(255, 255, 255, 0.15);
    }

    .kiosk-kb-rows {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .kiosk-kb-row {
        display: flex;
        gap: 5px;
        justify-content: center;
    }

    .kiosk-kb-key {
        flex: 1;
        max-width: 56px;
        min-height: 48px;
        border: none;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        font-size: 1.05rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.1s;
        cursor: pointer;
        user-select: none;
    }

    .kiosk-kb-key:active {
        background: rgba(52, 152, 219, 0.5);
    }

    .kiosk-kb-key.key-wide {
        flex: 1.5;
        max-width: 80px;
        font-size: 1rem;
    }

    .kiosk-kb-key.key-space {
        flex: 5;
        max-width: none;
    }

    .kiosk-kb-key.key-done {
        background: rgba(39, 174, 96, 0.3);
        color: #27ae60;
        flex: 2;
        max-width: 100px;
        font-weight: 700;
    }

    .kiosk-kb-key.key-done:active {
        background: rgba(39, 174, 96, 0.5);
    }

    .kiosk-kb-key.key-shift {
        background: rgba(255, 255, 255, 0.06);
        font-size: 1.2rem;
    }

    .kiosk-kb-key.key-shift.active {
        background: rgba(52, 152, 219, 0.3);
        color: var(--sea-light);
    }

    .kiosk-kb-key.key-backspace {
        font-size: 1.2rem;
    }

    /* When keyboard is active, keep overlay content left-aligned */
    body.kiosk-kb-active #gwScanOverlay .card-body {
        align-items: flex-start !important;
        padding-left: 16px !important;
    }

}

/* Also target portrait tablet (1200px height → ~800px width portrait) */
@media (min-width: 700px) and (max-width: 899px) and (hover: none) and (pointer: coarse) {
    body {
        font-size: 1.02rem;
        -webkit-tap-highlight-color: transparent;
    }

    .btn {
        min-height: 50px;
        font-size: 1rem;
    }

    .btn-lg {
        min-height: 60px;
        font-size: 1.15rem;
    }

    .form-control, .form-select {
        min-height: 50px;
        font-size: 1rem;
    }

    /* Crew boat buttons */
    .gw-boat-btn {
        min-height: 68px !important;
        font-size: 1.1rem !important;
        border-radius: 12px !important;
    }

    /* Gangway counters bigger */
    .gw-counter-value {
        font-size: 3rem !important;
    }

    /* Bigger scanner overlay buttons */
    #gwScanOverlay .btn-lg {
        min-width: 140px !important;
        min-height: 64px !important;
        font-size: 1.2rem !important;
    }

    /* Boat menu buttons */
    .boat-menu-btn {
        min-height: 160px;
        border-radius: 18px;
    }

    .seaman-card {
        padding: 20px 14px;
        border-radius: 14px;
    }

    .seaman-card-name {
        font-size: 1.2rem;
    }

    /* Muster */
    .muster-fab {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }

    .scan-flash .flash-icon {
        font-size: 5rem;
    }

    .scan-flash .flash-text {
        font-size: 1.8rem;
    }

    /* ── ISPS Tablet ── */
    /* Date navigation: bigger buttons and input */
    .isps-nav-btn {
        min-height: 56px !important;
        min-width: 56px !important;
        font-size: 1.1rem !important;
        padding: 0.5rem 1rem !important;
    }
    .isps-date-input {
        min-height: 56px !important;
        font-size: 1.15rem !important;
        text-align: center;
        min-width: 160px !important;
    }
    /* Register table: larger rows for touch */
    .isps-register th {
        font-size: 1.05rem;
        padding: 12px 16px !important;
    }
    .isps-register td {
        font-size: 1.05rem;
        padding: 10px 16px !important;
        min-height: 48px;
    }
    .isps-register .badge {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    /* Badge grid: bigger cards */
    .isps-badge-grid .col {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
    .isps-badge-grid .card {
        min-height: 120px;
    }
    .isps-badge-grid .card-body {
        padding: 12px !important;
    }
    .isps-badge-grid .fw-bold {
        font-size: 1.1rem;
    }
    .isps-badge-grid img {
        max-width: 90px !important;
        max-height: 90px !important;
    }
}
