*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Arial,sans-serif;
  background:#f4f6f8;
  color:#17202a;
}

.topbar{
  background:#fff;
  border-bottom:1px solid #ddd;
  padding:14px 5%;
  display:flex;
  justify-content:space-between;
  align-items:center;
  position:sticky;
  top:0;
  z-index:10;
}

.topbar span{
  display:block;
  font-size:12px;
  color:#68737d;
  margin-top:3px;
}

.container{
  max-width:1050px;
  margin:22px auto;
  padding:0 16px;
}

.page-title{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  margin-bottom:16px;
}

.page-title h1{
  margin:0 0 5px;
  font-size:24px;
}

.page-title p{
  margin:0;
  color:#68737d;
  font-size:13px;
}

.cno{
  background:#fff;
  border:1px solid #ddd;
  border-radius:10px;
  padding:12px 16px;
}

.card{
  background:#fff;
  border:1px solid #ddd;
  border-radius:10px;
  padding:18px;
  margin:14px 0;
}

.card h2{
  font-size:17px;
  margin:0 0 15px;
  border-bottom:1px solid #eee;
  padding-bottom:9px;
}

.grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

label{
  font-size:13px;
  font-weight:600;
  display:block;
}

input,
select,
textarea{
  width:100%;
  margin-top:6px;
  padding:11px;
  border:1px solid #cbd2d8;
  border-radius:7px;
  background:#fff;
  font:inherit;
  font-weight:400;
}

textarea{
  min-height:75px;
  resize:vertical;
}

.choices{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-bottom:14px;
}

.choices label{
  font-weight:400;
}

.choices input{
  width:auto;
  margin-right:6px;
}

.actions{
  display:flex;
  gap:10px;
  margin:18px 0;
}

.actions button,
.topbar button{
  border:0;
  border-radius:7px;
  padding:12px 18px;
  background:#1f2937;
  color:#fff;
  cursor:pointer;
}

.secondary{
  background:#e9edf0!important;
  color:#17202a!important;
}

.status{
  min-height:20px;
  color:#1c6b3c;
}

.record{
  border:1px solid #e0e4e8;
  border-radius:8px;
  padding:12px;
  margin:8px 0;
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
}

.record small{
  display:block;
  color:#68737d;
}

.record button{
  padding:7px 10px;
  border:1px solid #bbb;
  background:#fff;
  border-radius:6px;
}


/* =====================================================
   KWL PRINT FORM - VERSION 3
   ===================================================== */

#printSheet{
  display:none;
}

.print-page{
  width:202mm;
  height:289mm;
  margin:0 auto;
  font-family:Arial,sans-serif;
  color:#111;
  font-size:8pt;
  overflow:hidden;
}


/* HEADER */

.kwl-head{
  display:grid;
  grid-template-columns:27mm 1fr 25mm;
  gap:3mm;
  align-items:start;
  border-bottom:1.5px solid #111;
  padding-bottom:2mm;
}

.kwl-company{
  line-height:1.2;
  text-align:center;
}

.company-name{
  font-size:16pt;
  font-weight:800;
  color:#1687c9;
}

.cno-print{
  font-size:9pt;
  padding-top:11mm;
  font-weight:bold;
}


/* TOP THREE BOXES */

.top-boxes{
  display:grid;
  grid-template-columns:32% 34% 34%;
  margin-top:2mm;
  align-items:stretch;
}

.box{
  border:1.2px solid #111;
  height:40mm;
  min-height:40mm;
  padding:2.5mm;
}

.box b{
  display:block;
  text-align:center;
  font-size:9pt;
  margin-bottom:1.5mm;
}

.insurance-box{
  font-size:7pt;
  line-height:1.6;
}

.insurance-box div{
  margin-bottom:0.4mm;
}

.insurance-box div:nth-child(4){
  margin-bottom:0.8mm;
}

.insurance-box span{
  border-bottom:1px solid #777;
  display:inline-block;
  min-width:18mm;
}

.fromto{
  line-height:1.3;
  font-size:8pt;
}

.fromto b{
  margin-bottom:0.5mm;
}

.fromto div{
  border-bottom:1px solid #777;
  min-height:4.5mm;
  margin-bottom:0.2mm;
}

.booking{
  line-height:1.8;
  font-size:7.5pt;
  padding-top:1mm;
}

.booking div{
  min-height:6.5mm;
  line-height:1.5;
  display:flex;
  align-items:center;
}

.booking span{
  margin-left:auto;
  min-width:27mm;
  border-bottom:1px solid #777;
  padding-bottom:0.5mm;
}


/* CONSIGNOR / CONSIGNEE */

.line-row{
  border-bottom:1.2px solid #111;
  height:11mm;
  padding-top:3mm;
  font-size:8.5pt;
}

.line-row span{
  margin-left:5mm;
  font-weight:700;
}


