:root{
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-600:#1d4ed8;
  --danger:#dc2626;
  --danger-600:#b91c1c;
  --shadow: 0 10px 30px rgba(2,8,23,.08);
  --shadow-sm: 0 6px 16px rgba(2,8,23,.06);
  --radius: 14px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  background: radial-gradient(1200px 600px at 10% 0%, #e0ecff 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 10%, #ffe7f2 0%, transparent 55%),
              var(--bg);
  color: var(--text);
}

.container{
  max-width: 100%;
  margin: 22px auto;
  background: var(--card);
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(229,231,235,.9);
}

.topbar{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap:12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 14px;
}

h1{
  margin:0;
  font-size: 18px;
  letter-spacing: .1px;
}
.small{
  font-size: 12px;
  color: var(--muted);
}

/* grid layout (used in forms) */
.row{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  align-items: end;
}

.field{ grid-column: span 3; }
.field.w2{ grid-column: span 2; }
.field.w4{ grid-column: span 4; }
.field.w6{ grid-column: span 6; }
.field.w12{ grid-column: span 12; }

@media (max-width: 1100px){
  .field{ grid-column: span 6; }
  .field.w2{ grid-column: span 6; }
  .field.w4{ grid-column: span 6; }
  .field.w6{ grid-column: span 12; }
}
@media (max-width: 640px){
  .field{ grid-column: span 12; }
}

.field label{
  display:flex;
  gap:8px;
  align-items:center;
  font-size: 14px;
  color:#1d1d1d;
  margin-bottom:6px;
  font-weight:700;
}

.field input, .field select, .field textarea{
  width:100%;
  border:1px solid var(--border);
  background:#fff;
  padding:10px 12px;
  border-radius:12px;
  outline:none;
  transition:.15s ease;
  font-size:14px;
}

.field textarea{ min-height:70px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus{
  border-color: rgba(37,99,235,.6);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

/* buttons */
.actions{
  display:flex;
  gap:10px;
  margin-top:14px;
  flex-wrap:wrap;
}

.btn{
  padding:10px 14px;
  border:0;
  cursor:pointer;
  border-radius:12px;
  font-weight:600;
  font-size:13px;
  transition:.15s ease;
  display:inline-flex;
  align-items:center;
  gap:8px;
  user-select:none;
  text-decoration:none;
}

.btn-sm{
  padding:9px 12px;
  border-radius:12px;
  font-size:13px;
}

.btn-primary{
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color:#fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover{ transform: translateY(-1px); background: linear-gradient(135deg, var(--primary-600), #4338ca); }

.btn-secondary{
  background:#0f172a;
  color:#fff;
}
.btn-secondary:hover{ transform: translateY(-1px); }

.btn-light{
  background:#eef2ff;
  color:#1e293b;
}
.btn-light:hover{ background:#e0e7ff; transform: translateY(-1px); }

.btn-danger{
  background: linear-gradient(135deg, var(--danger), #ef4444);
  color:#fff;
}
.btn-danger:hover{ background: linear-gradient(135deg, var(--danger-600), #dc2626); transform: translateY(-1px); }

/* alerts */
.alert{
  padding:12px 12px;
  border-radius:12px;
  margin:12px 0;
  border:1px solid var(--border);
}
.alert-error{
  background:#fff1f2;
  border-color:#fecdd3;
  color:#9f1239;
}
.alert-success{
  background:#ecfdf5;
  border-color:#bbf7d0;
  color:#065f46;
}

/* table */
.table{
  width:100%;
  border-collapse: separate;
  border-spacing:0;
  margin-top:10px;
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
}

.table th, .table td{
  padding:10px 10px;
  font-size:12.5px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}

.table thead th{
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  color:#0f172a;
  font-weight:800;
  position: sticky;
  top:0;
  z-index:1;
}

.table tbody tr:hover{ background:#f8fafc; }
.table tbody tr:last-child td{ border-bottom:0; }

/* section title bar */
.sectionbar{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap:10px;
  margin-top:14px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}
.sectionbar .title{ font-weight:800; font-size:14px; }

a{ color: var(--primary); }
a:hover{ text-decoration: underline; }

/* Professional App Header */
.app-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap:12px;
  padding:14px 14px;
  border-radius:16px;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color:#fff;
  box-shadow: 0 14px 30px rgba(2,8,23,.18);
  border: 1px solid rgba(255,255,255,.10);
  margin-bottom:14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 280px;
}

.brand .logo{
  width:44px;
  height:44px;
  border-radius:12px;
  background: rgba(255,255,255,.14);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  letter-spacing:.5px;
  border:1px solid rgba(255,255,255,.18);
}

.brand .title{ line-height:1.05; }
.brand .title h1{
  margin:0;
  font-size:20px;
  font-weight:900;
  color:#fff;
}
.brand .title .sub{
  margin-top:4px;
  font-size:16px;
  color: rgba(255,255,255,.82);
}

.header-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.header-actions .btn{ box-shadow:none; }

/* Filters: FORCE single row (no wrap) + equal small fields */
.filters-row{
  display:flex;
  gap:10px;
  flex-wrap: nowrap !important;
  align-items:flex-end;
  margin-top: 10px;

  overflow-x:auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.filters-row .field{
  flex: 0 0 170px;
  min-width: 170px;
  grid-column: auto;
}

.filters-row .filters-actions{
  flex: 0 0 auto;
  display:flex;
  gap:10px;
  align-items:flex-end;
  position: sticky;
  right: 0;
  padding-left: 6px;
  background: var(--card);
}

.filters-row::-webkit-scrollbar{ height: 8px; }
.filters-row::-webkit-scrollbar-thumb{ background:#cbd5e1; border-radius: 999px; }
.filters-row::-webkit-scrollbar-track{ background: transparent; }

/* Center align table values */
.table td{ text-align:center; vertical-align: middle; }
.table th{ text-align:center; }

/* ==== NEW: list table compact + NO horizontal scroll ==== */
.table-wrap{
  border-radius:14px;
  overflow:hidden; /* important: removes scrollbar */
}

.table.table-compact{
  table-layout: fixed; /* forces columns to fit container */
  width:100%;
}

.table.table-compact th,
.table.table-compact td{
  padding: 8px 8px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* column widths */
.table.table-compact th:nth-child(1),
.table.table-compact td:nth-child(1){ width: 40px; }   /* # */

.table.table-compact th:nth-child(2),
.table.table-compact td:nth-child(2){ width: 85px; }   /* Sr No */

.table.table-compact th:nth-child(3),
.table.table-compact td:nth-child(3){ width: 105px; }  /* Date */

.table.table-compact th:nth-child(4),
.table.table-compact td:nth-child(4){ width: 95px; }   /* Truck */

.table.table-compact th:nth-child(5),
.table.table-compact td:nth-child(5){ width: 120px; }  /* Driver */

.table.table-compact th:nth-child(6),
.table.table-compact td:nth-child(6){ width: 60px; }   /* Items */

.table.table-compact th:nth-child(7),
.table.table-compact td:nth-child(7){ width: 110px; }  /* Freight */

.table.table-compact th:nth-child(8),
.table.table-compact td:nth-child(8){ width: 110px; }  /* Advance */

.table.table-compact th:nth-child(9),
.table.table-compact td:nth-child(9){ width: 110px; }  /* Balance */

.table.table-compact th:nth-child(10),
.table.table-compact td:nth-child(10){ width: 105px; } /* Expense */

.table.table-compact th:nth-child(11),
.table.table-compact td:nth-child(11){ width: 150px; } /* Actions */

/* Wider container only where needed */
.container-wide{
  max-width: 1500px; /* increase form width */
}

/* reuse table-wrap already present in your style (if not, add) */
.table-wrap{
  border-radius: 14px;
  overflow: hidden; /* removes scroll */
}

/* make bilty table fit without scroll */
.table.table-compact{
  table-layout: fixed;
  width: 100%;
}
.table.table-compact th,
.table.table-compact td{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* fixed widths to avoid horizontal scroll */
.table.table-compact th:nth-child(1),
.table.table-compact td:nth-child(1){ width: 25px; } /* Bilty */

.table.table-compact th:nth-child(2),
.table.table-compact td:nth-child(2){ width: 60px; } /* Receiver */

.table.table-compact th:nth-child(3),
.table.table-compact td:nth-child(3){ width: 50px; }  /* Weight */

.table.table-compact th:nth-child(4),
.table.table-compact td:nth-child(4){ width: 50px; }  /* Qty */

.table.table-compact th:nth-child(5),
.table.table-compact td:nth-child(5){ width: 80px; } /* Detail */

.table.table-compact th:nth-child(6),
.table.table-compact td:nth-child(6){ width: 25px; } /* Freight */

.table.table-compact th:nth-child(7),
.table.table-compact td:nth-child(7){ width: 60px; } /* Advance */

.table.table-compact th:nth-child(8),
.table.table-compact td:nth-child(8){ width: 80px; } /* Balance */

.table.table-compact th:nth-child(9),
.table.table-compact td:nth-child(9){ width: 80px; } /* Type */

.table.table-compact th:nth-child(10),
.table.table-compact td:nth-child(10){ width: 90px; } /* Remove */

/* Totals box */
.totals-box{
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}

.totals-title{
  font-weight: 900;
  font-size: 14px;
  margin-bottom: 10px;
}

.totals-grid{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.totals-card{
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.totals-card .k{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.totals-card .v{
  font-size: 18px;
  font-weight: 900;
  margin-top: 6px;
}

.totals-net{
  grid-column: span 2;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
  border-color: rgba(255,255,255,.12);
}
.totals-net .k{ color: rgba(255,255,255,.75); }
.totals-net .v span{ color: #fff; }

/* responsive totals */
@media (max-width: 1100px){
  .totals-grid{ grid-template-columns: repeat(2, 1fr); }
  .totals-net{ grid-column: span 2; }
}
@media (max-width: 520px){
  .totals-grid{ grid-template-columns: 1fr; }
  .totals-net{ grid-column: span 1; }
}

.totals-grid-single{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.totals-net.only{
  max-width: 520px;
}

.totals-grid-single{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.totals-net.only{
  max-width: 520px;
}

/* Totals header with Save button on right */
.totals-with-save .totals-head{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  margin-bottom: 10px;
}

/* Save button bottom right + bigger */
.totals-actions{
  display:flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.btn-save-big{
  padding: 14px 42px;
  font-size: 15px;
  font-weight: 900;
  border-radius: 14px;
  min-width: 120px;
}
/* Bigger fonts + tighter columns for list */
.filters-row .field label{ font-size: 14px; }
.filters-row .field input{ font-size: 14px; padding: 10px 10px; }

.table.table-compact{
  table-layout: fixed;
  width: 100%;
}

.table.table-compact th,
.table.table-compact td{
  font-size: 14px;
  padding: 6px 6px;          /* was 8px; now tighter */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table.table-compact thead th{
  font-size: 14px;
  letter-spacing: .2px;
}

/* Column widths (reduced) */
.col-no{ width: 40px; }      /* # column smaller */
.col-date{ width: 92px; }    /* Date column smaller */
.col-items{ width: 60px; }   /* Items column smaller */
.col-truck{ width: 110px; }
.col-money{ width: 110px; }
.col-actions{ width: 200px; }

@media (max-width: 900px){
  .col-actions{ width: 170px; }
  .col-money{ width: 100px; }
  .col-truck{ width: 100px; }
  .col-date{ width: 86px; }
  .col-items{ width: 52px; }
}