:root{
  --navy:#0f2540; --navy-2:#1c3b63; --gold:#c8a24a;
  --bg:#f3f5f8; --card:#fff; --line:#e3e7ee; --text:#1c2430; --muted:#6b7688;
  --ok:#1f8a4c; --ok-bg:#e7f6ec; --warn:#b97a12; --warn-bg:#fdf3e0; --danger:#c0392b; --danger-bg:#fdeceb;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{margin:0; height:100%; overscroll-behavior-y:contain;}
body{
  background:var(--bg); color:var(--text); font-size:16px; line-height:1.55;
  font-family:-apple-system,"SF Arabic","Segoe UI",Tahoma,sans-serif;
  padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px);
  -webkit-user-select:none; user-select:none;
}
input{-webkit-user-select:text; user-select:text;}
a{color:inherit;}
button,input,select{font-family:inherit; font-size:16px;}
.hidden{display:none !important;}
.muted{color:var(--muted); font-size:13.5px;}
.mono{font-family:ui-monospace,Menlo,Consolas,monospace; direction:ltr; unicode-bidi:embed;}

#topbar{
  background:var(--navy); color:#fff; padding:14px 16px; padding-top:calc(14px + env(safe-area-inset-top,0px));
  display:flex; align-items:center; gap:10px; position:sticky; top:0; z-index:10;
}
#topbar img{height:30px;}
#topbar .who{flex:1;}
#topbar .who b{display:block; font-size:14.5px;}
#topbar .who span{font-size:11.5px; color:#a9b8cf;}
#topbar button{background:rgba(255,255,255,.12); color:#fff; border:none; border-radius:8px; padding:8px 10px; font-size:13px;}
#topbar button[data-action="toggle-lang"]{font-weight:800; min-width:36px;}