/* MAIN TABLE */
.lr-table{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
  margin-top:1mm;
}
.lr-table th,
.lr-table td{
  border:1.2px solid #111;
}
.lr-table th{
  text-align:center;
  font-size:8pt;
  height:9mm;
  padding:1.5mm;
}
.lr-table td{
  height:105mm;
  vertical-align:top;
  padding:1.8mm;
  font-size:7.5pt;
}

/* EXACT KWL COLUMN STRUCTURE:
   Package | Description | Payment Mode | Actual | Charged | Rate | Rs. | P */
.lr-table .col-pkg{width:10%}
.lr-table .col-desc{width:30%}
.lr-table .col-pay{width:13%}
.lr-table .col-actual{width:9%}
.lr-table .col-charged{width:9%}
.lr-table .col-rate{width:12%}
.lr-table .col-rs{width:12%}
.lr-table .col-p{width:5%}

.desc-cell{
  position:relative;
}
.notice-small{
  position:absolute;
  bottom:2mm;
  left:2mm;
  font-size:6.5pt;
  line-height:1.15;
}

.pay-cell{
  font-size:7.2pt;
  white-space:nowrap;
  padding:2mm 2mm;
}

.pay-cell div{
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:7mm;
  line-height:1;
}

.pay-cell span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:4.5mm;
  height:4.5mm;
  min-width:4.5mm;
  min-height:4.5mm;
  box-sizing:border-box;
  border:1.4px solid #111;
  margin-left:2mm;
  position:static;
  flex-shrink:0;
  font-size:9pt;
  font-weight:900;
  line-height:1;
}

.rate-cell{
  position:relative;
  padding-top:1.8mm!important;
}
.charge-labels{
  position:absolute;
  left:1.8mm;
  right:1.2mm;
  top:43mm;
  line-height:1.8;
  font-size:7.2pt;
}
.amount-cell{
  position:relative;
  text-align:right;
  font-size:7.2pt!important;
  line-height:1.8;
  padding-top:1.8mm!important;
}
.paise-cell{
  position:relative;
  text-align:center;
  font-size:7.2pt!important;
  line-height:1.8;
  padding-top:1.8mm!important;
}
.freight-amount{
  min-height:1.8em;
  font-weight:400;
}
.charge-amounts{
  position:absolute;
  top:43mm;
  right:1.2mm;
  left:1.2mm;
  text-align:right;
}
.charge-paisee{
  position:absolute;
  top:43mm;
  left:0;
  right:0;
  text-align:center;
  margin:0;
}
.charge-amounts > div,
.charge-paisee > div{
  min-height:1.8em;
}


/* VALUE + AMOUNT IN WORDS */
.value-words-row{
  display:flex;
  align-items:center;
  width:100%;
  height:7mm;
  border-bottom:1.2px solid #111;
  font-size:8pt;
  box-sizing:border-box;
}

.value-words-row > div:first-child{
  display:flex;
  align-items:center;
  white-space:nowrap;
  width:45mm;
}

.value-label{
  font-weight:400;
  margin-right:3mm;
}

#pValue{
  font-weight:700;
  min-width:25mm;
}

.amount-words{
  flex:1;
  white-space:nowrap;
  overflow:hidden;
}

.amount-words .value-label{
  margin-right:2mm;
}


/* SIGNATURES */
.signatures-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  height:7mm;
  border-bottom:1.2px solid #111;
  font-size:8pt;
  box-sizing:border-box;
}

.signatures-row > div{
  width:50%;
  white-space:nowrap;
}

.signature-line{
  display:inline-block;
  width:55mm;
  border-bottom:1px solid #111;
  margin-left:4mm;
  vertical-align:middle;
}
/* BOTTOM SECTION */

.bottom-grid{
  display:grid;
  grid-template-columns:50% 50%;
  gap:0;
  margin-top:1mm;
  width:100%;
  box-sizing:border-box;
  border-right:1.2px solid #111;
}

.notice-box,
.caution-box,
.not-resp,
.pickup-delivery{
  border:1.2px solid #111;
  padding:2mm;
  font-size:6.7pt;
  line-height:1.2;
}

.notice-box{
  min-height:32mm;
}

.notice-box b,
.caution-box b{
  display:block;
  text-align:center;
  font-size:8pt;
  margin-bottom:1.5mm;
}

.notice-box p,
.caution-box p{
  margin:1mm 0;
}

.caution-box{
  min-height:19mm;
}

.not-resp{
  margin-top:2mm;
  min-height:8mm;
  text-align:center;
  font-weight:bold;
  display:flex;
  align-items:center;
  justify-content:center;
}

.pickup-delivery{
  margin-top:2mm;
  font-size:8pt;
  padding:0;
}

.pickup-delivery div{
  height:8mm;
  border-bottom:1px solid #111;
  padding:1.8mm 2mm;
}

.pickup-delivery div:last-child{
  border-bottom:0;
}

.pickup-delivery strong{
  float:right;
  min-width:42mm;
  text-align:left;
}


/* MOBILE SCREEN */

