:root{
  --ink:#102A3B;
  --ocean:#1F5C7A;
  --amber:#D9822B;
  --amber-dark:#B5661C;
  --paper:#F6F2EA;
  --surface:#FFFFFF;
  --mist:#8A95A1;
  --mist-light:#D9D2C2;
  --success:#4F7A5C;
  --alert:#B5443A;
  --line:#E2DCCC;
}
*{box-sizing:border-box;}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:'Inter',sans-serif;
  -webkit-font-smoothing:antialiased;
}
.label{
  font-family:'Oswald',sans-serif;
  text-transform:uppercase;
  letter-spacing:0.08em;
  font-weight:600;
  color:var(--ink);
}
.mono{font-family:'IBM Plex Mono',monospace;}

/* HEADER */
header.app-header{
  background:var(--ink);
  color:#fff;
  padding:16px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.brand{display:flex; align-items:baseline; gap:10px;}
.brand .label{font-size:22px; color:#fff; letter-spacing:0.12em;}
.brand .sub{font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--mist-light); letter-spacing:0.04em;}
.btn{
  border:none;
  border-radius:3px;
  padding:9px 16px;
  font-family:'Inter',sans-serif;
  font-weight:600;
  font-size:13.5px;
  cursor:pointer;
  transition:transform .08s ease, opacity .15s ease;
}
.btn:active{transform:translateY(1px);}
.btn-amber{background:var(--amber); color:#fff;}
.btn-amber:hover{background:var(--amber-dark);}
.btn-outline{background:transparent; border:1px solid var(--mist); color:var(--mist);}
.btn-outline:hover{border-color:var(--ink); color:var(--ink);}
.btn-outline-light{background:transparent; border:1px solid rgba(255,255,255,.4); color:#fff;}
.btn-outline-light:hover{border-color:#fff;}
.btn-danger{background:transparent; border:1px solid var(--alert); color:var(--alert);}
.btn-danger:hover{background:var(--alert); color:#fff;}
.btn-sm{padding:6px 10px; font-size:12px;}

/* LAYOUT */
.layout{
  display:grid;
  grid-template-columns:300px 1fr;
  gap:0;
  min-height:calc(100vh - 64px);
}
@media (max-width:860px){
  .layout{grid-template-columns:1fr;}
}

/* SIDEBAR */
.sidebar{
  background:#EFE9DC;
  border-right:1px solid var(--line);
  padding:18px;
}
.sidebar input[type=text]{
  width:100%;
  padding:9px 10px;
  border:1px solid var(--line);
  border-radius:3px;
  font-family:'IBM Plex Mono',monospace;
  font-size:12.5px;
  margin-bottom:14px;
  background:#fff;
}
.ship-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-left:4px solid var(--mist-light);
  border-radius:3px;
  padding:11px 12px;
  margin-bottom:10px;
  cursor:pointer;
  transition:border-color .12s ease;
}
.ship-card:hover{border-left-color:var(--amber);}
.ship-card.active{border-left-color:var(--amber); box-shadow:0 1px 4px rgba(16,42,59,0.12);}
.ship-card .resi{font-size:11px; color:var(--mist); margin-bottom:4px;}
.ship-card .vessel{font-weight:700; font-size:14px; margin-bottom:2px;}
.ship-card .route{font-size:12px; color:var(--ocean); margin-bottom:6px;}
.pill{
  display:inline-block;
  font-size:10.5px;
  font-family:'Inter',sans-serif;
  font-weight:600;
  padding:2px 8px;
  border-radius:20px;
  color:#fff;
  letter-spacing:0.02em;
}
.sidebar-empty{color:var(--mist); font-size:13px; text-align:center; padding:30px 10px;}
.sidebar-footer{margin-top:14px; text-align:center;}
.sidebar-footer button{font-size:11px; color:var(--mist); background:none; border:none; cursor:pointer; text-decoration:underline;}

/* MAIN */
.main{padding:26px 32px; max-width:880px;}
.empty-state{
  text-align:center;
  padding:80px 20px;
  color:var(--mist);
}
.empty-state .label{font-size:18px; color:var(--ink); display:block; margin-bottom:8px;}

/* RESI STAMP */
.ticket{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:6px;
  padding:22px 24px;
  display:flex;
  align-items:center;
  gap:22px;
  margin-bottom:6px;
  position:relative;
}
.stamp{
  width:118px; height:118px;
  min-width:118px;
  border-radius:50%;
  border:3px solid var(--amber);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  transform:rotate(-7deg);
  position:relative;
  color:var(--amber-dark);
}
.stamp::before{
  content:'';
  position:absolute; inset:7px;
  border:1px dashed var(--amber);
  border-radius:50%;
}
.stamp .stamp-label{font-family:'Oswald',sans-serif; font-size:9px; letter-spacing:0.15em; text-transform:uppercase; margin-bottom:3px;}
.stamp .stamp-code{font-family:'IBM Plex Mono',monospace; font-size:11px; font-weight:600; text-align:center; line-height:1.3; padding:0 8px;}
.ticket-info{flex:1; min-width:0;}
.ticket-info .vessel-line{font-size:19px; font-weight:700; margin-bottom:3px;}
.ticket-info .route-line{font-family:'IBM Plex Mono',monospace; font-size:13px; color:var(--ocean); margin-bottom:8px;}
.perforation{
  border-top:2px dashed var(--mist-light);
  margin:0 0 22px 0;
  position:relative;
}
.perforation::before, .perforation::after{
  content:'';
  position:absolute; top:-9px;
  width:18px; height:18px;
  background:var(--paper);
  border-radius:50%;
}
.perforation::before{left:-32px;}
.perforation::after{right:-32px;}

/* SECTIONS */
.section{margin-bottom:26px;}
.section-title{font-size:13px; margin-bottom:12px; display:flex; align-items:center; justify-content:space-between;}
.card{background:var(--surface); border:1px solid var(--line); border-radius:6px; padding:18px 20px;}
.field-grid{display:grid; grid-template-columns:1fr 1fr; gap:14px;}
@media (max-width:600px){.field-grid{grid-template-columns:1fr;}}
.field{display:flex; flex-direction:column; gap:5px;}
.field label{font-size:11.5px; color:var(--mist); font-weight:600; text-transform:uppercase; letter-spacing:0.04em;}
.field input, .field select{
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:3px;
  font-family:'Inter',sans-serif;
  font-size:13.5px;
  color:var(--ink);
  background:#fff;
}
.field input.mono{font-family:'IBM Plex Mono',monospace;}
.field-actions{margin-top:16px; display:flex; justify-content:flex-end; gap:10px;}

table{width:100%; border-collapse:collapse; font-size:13.5px;}
th{
  text-align:left;
  font-family:'Oswald',sans-serif;
  font-size:11px; letter-spacing:0.06em; text-transform:uppercase;
  color:var(--mist);
  padding:0 8px 8px 8px;
  border-bottom:1px solid var(--line);
}
td{padding:8px; border-bottom:1px solid var(--line); vertical-align:middle;}
td input{width:100%; border:1px solid transparent; background:transparent; padding:5px 6px; border-radius:3px; font-size:13.5px; font-family:'Inter',sans-serif;}
td input:hover, td input:focus{border-color:var(--line); background:#fafafa;}
td.num{font-family:'IBM Plex Mono',monospace;}
.add-row{display:flex; gap:8px; margin-top:12px; flex-wrap:wrap;}
.add-row input{
  border:1px solid var(--line); border-radius:3px; padding:8px 10px; font-size:13.5px;
}
.add-row .i-name{flex:2; min-width:140px;}
.add-row .i-qty{width:80px;}
.add-row .i-weight{width:110px;}
.weight-total{margin-top:10px; text-align:right; font-size:12.5px; color:var(--mist);}
.weight-total b{color:var(--ink); font-family:'IBM Plex Mono',monospace;}

.timeline{list-style:none; margin:0; padding:0;}
.timeline li{
  display:flex; gap:14px;
  padding:10px 0;
  border-bottom:1px solid var(--line);
}
.timeline li:last-child{border-bottom:none;}
.timeline .dot{width:8px; height:8px; border-radius:50%; background:var(--amber); margin-top:6px; flex-shrink:0;}
.timeline .ts{font-family:'IBM Plex Mono',monospace; font-size:11.5px; color:var(--mist); min-width:128px;}
.timeline .txt{font-size:13.5px;}
.note-row{display:flex; gap:8px; margin-top:14px;}
.note-row input{flex:1; border:1px solid var(--line); border-radius:3px; padding:8px 10px; font-size:13.5px;}

/* MODAL */
.overlay{
  position:fixed; inset:0; background:rgba(16,42,59,0.55);
  display:flex; align-items:center; justify-content:center;
  padding:20px; z-index:50;
}
.modal{
  background:var(--surface); border-radius:8px; padding:26px 28px;
  width:100%; max-width:520px; max-height:88vh; overflow-y:auto;
}
.modal h2{font-family:'Oswald',sans-serif; text-transform:uppercase; letter-spacing:0.06em; font-size:18px; margin:0 0 16px 0;}
.hidden{display:none !important;}
.toast{
  position:fixed; bottom:20px; left:50%; transform:translateX(-50%);
  background:var(--ink); color:#fff; padding:10px 18px; border-radius:4px;
  font-size:13px; z-index:60; opacity:0; transition:opacity .25s ease;
}
.toast.show{opacity:1;}
.loading-msg{padding:40px; text-align:center; color:var(--mist);}

/* LOGIN PAGE */
.login-body{
  display:flex; align-items:center; justify-content:center;
  min-height:100vh; background:var(--ink);
}
.login-card{
  background:var(--paper);
  border-radius:8px;
  padding:36px 34px;
  width:100%; max-width:380px;
  text-align:center;
}
.login-card form{text-align:left;}
.login-sub{font-size:11px; color:var(--mist); letter-spacing:0.06em; margin:-14px 0 22px 0;}
.login-error{
  background:#FBE7E4; color:var(--alert); border:1px solid var(--alert);
  border-radius:4px; padding:8px 12px; font-size:12.5px; margin-bottom:14px; text-align:left;
}
