:root{--gold:#d9b884}
body[data-theme=night]{--navy:#071927;--ink:#f5f5ed;--muted:#b4c5c8;--line:#35505c;--bg:#071927;--teal:#78c5c4;--red:#ffa6a6;background:radial-gradient(ellipse at top right,#15394a,#071927 60%) fixed;color:var(--ink)}
body[data-theme=night] .card,body[data-theme=night] .stat,body[data-theme=night] article,body[data-theme=night] .login-card,body[data-theme=night] dialog{background:#0b2433;color:var(--ink);border-color:var(--line)}
body[data-theme=night] button,body[data-theme=night] input,body[data-theme=night] select,body[data-theme=night] textarea{background:#102d3d;color:var(--ink);border-color:#46606a}
body[data-theme=night] button:hover{background:#204658}
body[data-theme=night] .primary{background:var(--gold);color:#092230;border-color:var(--gold)}
body[data-theme=night] th,body[data-theme=night] .note,body[data-theme=night] .quote,body[data-theme=night] .step b,body[data-theme=night] .calendar-day,body[data-theme=night] .calendar-cell{background:#122e3e;color:var(--ink)}
body[data-theme=night] .muted,body[data-theme=night] small,body[data-theme=night] .eyebrow{color:#b4c5c8}
body[data-theme=night] .badge{color:#102c37}
body[data-theme=night] .nav-group,body[data-theme=night] .nav-section summary{color:#d9b884}
body[data-theme=night] .empty,body[data-theme=night] #message{background:#153a46;color:#f5f5ed}
body[data-theme=night] .calendar-event,body[data-theme=night] .cal-event{color:#102c37}
aside{background:linear-gradient(180deg,#071927,#0d2938);border-right:1px solid #314752}
.brand{color:#d9b884;letter-spacing:5px}.vessel{background:#102c3b;border-color:#36505a}
nav button.active{background:#28424b;box-shadow:inset 3px 0 #d9b884;color:#f9e9ce}
.product-hero{min-height:300px;padding:42px;border:1px solid #5b5a4b;border-radius:15px;display:flex;align-items:end;position:relative;overflow:hidden;background:linear-gradient(90deg,#071927 0%,#071927 48%,rgba(7,25,39,.15) 80%),url('/vessel-hero.png') center 48%/cover;color:#f8f2e8;margin-bottom:20px}
.product-hero h2{font:42px Georgia,serif;color:#e5c89e;margin:12px 0}.product-hero p{font-size:16px}.product-hero .eyebrow{color:#cfbb99}.product-hero button{background:#0b2939cc;color:#f6eee1;border-color:#b6a180}
.product-shortcuts{display:flex;gap:9px;flex-wrap:wrap;margin-bottom:24px}.product-setup{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.product-setup article{padding:22px;border:1px solid var(--line);border-radius:12px}
#bookletForm textarea{min-height:350px}#liveDock{position:fixed;right:24px;bottom:20px;width:min(430px,calc(100vw - 30px));z-index:50;box-shadow:0 12px 70px #0008;border-color:#b79d71}#liveDock h2{color:#c6a878}#liveTranscript{max-height:210px;overflow:auto;white-space:pre-wrap;font-size:12px}#liveStatus{padding:10px 0;color:var(--teal)}#mapDisplay iframe{width:100%;height:420px;border:0;margin-top:20px}#productUserRows{margin-top:22px}#productUserRows td button{padding:6px;margin:3px;font-size:11px}
.ag-card{background:var(--bg);border:1px solid var(--line);padding:22px;border-radius:12px;margin-bottom:18px}.ag-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.ag-card label{display:block;margin-top:12px}.ag-card input,.ag-card textarea,.ag-card select{width:100%;padding:9px;margin:5px 0}.ag-card textarea{min-height:80px}.ag-card article{border-bottom:1px solid var(--line);padding:10px}
@media(max-width:1000px){.product-setup{grid-template-columns:repeat(2,1fr)}.ag-grid{grid-template-columns:1fr}}
@media(max-width:700px){.product-hero{min-height:240px;padding:24px}.product-hero h2{font-size:32px}.product-setup{grid-template-columns:1fr}#liveDock{right:15px;bottom:10px}}
@media print{aside,header,#liveDock,.product-shortcuts{display:none!important}#app{display:block}body{background:white!important;color:black!important}.card{break-inside:avoid}}

.v19-spec-grid,.v19-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.v19-group,.detail-tile{padding:15px;border:1px solid var(--line);border-radius:8px;margin:10px 0}.detail-tile small,.detail-tile strong{display:block}.v19-actions{display:flex;gap:10px;flex-wrap:wrap;margin:15px 0}#v19Image{max-width:100%;max-height:320px;border-radius:12px}.v19-entry{display:grid;padding:10px 0;border-bottom:1px solid var(--line)}.v19-editor{padding-top:15px}.v19-editor label{display:grid;gap:6px}.v19-editor input{width:100%;min-width:0;padding:9px}.v19-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.v19-muted{color:var(--muted)}@media(max-width:700px){.v19-spec-grid,.v19-form-grid,.v19-row{grid-template-columns:1fr}}

body[data-theme=night] label{color:#c5d3d6}.v19-entry-edit{padding:15px 0;border-bottom:1px solid var(--line)}

/* Restored legacy petrol Day and Bridge Night. */
body[data-theme=day]{--navy:#071927;--ink:#f5f5ed;--muted:#b4c5c8;--line:#35505c;--bg:#071927;--teal:#78c5c4;--red:#ffa6a6;background:radial-gradient(ellipse at top right,#15394a,#071927 60%) fixed;color:var(--ink)}
body[data-theme=day] .card,body[data-theme=day] .stat,body[data-theme=day] article,body[data-theme=day] .login-card,body[data-theme=day] dialog{background:#0b2433;color:var(--ink);border-color:var(--line)}
body[data-theme=day] button,body[data-theme=day] input,body[data-theme=day] select,body[data-theme=day] textarea{background:#102d3d;color:var(--ink);border-color:#46606a}
body[data-theme=day] button:hover{background:#204658}
body[data-theme=day] .primary{background:var(--gold);color:#092230;border-color:var(--gold)}
body[data-theme=day] th,body[data-theme=day] .note,body[data-theme=day] .quote,body[data-theme=day] .step b,body[data-theme=day] .calendar-day,body[data-theme=day] .calendar-cell{background:#122e3e;color:var(--ink)}
body[data-theme=day] .muted,body[data-theme=day] small,body[data-theme=day] .eyebrow{color:#b4c5c8}
body[data-theme=day] .badge{color:#102c37}
body[data-theme=day] .nav-group,body[data-theme=day] .nav-section summary{color:#d9b884}
body[data-theme=day] .empty,body[data-theme=day] #message{background:#153a46;color:#f5f5ed}
body[data-theme=day] .calendar-event,body[data-theme=day] .cal-event{color:#102c37}


body[data-theme=night]{--navy:#050709;--bg:#050709;--ink:#b7a9a0;--muted:#95867c;--line:#392820;--gold:#ba845c;--teal:#958578;--red:#cc9690;background:#050709;color:var(--ink)}
body[data-theme=night] aside{background:#07090c;color:#b2a39a;border-right-color:#28201d}
body[data-theme=night] .brand{color:#c0a999}
body[data-theme=night] .vessel{background:#111215;border-color:#322720}
body[data-theme=night] nav button{color:#a39388}
body[data-theme=night] nav button.active{background:linear-gradient(90deg,#211910,#171310);color:#c9b0a0;border-color:#473328;box-shadow:inset 3px 0 #98694a}
body[data-theme=night] .card,body[data-theme=night] .stat,body[data-theme=night] article,body[data-theme=night] dialog,body[data-theme=night] .login-card,body[data-theme=night] #assistantHub{background:#0d0f12;border-color:#392820;color:#b8aaa0;box-shadow:none}
body[data-theme=night] button,body[data-theme=night] input,body[data-theme=night] select,body[data-theme=night] textarea{background:#111317;color:#c0ada0;border-color:#534032}
body[data-theme=night] button:hover{background:#211910}
body[data-theme=night] .primary{background:#6e482e;color:#ead0b7;border-color:#8f6243}
body[data-theme=night] th,body[data-theme=night] .note,body[data-theme=night] .quote,body[data-theme=night] .calendar-day,body[data-theme=night] .calendar-cell{background:#121316;color:#b4a399}
body[data-theme=night] label,body[data-theme=night] small,body[data-theme=night] .eyebrow,body[data-theme=night] .muted{color:#ad9c92}
body[data-theme=night] .empty,body[data-theme=night] #message{background:#171411;color:#c1afa3}
body[data-theme=night] .product-hero{background-image:linear-gradient(90deg,rgba(0,0,0,.92),rgba(0,0,0,.78)),url('/vessel-hero.png');border-color:#403025}
body[data-theme=night] .product-hero h2,body[data-theme=night] #liveDock h2{color:#ae7956}
body[data-theme=night] #hubBar{background:#111317;border-color:#4d372a}
body[data-theme=night] #hubBar button{background:#171719;color:#b69c8b;border-color:#493429}
body[data-theme=night] #hubBar input{color:#c1afa3}
body[data-theme=day] #assistantHub{background:#0b2433;color:#f5f5ed}
#languageChoice select,#loginLanguageChoice select{width:auto;min-width:95px;padding:8px;border-radius:8px}
body[data-theme=night] input::placeholder,body[data-theme=night] textarea::placeholder{color:#887a71}

.ais-map{height:440px;position:relative;overflow:hidden;background:#dcebef;border:1px solid var(--line);border-radius:10px;margin-top:18px;touch-action:none;isolation:isolate}
.ais-tiles,.ais-markers{position:absolute;inset:0}.ais-tiles img{position:absolute;width:256px;height:256px;max-width:none;user-select:none}
.ais-markers{pointer-events:none}.ais-target{pointer-events:auto;position:absolute;transform:translate(-50%,-50%);width:30px;height:30px;padding:0!important;border:2px solid #fff!important;background:#0b705e!important;color:#fff!important;border-radius:50%;box-shadow:0 1px 5px #0008;z-index:2}
.ais-target span{display:block;font-size:17px}.ais-own{background:#163f9f!important;z-index:3}.ais-stale{background:#95620b!important;border-style:dashed!important}
.ais-map-controls{position:absolute;left:10px;top:10px;display:flex;gap:5px;z-index:5}.ais-map-controls button{min-width:36px;background:#fff!important;color:#173b48!important}
.ais-attribution{position:absolute;bottom:0;right:0;background:#fffffff0;color:#173b48;font-size:11px;padding:4px 7px;z-index:5}
.ais-map-details{position:absolute;right:10px;top:10px;max-width:280px;max-height:350px;overflow:auto;padding:18px;background:#fff;color:#153340;border:1px solid #668791;border-radius:8px;z-index:6;box-shadow:0 4px 20px #0004}
.ais-map-details p{font-size:12px;margin:8px 0;overflow-wrap:anywhere}.ais-map-details>button{float:right;padding:3px 7px;background:#edf3f4!important;color:#153340!important}
.ais-map-status{font-size:12px;color:var(--muted)}

.ais-unknown{background:#596873!important;border-style:dotted!important}

.ais-own{z-index:1}.ais-cluster{z-index:3;min-width:34px;height:34px;background:#304b66!important;font-weight:700}.ais-map-details button{color:#153340!important;background:#edf3f4!important}

/* Both application palettes use dark form surfaces; keep labels and hints readable. */
body[data-theme=day] label,body[data-theme=day] legend{color:#c5d3d6}
body[data-theme=night] legend{color:#ad9c92}
body[data-theme=day] input::placeholder,body[data-theme=day] textarea::placeholder{color:#b4c5c8;opacity:1}
body[data-theme=night] input::placeholder,body[data-theme=night] textarea::placeholder{color:#ad9c92;opacity:1}

/* Mobile presentation only. Desktop layout and existing palette are retained. */
.aethra-mobile-menu-toggle{display:none}
@media screen and (max-width:750px){
 #app{min-width:0;max-width:100%}
 #app>aside{height:auto;position:relative;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;overflow:visible}
 #app>aside .brand{flex:1;min-width:0;font-size:23px}
 #app>aside .brand span{font-size:8px;letter-spacing:1.3px}
 #app>aside .aethra-mobile-menu-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;min-width:84px;padding:8px 12px;background:transparent;color:inherit;border:1px solid currentColor;flex:0 0 auto}
 #app>aside #nav{display:none;flex:0 0 100%;width:100%;max-height:65vh;overflow-y:auto;overflow-x:hidden;gap:6px}
 #app>aside[data-mobile-menu-open="true"] #nav{display:block}
 #app>aside #nav button{width:100%;min-height:44px;white-space:normal;text-align:left;align-items:center}
 #app>aside .nav-section>summary{min-height:44px;display:block;padding:13px 10px}
 #app>aside .vessel{display:none;flex:0 0 100%;width:100%;padding:12px}
 #app>aside[data-mobile-menu-open="true"] .vessel{display:grid}
 #app>aside .side-bottom{display:none;flex:0 0 100%;width:100%;margin:0}
 #app>aside[data-mobile-menu-open="true"] .side-bottom{display:grid}
 main{width:100%;min-width:0;padding:18px 12px calc(100px + env(safe-area-inset-bottom,0px));overflow-wrap:anywhere}
 header{display:flex;flex-direction:column;align-items:stretch;gap:12px;margin-bottom:18px}
 header>div{min-width:0}
 .head-actions{width:100%;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:8px}
 .head-actions button,.head-actions select{min-height:44px}
 #languageChoice{flex:1 1 110px;max-width:150px;min-width:100px}
 #aethraUILanguage{width:100%;font-size:16px}
 #globalCommand{flex:1 1 150px;justify-content:center}
 .head-actions #mainAction{flex:1 1 150px}
 .columns,.form-grid,.v19-spec-grid,.v19-form-grid,.product-setup{grid-template-columns:minmax(0,1fr)}
 .columns>*{min-width:0}
 .stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .stat{min-width:0;padding:14px}
 .stat strong{font-size:30px}
 .card{min-width:0;max-width:100%;padding:16px}
 .card-head{flex-wrap:wrap;align-items:flex-start;gap:10px}
 .card-head>div{min-width:0}
 .actions>button,.quick-actions>button{min-height:44px;white-space:normal;flex:1 1 130px}
 input,select,textarea{font-size:16px;min-width:0;max-width:100%}
 input:not([type=checkbox]):not([type=radio]),select{min-height:44px}
 .toolbar{width:100%;gap:8px}
 .toolbar input{min-width:0;flex:1 1 100%}
 .toolbar select{flex:1 1 130px}
 .table-scroll{width:100%;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 .table-scroll table{min-width:520px}
 .table-scroll td button{min-height:40px}
 .calendar-card{overflow:visible}
 .calendar-card .operations-calendar{min-width:0;width:100%;gap:3px}
 .calendar-card .operations-day{min-width:0;min-height:70px;padding:3px}
 .calendar-card .event{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .calendar-filters{grid-template-columns:minmax(0,1fr)}
 .calendar-card .actions>button{flex:1 1 70px}
 .calendar-foot{flex-wrap:wrap}
 dialog{width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);padding:16px;margin:auto;overflow-y:auto}
 .dialog-head{align-items:flex-start;gap:10px}
 .dialog-head button{min-height:44px;min-width:44px;flex-shrink:0}
 .form-actions{flex-wrap:wrap;gap:8px}
 .form-actions>button{min-height:44px;flex:1 1 120px}
 body #hubBar{left:10px;right:10px;bottom:calc(8px + env(safe-area-inset-bottom,0px));max-width:none;width:auto;gap:5px;padding:7px}
 body #hubBar input{font-size:16px;padding:8px 4px}
 body #hubBar button{min-width:40px;min-height:44px;padding:8px}
 body #assistantHub{left:8px;right:8px;top:8px;width:auto;max-width:none;bottom:calc(82px + env(safe-area-inset-bottom,0px));padding:14px}
 .hub-tools button{min-height:40px}
 .login-card{width:calc(100% - 24px);max-width:440px;padding:24px}
}

.notification-bell-host{position:relative;flex:0 0 auto}
.notification-bell{position:relative;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:9px}
.notification-bell-count{position:absolute;top:-5px;right:-5px;display:inline-flex;min-width:19px;height:19px;padding:0 4px;border-radius:10px;background:var(--red);color:#fff;font-size:10px;line-height:19px;justify-content:center;font-weight:700}
.notification-panel{position:fixed;z-index:48;top:88px;right:20px;width:min(420px,calc(100vw - 24px));max-height:calc(100vh - 110px);max-height:calc(100dvh - 110px);overflow-y:auto;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:12px;padding:16px;box-shadow:0 12px 40px #0004}
.notification-panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.notification-panel-head h2{margin:0}
.notification-panel-head button{min-height:40px;min-width:40px}
.notification-panel-list{display:grid;gap:8px;margin:12px 0}
.notification-panel-item{display:grid;gap:5px;text-align:left;width:100%;min-height:52px;white-space:normal;overflow-wrap:anywhere}
.notification-panel-item small{color:var(--muted)}
.notification-panel>button{width:100%;min-height:44px}
@media screen and (max-width:750px){.notification-panel{top:80px;left:10px;right:10px;width:auto;max-height:calc(100dvh - 170px)}.head-actions .notification-bell-host{flex:0 0 44px}}
@media print{.notification-bell-host,.notification-panel{display:none!important}}

.crew-chat{max-width:1100px;margin-inline:auto}
.crew-chat-feed{display:grid;gap:14px;max-height:56vh;overflow-y:auto;padding:8px 4px;margin:14px 0;overscroll-behavior:contain}
.crew-chat-message{padding:14px;border:1px solid var(--line);border-radius:10px;background:var(--bg);min-width:0}
.crew-chat-message-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
.crew-chat-message-head time{color:var(--muted);font-size:11px}
.crew-chat-body{white-space:pre-wrap;overflow-wrap:anywhere}
.crew-chat-attachment{padding:12px;margin-top:10px;border:1px solid var(--line);border-radius:8px;overflow-wrap:anywhere}
.crew-chat-attachment>small{display:block;color:var(--muted)}
.crew-chat-selected{display:grid;gap:6px;overflow-wrap:anywhere}
#crewChatForm{display:grid;gap:14px;border-top:1px solid var(--line);padding-top:16px}
.crew-chat-photo{display:block;max-width:100%;max-height:70vh;object-fit:contain;margin:auto}
.crew-chat-unread{margin-left:auto;padding:1px 7px;background:var(--navy);color:inherit;border:1px solid var(--line);border-radius:10px;font-size:11px}
@media screen and (max-width:750px){.crew-chat-message-head{flex-wrap:wrap;gap:4px}.crew-chat-feed{max-height:48vh}.crew-chat-message{padding:12px}.crew-chat-attachment .actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.crew-chat-attachment button{padding:8px;min-height:44px}}