@media(max-width:650px){

  .topbar{
    padding:12px;
  }

  .container{
    padding:0 10px;
    margin-top:12px;
  }

  .page-title{
    align-items:flex-start;
    flex-direction:column;
  }

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

  .card{
    padding:14px;
  }

  .page-title h1{
    font-size:21px;
  }

  .record{
    align-items:flex-start;
    flex-direction:column;
  }
}


/* =====================================================
   PRINT SETTINGS
   ===================================================== */

@page{
  size:A4 portrait;
  margin:4mm;
}

@media print{

  html,
  body{
    width:210mm;
    height:297mm;
    margin:0;
    padding:0;
    background:#fff;
  }

  .topbar,
  .container{
    display:none!important;
  }

  #printSheet{
    display:block!important;
    width:100%;
    height:100%;
  }

  .print-page{
    width:202mm;
    height:289mm;
    margin:0 auto;
    overflow:hidden;
    page-break-after:avoid;
    page-break-inside:avoid;
  }

  .lr-table{
    page-break-inside:avoid;
  }

  .lr-table tr{
    page-break-inside:avoid;
  }

  .bottom-grid{
    page-break-inside:avoid;
  }
}

/* Final KWL print refinements */
@media print{
  .print-page{
    height:287mm;
  }
  .bottom-grid{
    margin-top:1mm;
    gap:2mm;
  }
  .notice-box{
    min-height:30mm;
  }
  .caution-box{
    min-height:17mm;
  }
  .not-resp{
    margin-top:1mm;
    min-height:7mm;
  }
  .pickup-delivery{
    margin-top:1mm;
  }
}

.lr-table .paise-cell{
  vertical-align:top;
  text-align:right;
}


/* Top-box alignment only: keep Policy/Date and Booking values on one line */
.insurance-box div{
  white-space:nowrap;
}

.insurance-box span{
  min-width:20mm;
  white-space:nowrap;
}

.booking div{
  white-space:nowrap;
  overflow:hidden;
}

.booking span{
  min-width:26mm;
  white-space:nowrap;
}

/* Original KWL logo image */
.kwl-logo {
    width: 27mm !important;
    height: 20mm !important;
    max-width: 27mm !important;
    max-height: 20mm !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.kwl-logo img {
    width: 27mm !important;
    height: 20mm !important;
    max-width: 27mm !important;
    max-height: 20mm !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    display: block !important;
}


/* ===== Search / records list / edit-delete ===== */
.search-bar{display:flex;gap:8px;align-items:center;margin-bottom:14px}
.search-bar input{margin-top:0;flex:1}
.search-bar button,.btn-link,.danger{border:0;border-radius:7px;padding:9px 14px;background:#1f2937;color:#fff;cursor:pointer;font-size:13px;text-decoration:none;display:inline-block}
.btn-link{background:#e5e9ee;color:#17202a}
.danger{background:#b42318}
.table-wrap{overflow-x:auto}
.records-table{width:100%;border-collapse:collapse;font-size:13px}
.records-table th,.records-table td{padding:9px 8px;border-bottom:1px solid #eee;text-align:left;vertical-align:top}
.records-table th{background:#f4f6f8;font-weight:600}
.records-table .num{text-align:right;white-space:nowrap}
.row-actions{display:flex;gap:6px;align-items:center;white-space:nowrap}
.row-actions form{margin:0}
.pager{display:flex;gap:10px;align-items:center;margin-top:14px;font-size:13px;color:#68737d}
.error-box{border-color:#f1b0a8;background:#fff4f2;color:#7a271a;font-size:13px}
.error-box ul{margin:8px 0 0 18px;padding:0}
@media print{.search-bar,.pager,.row-actions{display:none!important}}


/* ===== Login / users / top bar actions ===== */
.insurance-box i.tick{font-style:normal}
.topbar-actions{display:flex;gap:10px;align-items:center}
.topbar-actions form{margin:0}
.topbar-actions .who{display:inline;margin:0;font-size:13px;color:#68737d}
.topbar .btn-link{padding:12px 18px}
.auth-wrap{display:flex;justify-content:center;padding:8vh 16px}
.auth-card{width:100%;max-width:400px}
.auth-card h1{margin:0 0 4px;font-size:22px}
.auth-card label{margin-top:12px}
.muted{color:#68737d;font-size:13px;margin:0 0 14px}
.btn-primary{border:0;border-radius:7px;padding:12px 18px;background:#1f2937;color:#fff;cursor:pointer;font-size:14px;margin-top:16px}
.auth-card .btn-primary{width:100%}
.check{display:flex;align-items:center;gap:8px;font-weight:400}
.check input{width:auto;margin:0}
.inline-form{display:flex;gap:6px;align-items:center}
.inline-form input{margin:0;padding:8px;min-width:150px}
@media print{.topbar-actions{display:none!important}}

/* ===== Profile ===== */
.topbar-actions a.who{display:inline;margin:0;font-size:13px;color:#17202a;text-decoration:underline}
.profile-list{display:grid;grid-template-columns:160px 1fr;gap:10px 16px;margin:0;font-size:14px}
.profile-list dt{font-weight:600;color:#68737d}
.profile-list dd{margin:0}