main{padding:14px; max-width:520px; margin:0 auto; padding-bottom:90px;}
.card{background:var(--card); border:1px solid var(--line); border-radius:14px; padding:16px; margin-bottom:12px;}
label{display:block; font-size:13px; font-weight:700; color:var(--muted); margin-bottom:6px;}
input{width:100%; padding:13px 12px; border:1px solid var(--line); border-radius:10px; background:#fbfcfe; margin-bottom:12px;}
input:focus{outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(200,162,74,.18);}
.btn{
  display:block; width:100%; background:var(--navy); color:#fff; border:none; border-radius:12px;
  padding:15px; font-size:16px; font-weight:800; cursor:pointer; text-align:center;
}
.btn.gold{background:var(--gold); color:var(--navy);}
.btn.ghost{background:#eef1f6; color:var(--navy);}
.btn.danger{background:var(--danger-bg); color:var(--danger);}
.btn.ok{background:var(--ok-bg); color:var(--ok);}
.btn.sm{padding:10px; font-size:14px;}
.btn:disabled{opacity:.5;}
.row{display:flex; gap:8px;}
.row .btn{flex:1;}

.badge{display:inline-block; padding:3px 11px; border-radius:20px; font-size:12.5px; font-weight:700;}
.badge.blue{background:#eaf2fb; color:#1f5fa8;}
.badge.gold{background:var(--warn-bg); color:var(--warn);}
.badge.orange{background:#fdeadb; color:#b45d0e;}
.badge.green{background:var(--ok-bg); color:var(--ok);}
.badge.red{background:var(--danger-bg); color:var(--danger);}
.badge.gray{background:#eceff4; color:#5b6678;}

.stats{display:flex; gap:10px; margin-bottom:14px;}
.stat{flex:1; background:#fff; border:1px solid var(--line); border-radius:12px; padding:12px; text-align:center;}
.stat .num{font-size:24px; font-weight:800; color:var(--navy);}
.stat .lbl{font-size:12px; color:var(--muted); margin-top:2px;}

.ship-card{background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px; margin-bottom:10px; cursor:pointer;}
.ship-card .top{display:flex; align-items:center; gap:8px; margin-bottom:8px;}
.ship-card .ref{font-weight:800; font-family:ui-monospace,monospace; direction:ltr; display:inline-block;}
.ship-card .spacer{flex:1;}
.ship-card .dest{font-size:15px; font-weight:700; margin-bottom:2px;}
.ship-card .addr{font-size:13.5px; color:var(--muted);}
.ship-card .cod{margin-top:8px; background:var(--warn-bg); color:#7a4f0a; border-radius:8px; padding:6px 10px; font-size:13.5px; font-weight:700; display:inline-block;}

.empty{padding:50px 16px; text-align:center; color:var(--muted);}
.empty .big{font-size:44px; display:block; margin-bottom:10px;}

.detail-section{margin-bottom:16px;}
.detail-section h4{margin:0 0 8px; font-size:13.5px; color:var(--muted); font-weight:800;}
.kv{display:grid; grid-template-columns:auto 1fr; gap:6px 10px; font-size:14.5px;}
.kv dt{color:var(--muted);} .kv dd{margin:0; font-weight:600;}
.call-row{display:flex; align-items:center; gap:10px; background:#fbfcfe; border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin-bottom:8px;}
.call-row .txt{flex:1;}
.call-row a.callbtn{background:var(--ok-bg); color:var(--ok); border-radius:50%; width:38px; height:38px; display:flex; align-items:center; justify-content:center; font-size:18px; text-decoration:none; flex-shrink:0;}
.mapbtn{display:flex; align-items:center; gap:8px; background:#eaf2fb; color:#1f5fa8; border-radius:10px; padding:10px 12px; margin-bottom:8px; text-decoration:none; font-weight:700; font-size:14px;}

.timeline{list-style:none; margin:0; padding-inline-end:16px; border-inline-end:2px solid var(--line);}
.timeline li{position:relative; padding-bottom:14px;}
.timeline li:last-child{padding-bottom:0;}
.timeline li::before{content:""; position:absolute; inset-inline-end:-21px; top:4px; width:10px; height:10px; border-radius:50%; background:var(--gold); border:2px solid #fff; box-shadow:0 0 0 2px var(--gold);}
.timeline .t{font-weight:700; font-size:14px;} .timeline .m{font-size:12px; color:var(--muted);}

.action-bar{position:fixed; bottom:0; inset-inline:0; background:#fff; border-top:1px solid var(--line); padding:10px 14px calc(10px + env(safe-area-inset-bottom,0px)); z-index:15;}
.action-bar-inner{max-width:520px; margin:0 auto;}
.steps-row{display:flex; gap:6px; margin-bottom:8px;}
.steps-row .btn{font-size:12.5px; padding:9px 4px;}

#toast{position:fixed; bottom:calc(100px + env(safe-area-inset-bottom,0px)); left:50%; transform:translateX(-50%) translateY(20px); background:var(--navy); color:#fff; padding:11px 20px; border-radius:11px; z-index:200; opacity:0; transition:.25s; max-width:90%; text-align:center;}
#toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
#toast.err{background:var(--danger);} #toast.ok{background:var(--ok);}

.overlay{position:fixed; inset:0; background:rgba(12,22,40,.55); z-index:100; display:flex; align-items:flex-end; justify-content:center;}
.sheet{background:#fff; border-radius:18px 18px 0 0; width:100%; max-width:520px; padding:18px 16px calc(18px + env(safe-area-inset-bottom,0px)); max-height:85vh; overflow-y:auto;}
.sheet h3{margin:0 0 12px; font-size:17px; color:var(--navy);}
textarea{width:100%; padding:12px; border:1px solid var(--line); border-radius:10px; min-height:80px; font-family:inherit; font-size:15px;}

.spinner{width:34px; height:34px; border:3px solid var(--line); border-top-color:var(--gold); border-radius:50%; animation:spin .8s linear infinite; margin:40px auto;}
@keyframes spin{to{transform:rotate(360deg);}}

.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; background:linear-gradient(160deg,var(--navy),var(--navy-2));}
.login-card{background:#fff; border-radius:20px; padding:28px 22px; width:100%; max-width:380px;}
.login-card .logo{text-align:center; margin-bottom:14px;} .login-card .logo img{height:50px;}
.login-card h1{font-size:18px; text-align:center; margin:0 0 4px; color:var(--navy);}
.login-card p.sub{text-align:center; margin:0 0 20px; color:var(--muted); font-size:13.5px;}
.pin-input{letter-spacing:8px; text-align:center; font-size:22px; font-weight:800; direction:ltr;}

select{width:100%; padding:13px 12px; border:1px solid var(--line); border-radius:10px; background:#fbfcfe; margin-bottom:12px; font-size:16px;}
.rsec{font-size:14.5px; color:var(--navy); margin:18px 0 10px; padding-bottom:6px; border-bottom:2px solid var(--gold);}
.two{display:grid; grid-template-columns:1fr 1fr; gap:10px;}
.filebtn{display:block; text-align:center; padding:14px; border:2px dashed var(--line); border-radius:12px; margin-bottom:14px; cursor:pointer; color:var(--navy); font-weight:700;}
.filebtn.done{border-color:#2e9e5b; color:#2e9e5b; background:#eefaf2;}
.chk{display:flex; gap:10px; align-items:flex-start; font-weight:400; line-height:1.6; margin:14px 0;} .chk input{width:auto; margin:4px 0 0;}
