:root{--red:#BE1418;--darkred:#8F0F12;--bg:#F7F2E8;--paper:#fffaf1;--white:#fff;--line:#E7DDCF;--text:#201B18;--muted:#70675f;--soft:#FFF1F1;--shadow:0 14px 35px rgba(75,45,25,.08)}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}button,input,select,textarea{font:inherit}button{border:0;border-radius:12px;padding:10px 14px;font-weight:800;cursor:pointer;background:var(--red);color:white}button:hover{background:var(--darkred)}button.light{background:#fff;color:var(--text);border:1px solid var(--line)}button.ghost{background:var(--soft);color:var(--red);border:1px solid #f0caca}input,select,textarea{width:100%;border:1px solid var(--line);background:#fff;border-radius:12px;padding:11px 12px;outline:0}input:focus,select:focus,textarea:focus{border-color:var(--red);box-shadow:0 0 0 3px rgba(190,20,24,.08)}textarea{min-height:90px}label{font-size:13px;font-weight:800}.boot,.login{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#fffaf1,#f7f2e8)}.login-card{width:min(430px,calc(100vw - 32px));background:#fff;border:1px solid var(--line);border-radius:28px;padding:34px;box-shadow:var(--shadow)}.logo-box{background:#fff;border:1px solid var(--line);border-radius:20px;padding:18px;margin-bottom:22px}.logo-box img{width:100%;display:block}.login-card h1{margin:0 0 8px;font-size:34px;letter-spacing:-1px}.login-card p{color:var(--muted);line-height:1.5;margin:0 0 24px}.form{display:grid;gap:12px}.error{background:#fff0f0;border:1px solid #ffd0d0;color:#8a1014;border-radius:14px;padding:12px;font-weight:700}.info{background:#fff8e8;border:1px solid #f0d8a6;color:#57421a;border-radius:14px;padding:12px;font-weight:700;margin:12px 0}.shell{display:flex;min-height:100vh}.sidebar{width:292px;background:#fffdf8;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:18px;position:sticky;top:0;height:100vh}.brand{background:#fff;border:1px solid var(--line);border-radius:22px;padding:14px;display:flex;gap:12px;align-items:center;box-shadow:0 8px 20px rgba(76,46,25,.04)}.brand img{width:92px;background:#fff;border-radius:10px}.brand-title{font-weight:900;font-size:20px;letter-spacing:-.5px}.brand-sub{color:var(--muted);font-size:12px;margin-top:4px}.nav{display:grid;gap:8px;margin:22px 0}.nav button{width:100%;text-align:left;background:transparent;color:#4f453d;padding:12px;border-radius:14px;border:1px solid transparent}.nav button.active{background:var(--red);color:white;border-color:var(--red)}.nav button:hover:not(.active){background:#fff4f4;color:var(--red);border-color:#f3d0d0}.side-footer{margin-top:auto;display:grid;gap:12px}.user-chip{background:white;border:1px solid var(--line);border-radius:18px;padding:12px}.user-chip strong,.user-chip span{display:block}.user-chip span{color:var(--muted);font-size:12px;margin-top:4px}.main{flex:1;min-width:0}.topbar{min-height:86px;background:rgba(247,242,232,.9);backdrop-filter:blur(10px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:18px 26px;position:sticky;top:0;z-index:5}.topbar h1{margin:0;letter-spacing:-.8px}.topbar p{margin:4px 0 0;color:var(--muted)}.badge{background:#fff;color:var(--red);border:1px solid #efcccc;border-radius:999px;padding:10px 14px;font-weight:900;font-size:13px}.content{padding:26px}.stack{display:grid;gap:22px}.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.card{background:white;border:1px solid var(--line);border-radius:24px;padding:22px;box-shadow:var(--shadow)}.stat p{margin:0 0 8px;color:var(--muted);font-weight:800;font-size:13px}.stat h2{margin:0;font-size:28px;letter-spacing:-1px}.stat span{display:block;margin-top:8px;color:var(--muted);font-size:12px}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:18px}.head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:18px}.head h2,.card h2{margin:0 0 6px;letter-spacing:-.5px}.head p,.muted{margin:0;color:var(--muted);line-height:1.5}.filters{display:grid;grid-template-columns:1fr 220px 180px;gap:12px;margin-bottom:16px}.table-wrap{width:100%;overflow:auto;border:1px solid var(--line);border-radius:18px;background:white}table{width:100%;border-collapse:collapse;min-width:760px}th{text-align:left;background:#fbf4ea;color:#4d4339;font-size:12px;text-transform:uppercase;letter-spacing:.04em;padding:13px;border-bottom:1px solid var(--line)}td{padding:13px;border-bottom:1px solid #f1e8db;font-size:14px;vertical-align:middle}tr:last-child td{border-bottom:0}.empty{text-align:center;color:var(--muted);padding:28px}.qty{text-align:right;font-weight:800}.item-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}.item-card{background:linear-gradient(180deg,#fff,#fffaf3);border:1px solid var(--line);border-radius:20px;padding:18px;cursor:pointer;transition:.18s}.item-card:hover{transform:translateY(-2px);box-shadow:var(--shadow);border-color:#ebc6c6}.item-card.active{border-color:var(--red);box-shadow:0 0 0 3px rgba(190,20,24,.08)}.item-card h3{margin:0 0 10px;font-size:20px}.big{font-size:24px;font-weight:900;letter-spacing:-.6px}.small{color:var(--muted);font-size:12px;margin-top:4px}.pill{display:inline-flex;background:#fff3f3;color:var(--red);border:1px solid #f1caca;border-radius:999px;padding:5px 9px;font-weight:800;font-size:12px}.entry{max-width:760px}.row-actions{display:flex;gap:8px}.row-actions button{padding:8px 10px;border-radius:10px;font-size:13px}.mobile-menu{display:none}@media(max-width:1050px){.stats{grid-template-columns:repeat(2,1fr)}.grid2{grid-template-columns:1fr}.filters{grid-template-columns:1fr 1fr}}@media(max-width:760px){.sidebar{position:fixed;transform:translateX(-105%);transition:.25s;z-index:20}.sidebar.show{transform:translateX(0)}.mobile-menu{display:block;background:#111}.topbar{height:auto;padding:16px;gap:12px;align-items:flex-start}.badge{display:none}.content{padding:16px}.stats{grid-template-columns:1fr}.filters{grid-template-columns:1fr}.item-grid{grid-template-columns:1fr}}



/* =========================================================
   KBL STOCK APP v4.3 - STABLE MOBILE MENU
   Built from last full-feature working version.
   Keeps all menu options through mobile drawer.
   ========================================================= */

@media (max-width: 760px) {
  body {
    background: #F7F2E8;
    -webkit-tap-highlight-color: transparent;
  }

  .app-shell,
  .shell {
    display: block;
    min-height: 100vh;
  }

  /* Mobile drawer sidebar - visible through hamburger */
  .sidebar {
    display: flex !important;
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    width: 286px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 18px 0 48px rgba(0,0,0,.20);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-panel,
  .main {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    min-height: auto;
    height: auto;
    padding: 14px 16px 12px;
    gap: 12px;
    align-items: flex-start;
    background: rgba(247,242,232,.97);
    border-bottom: 1px solid var(--line);
  }

  .mobile-menu {
    display: block !important;
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    background: var(--red, #BE1418) !important;
    color: #fff !important;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.15;
    margin: 0 0 4px;
  }

  .topbar p {
    font-size: 12px;
    line-height: 1.35;
    margin: 0;
  }

  .topbar-badge,
  .badge {
    display: none !important;
  }

  .content-area,
  .content {
    padding: 14px;
  }

  .page-stack,
  .stack {
    gap: 14px;
  }

  .panel-card,
  .card {
    border-radius: 18px;
    padding: 15px;
    box-shadow: 0 8px 22px rgba(76,46,25,.06);
  }

  .section-head,
  .head {
    display: block;
    margin-bottom: 14px;
  }

  .section-head h2,
  .head h2,
  .panel-card h2,
  .card h2 {
    font-size: 19px;
    line-height: 1.2;
  }

  .section-head p,
  .head p,
  .muted {
    font-size: 13px;
  }

  .section-head button,
  .head button {
    width: 100%;
    margin-top: 12px;
  }

  .stats-grid,
  .stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card,
  .stat {
    padding: 14px;
    border-radius: 16px;
  }

  .stat-card p,
  .stat p {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .stat-card h2,
  .stat h2 {
    font-size: 22px;
    line-height: 1.15;
  }

  .stat-card span,
  .stat span {
    font-size: 11px;
  }

  .grid-two,
  .grid2 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .filters {
    grid-template-columns: 1fr !important;
    gap: 9px;
    margin-bottom: 12px;
  }

  input, select, textarea {
    min-height: 46px;
    border-radius: 12px;
    font-size: 15px;
  }

  button {
    min-height: 44px;
    border-radius: 12px;
    font-size: 14px;
  }

  .item-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .item-card {
    border-radius: 16px;
    padding: 13px;
  }

  .item-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .item-card .big {
    font-size: 20px;
  }

  .item-card .small {
    font-size: 11px;
    line-height: 1.3;
  }

  /* Keep tables stable and readable with horizontal scroll instead of risky conversion */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
  }

  table {
    min-width: 720px;
    font-size: 13px;
  }

  th, td {
    padding: 10px;
    white-space: nowrap;
  }

  .entry-form,
  .form {
    gap: 10px;
  }

  .panel-card.narrow,
  .card.entry,
  .entry {
    max-width: none;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .row-actions button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .login-card {
    width: calc(100vw - 28px);
    padding: 24px;
    border-radius: 22px;
  }

  .logo-box {
    padding: 14px;
    border-radius: 16px;
  }

  .login-card h1 {
    font-size: 29px;
  }

  .login-card p {
    font-size: 14px;
  }
}

@media (max-width: 390px) {
  .item-grid {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   KBL STOCK APP v4.7 - CACHE-BUSTED REAL MOBILE CARDS
   Stable hamburger menu retained. Desktop tables retained.
   Mobile gets separate labelled cards.
   ========================================================= */

.mobile-card-list {
  display: none;
}

@media (max-width: 760px) {
  .desktop-table {
    display: none !important;
  }

  .mobile-card-list {
    display: grid !important;
    gap: 10px;
    width: 100%;
  }

  .responsive-data {
    width: 100%;
  }

  .mobile-data-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 13px 14px;
    box-shadow: 0 6px 18px rgba(76,46,25,.045);
  }

  .mobile-data-row {
    display: grid;
    grid-template-columns: 42% 58%;
    gap: 10px;
    padding: 7px 0;
    border-top: 1px solid #F2E9DD;
    align-items: start;
  }

  .mobile-data-row:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .mobile-data-row:last-child {
    padding-bottom: 0;
  }

  .mobile-data-label {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    font-weight: 900;
    text-align: left;
  }

  .mobile-data-value {
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
    font-weight: 800;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .primary-row .mobile-data-label {
    color: var(--red, #BE1418);
  }

  .primary-row .mobile-data-value {
    font-size: 15px;
    font-weight: 950;
  }

  .mobile-data-value .pill {
    display: inline-flex !important;
    justify-content: center;
    min-width: 92px;
  }

  .mobile-data-value .row-actions {
    justify-content: flex-end;
  }

  .mobile-empty-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    color: var(--muted);
    text-align: center;
  }

  .table-wrap.desktop-table {
    display: none !important;
  }
}

@media (min-width: 761px) {
  .desktop-table {
    display: block !important;
  }

  .mobile-card-list {
    display: none !important;
  }
}

@media (max-width: 390px) {
  .mobile-data-row {
    grid-template-columns: 45% 55%;
  }

  .mobile-data-label {
    font-size: 11px;
  }

  .mobile-data-value {
    font-size: 12px;
  }
}


/* =========================================================
   KBL STOCK APP v4.8 - ITEM FILTER + GODOWN NAMES
   ========================================================= */

.form select + label {
  margin-top: 2px;
}

@media (max-width: 760px) {
  .form label {
    margin-top: 3px;
  }
}


/* =========================================================
   KBL STOCK APP v4.9 - OUTWARD / TRANSFER GODOWN FILTER
   ========================================================= */

.info strong {
  font-weight: 900;
}


/* =========================================================
   KBL STOCK APP v5.1 - ENTRY SEARCH + PARTY FIX
   ========================================================= */

.form input[type="text"] {
  background: #fffdf8;
  border-color: #e2d5c5;
}

.form input[type="text"]::placeholder {
  color: #9a8f83;
}

@media (max-width: 760px) {
  .form input[type="text"] {
    min-height: 48px;
  }
}


/* =========================================================
   KBL STOCK APP v5.2 - OUTWARD PARTY + APPROVAL AUDIT
   ========================================================= */

.audit-note {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 760px) {
  .mobile-data-row .mobile-data-label {
    min-width: 112px;
  }
}


/* =========================================================
   KBL STOCK APP v5.3 - PARTY TEXT FIELD FIX
   ========================================================= */

.form input[placeholder="Optional party/customer name"] {
  background: #fffdf8;
}

/* KBL v5.6 PDF-only reports */
#reportStatus{margin-top:10px}
