
:root{--bg:#f7f9fc;--card:#fff;--text:#172033;--muted:#758096;--primary:#2563eb;--primary2:#0ea5e9;--line:#e7ebf1;--success:#168a5b;--danger:#dc2626;--warning:#f59e0b;--shadow:0 10px 30px rgba(23,32,51,.07)}
*{box-sizing:border-box}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial;background:var(--bg);color:var(--text)}
a{text-decoration:none;color:inherit}.app-shell{min-height:100vh;display:flex}.sidebar{width:255px;background:#fff;border-right:1px solid var(--line);padding:26px 18px;position:fixed;inset:0 auto 0 0;display:flex;flex-direction:column}
.brand{display:flex;align-items:center;gap:11px;font-weight:800;font-size:21px;margin:0 8px 28px}.brand-mark{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,var(--primary),var(--primary2));color:#fff}.brand-dot{color:var(--primary)}
.firm-card{padding:13px 14px;border-radius:14px;background:linear-gradient(135deg,#f0f6ff,#f8fbff);border:1px solid #dceaff;margin-bottom:18px}.firm-name{font-weight:750;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.firm-card small{color:var(--primary)}
nav{display:flex;flex-direction:column;gap:4px;overflow:auto}nav a{padding:10px 12px;border-radius:10px;color:#465269;font-size:14px}nav a:hover{background:#f2f6ff;color:var(--primary)}.pro{float:right;font-size:10px;font-weight:800;color:#7c3aed;background:#f3e8ff;padding:2px 6px;border-radius:8px}.upgrade-link{background:linear-gradient(135deg,#eff6ff,#f5f3ff)!important;color:#4f46e5!important;font-weight:700}.logout{margin-top:auto;padding:12px;color:#7b8495}
.main{margin-left:255px;width:calc(100% - 255px);padding:28px 34px 60px}.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:26px}.topbar h1{margin:0;font-size:28px}.topbar p{margin:5px 0 0;color:var(--muted);font-size:13px}.avatar{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;background:#e8f0ff;color:var(--primary);font-weight:800}
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px}.card{background:var(--card);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow);padding:20px}.stat .label{color:var(--muted);font-size:13px}.stat .value{font-size:28px;font-weight:800;margin-top:8px}.stat .trend{font-size:12px;color:var(--success);margin-top:5px}.span-2{grid-column:span 2}.span-3{grid-column:span 3}.span-4{grid-column:span 4}
.btn{border:0;border-radius:11px;padding:11px 16px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;gap:8px}.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary2));color:#fff}.btn-light{background:#f3f6fa;color:#334155}.btn-danger{background:#fff1f2;color:#be123c}.btn-success{background:#ecfdf5;color:#047857}.btn:disabled{opacity:.55;cursor:not-allowed}
.table-wrap{overflow:auto}.table{width:100%;border-collapse:collapse}.table th,.table td{padding:13px 12px;border-bottom:1px solid var(--line);text-align:left;font-size:14px}.table th{font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);background:#fbfcfe}.badge{display:inline-block;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:700}.badge-green{background:#ecfdf5;color:#047857}.badge-gray{background:#f1f5f9;color:#475569}.badge-amber{background:#fff7ed;color:#c2410c}
.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}.field{display:flex;flex-direction:column;gap:7px}.field.full{grid-column:1/-1}.field label{font-size:13px;font-weight:700}.field input,.field select,.field textarea{width:100%;border:1px solid #d9e0e9;background:#fff;border-radius:11px;padding:11px 12px;outline:none;font:inherit;color:var(--text)}.field input:focus,.field select:focus,.field textarea:focus{border-color:#7aa7ff;box-shadow:0 0 0 3px #eaf2ff}.field textarea{min-height:110px;resize:vertical}.hint{font-size:12px;color:var(--muted)}
.actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.alert{padding:13px 15px;border-radius:12px;margin-bottom:18px}.alert.success{background:#ecfdf5;color:#047857}.alert.error{background:#fff1f2;color:#be123c}.alert.info{background:#eff6ff;color:#1d4ed8}
.hero{background:linear-gradient(135deg,#ffffff,#f4f8ff);border:1px solid #dae7ff;border-radius:22px;padding:26px;display:flex;justify-content:space-between;align-items:center;box-shadow:var(--shadow);margin-bottom:20px}.hero h2{margin:0 0 8px;font-size:26px}.hero p{margin:0;color:var(--muted)}
.auth{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at top left,#eaf2ff 0,transparent 34%),#f7f9fc}.auth-card{width:min(560px,100%);background:#fff;border:1px solid var(--line);border-radius:24px;box-shadow:0 18px 55px rgba(23,32,51,.1);padding:30px}.auth-card h1{margin:0 0 6px}.auth-card>.hint{margin-bottom:22px}
.price{font-size:38px;font-weight:850}.price small{font-size:14px;color:var(--muted);font-weight:500}.premium-card{border:1px solid #c7d8ff;background:linear-gradient(135deg,#fff,#f4f7ff)}
.invoice-editor{display:grid;grid-template-columns:1fr 330px;gap:18px}.line-items input{min-width:90px}.total-box{display:grid;gap:10px}.total-row{display:flex;justify-content:space-between}.total-row.grand{font-size:19px;font-weight:800;padding-top:12px;border-top:1px solid var(--line)}
@media(max-width:1000px){.grid{grid-template-columns:repeat(2,1fr)}.invoice-editor{grid-template-columns:1fr}.sidebar{width:220px}.main{margin-left:220px;width:calc(100% - 220px)}}
@media(max-width:760px){.sidebar{position:static;width:100%;height:auto}.app-shell{display:block}.sidebar nav{display:grid;grid-template-columns:1fr 1fr}.main{margin:0;width:100%;padding:20px}.grid,.form-grid{grid-template-columns:1fr}.topbar h1{font-size:23px}.auth-card{padding:22px}.span-2,.span-3,.span-4{grid-column:span 1}}


/* Responsive fit improvements only — existing fonts, colors and visual design are preserved. */
.premium-feature-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;margin-bottom:18px}
.premium-feature-card{min-width:0}.premium-feature-card h3{margin-top:0}.premium-feature-card p{margin-bottom:0;color:var(--muted);line-height:1.55}
.premium-hero{gap:22px}.premium-price-box{display:flex;flex-direction:column;align-items:flex-end;gap:10px;flex:0 0 auto}
.premium-payment-grid{margin-bottom:18px}.premium-payment-qr{width:150px;height:150px;max-width:100%;object-fit:contain;border:1px solid var(--line);border-radius:14px;padding:8px;background:#fff}
.premium-history-card{margin-top:18px}.settings-image-preview{display:block;width:110px;height:80px;object-fit:contain;margin-top:8px;border:1px solid var(--line);border-radius:10px;padding:6px;background:#fff}
.table th,.table td{vertical-align:middle}.table td .actions{min-width:max-content}.main,.card,.hero,.auth-card{min-width:0}
img{max-width:100%;height:auto}
@media(max-width:1200px){.premium-feature-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:1000px){.main{padding-left:24px;padding-right:24px}.hero{align-items:flex-start}.premium-price-box{align-items:flex-start}.table-wrap{-webkit-overflow-scrolling:touch}}
@media(max-width:760px){
  body{overflow-x:hidden}
  .sidebar{padding:18px 14px}
  .brand{margin-bottom:16px}
  .firm-card{margin-bottom:12px}
  .sidebar nav{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  nav a{min-width:0;overflow-wrap:anywhere}
  .main{padding:18px 14px 40px}
  .topbar{gap:12px;align-items:flex-start}
  .topbar>div:first-child{min-width:0}
  .topbar h1{overflow-wrap:anywhere}
  .hero{flex-direction:column;align-items:stretch;padding:20px}
  .hero .actions,.premium-price-box{width:100%;align-items:stretch}
  .premium-price-box .btn{justify-content:center}
  .premium-feature-grid{grid-template-columns:1fr;gap:14px}
  .card{padding:16px;border-radius:15px}
  .actions{width:100%}
  .actions>.btn{justify-content:center}
  .form-grid{gap:13px}
  .field input,.field select,.field textarea{font-size:16px}
  .invoice-editor{display:block}
  .invoice-editor>.card+ .card{margin-top:16px}
  .table{min-width:680px}
  .table-wrap{width:100%;max-width:100%;overflow-x:auto}
  .auth{padding:14px}
  .auth-card{width:100%;max-width:560px}
}
@media(max-width:480px){
  .sidebar nav{grid-template-columns:1fr}
  .topbar{margin-bottom:18px}
  .avatar{width:38px;height:38px;flex:0 0 38px}
  .price{font-size:32px}
  .btn{width:100%;justify-content:center}
  .actions form{width:100%}
  .actions form input[type="date"]{width:100%}
  .premium-payment-qr{display:block;margin:0 auto 12px}
}


/* Final responsive layout + fixed 100x100 TBSI branding.
   Existing font family, color palette and component design are preserved. */
.brand-logo-link{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:7px;
  margin:0 0 18px;
  padding:0;
  width:100%;
}
.app-brand-logo{
  display:block;
  width:100px !important;
  height:100px !important;
  min-width:100px;
  min-height:100px;
  max-width:100px !important;
  max-height:100px !important;
  object-fit:contain;
  flex:0 0 100px;
}
.brand-copy{
  display:flex;
  flex-direction:column;
  align-items:center;
  min-width:0;
  line-height:1.1;
}
.brand-copy strong{font-size:18px}
.brand-copy small{
  margin-top:3px;
  font-size:9px;
  letter-spacing:.08em;
  color:var(--muted);
  text-align:center;
}
.auth-brand{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  margin:0 0 20px;
}
.auth-brand-logo{
  display:block;
  width:100px !important;
  height:100px !important;
  min-width:100px;
  min-height:100px;
  max-width:100px !important;
  max-height:100px !important;
  object-fit:contain;
  flex:0 0 100px;
}
.auth-brand-copy{
  display:flex;
  flex-direction:column;
  line-height:1.08;
}
.auth-brand-copy strong{font-size:24px}
.auth-brand-copy span{
  margin-top:5px;
  font-size:10px;
  letter-spacing:.12em;
  color:var(--muted);
}
.sidebar{
  overflow:hidden;
}
.sidebar nav{
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
}
.main{
  min-width:0;
  overflow-x:hidden;
}
.card,.hero,.form-grid,.invoice-editor,.topbar{
  max-width:100%;
}
.table-wrap{
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.line-items{
  min-width:850px;
}
.field input,.field select,.field textarea{
  max-width:100%;
}
img{
  max-width:100%;
}
@media(max-width:1000px){
  .sidebar{width:220px}
  .main{margin-left:220px;width:calc(100% - 220px)}
}
@media(max-width:760px){
  .sidebar{
    position:static;
    width:100%;
    min-height:auto;
    overflow:visible;
  }
  .main{
    margin-left:0;
    width:100%;
    overflow-x:hidden;
  }
  .brand-logo-link{
    flex-direction:row;
    justify-content:flex-start;
  }
  .brand-copy{
    align-items:flex-start;
  }
  .sidebar nav{
    overflow:visible;
  }
  .auth{
    min-height:100dvh;
    align-items:start;
    padding-top:18px;
  }
  .auth-card{
    width:100%;
  }
  .auth-brand{
    justify-content:flex-start;
  }
  .premium-feature-grid{
    grid-template-columns:1fr;
  }
}
@media(max-width:480px){
  .auth-brand{
    flex-direction:column;
    text-align:center;
  }
  .auth-brand-copy{
    align-items:center;
  }
  .brand-logo-link{
    flex-direction:row;
  }
  .app-brand-logo,
  .auth-brand-logo{
    width:100px !important;
    height:100px !important;
  }
}


/* Clear product-name hierarchy: TBSI title + The Billing Software subtitle. */
.brand-copy strong{
  display:block;
  font-size:20px;
  font-weight:800;
  line-height:1;
  white-space:nowrap;
}
.brand-copy small{
  display:block;
  margin-top:4px;
  font-size:10px;
  font-weight:600;
  line-height:1.15;
  letter-spacing:.05em;
  text-transform:none;
  white-space:nowrap;
}
.auth-brand-copy strong{
  display:block;
  font-size:28px;
  font-weight:800;
  line-height:1;
}
.auth-brand-copy span{
  display:block;
  margin-top:6px;
  font-size:12px;
  font-weight:600;
  line-height:1.2;
  letter-spacing:.04em;
  text-transform:none;
}


/* Signup privacy / password-recovery UX */
.privacy-callout{
  display:flex;
  flex-direction:column;
  gap:5px;
  padding:13px 14px;
  border:1px solid #d8e5f3;
  border-radius:12px;
  background:#f4f9ff;
}
.privacy-callout strong{font-size:14px}
.privacy-callout span{
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}
.privacy-accept-box{
  padding:13px 14px;
  border:1px solid #d9e1ea;
  border-radius:12px;
  background:#fbfcfe;
}
.privacy-check{
  display:flex;
  align-items:flex-start;
  gap:10px;
  cursor:pointer;
  font-weight:600;
  line-height:1.45;
}
.privacy-check input[type="checkbox"]{
  width:18px;
  height:18px;
  min-width:18px;
  margin-top:2px;
}
.privacy-check a{text-decoration:underline}


/* Optional GST + business-partner GST search */
.gst-choice{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.gst-choice label{
  display:flex;
  align-items:center;
  gap:9px;
  padding:12px 13px;
  border:1px solid #d9e1ea;
  border-radius:12px;
  background:#fbfcfe;
  cursor:pointer;
  font-weight:700;
}
.gst-choice input[type="radio"]{
  width:18px;
  height:18px;
  flex:0 0 auto;
}
.gst-search-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
}
.partner-search-result,
.manual-partner-box{
  margin-top:16px;
  padding:16px;
  border:1px solid #d9e1ea;
  border-radius:14px;
  background:#fbfcfe;
}
.partner-search-result h3,
.manual-partner-box h3{
  margin-top:6px;
}
.partner-search-badge{
  display:inline-block;
  padding:5px 8px;
  border-radius:999px;
  background:#eaf8ef;
  font-size:11px;
  font-weight:800;
}
@media(max-width:760px){
  .gst-choice{grid-template-columns:1fr}
  .gst-search-row{grid-template-columns:1fr}
  .gst-search-row .btn{width:100%;justify-content:center}
}


/* Bill layout chooser */
.layout-choice-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}
.layout-choice-card{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:4px;
  min-height:92px;
  padding:14px;
  border:1px solid #d9e1ea;
  border-radius:14px;
  background:#fbfcfe;
  cursor:pointer;
}
.layout-choice-card input{
  position:absolute;
  top:12px;
  right:12px;
  width:18px;
  height:18px;
}
.layout-choice-card strong{font-size:14px}
.layout-choice-card small{color:var(--muted)}
.layout-choice-no{
  font-size:11px;
  font-weight:800;
  letter-spacing:.03em;
  text-transform:uppercase;
}
.layout-choice-card.locked{
  opacity:.55;
  cursor:not-allowed;
}
@media(max-width:760px){
  .layout-choice-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:480px){
  .layout-choice-grid{grid-template-columns:1fr}
}


/* Full Customizable Bill Layout 10 */
.custom-bill-panel{
  padding:18px;
  border:1px solid #d9e1ea;
  border-radius:16px;
  background:#fbfcfe;
}
.custom-bill-panel-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  margin-bottom:14px;
}
.custom-bill-panel-head h3{
  margin:0 0 5px;
}
.customizer-section{
  padding:16px 0;
  border-top:1px solid #e5eaf0;
}
.customizer-section:first-of-type{
  border-top:0;
}
.customizer-section h4{
  margin:0 0 12px;
}
.customizer-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.customizer-grid label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  font-weight:700;
}
.customizer-grid input,
.customizer-grid select{
  width:100%;
}
.customizer-grid input[type="color"]{
  min-height:42px;
  padding:3px;
}
.custom-toggle-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px 14px;
}
.custom-toggle-grid label{
  display:flex;
  align-items:center;
  gap:9px;
  padding:9px 10px;
  border:1px solid #e1e6ed;
  border-radius:10px;
  background:#fff;
}
.custom-toggle-grid input{
  width:18px;
  height:18px;
  flex:0 0 auto;
}
.locked-panel{
  opacity:.75;
}
@media(max-width:900px){
  .customizer-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media(max-width:600px){
  .customizer-grid,
  .custom-toggle-grid{
    grid-template-columns:1fr;
  }
}


/* Bill / Quotation creation focus mode: left menu auto-hides. */
.editor-mode .sidebar{
  transition:transform .22s ease,box-shadow .22s ease;
  z-index:1002;
}
.editor-mode .main{
  transition:margin-left .22s ease,width .22s ease;
}
.editor-mode.sidebar-hidden .sidebar{
  transform:translateX(-102%);
}
.editor-mode.sidebar-hidden .main{
  margin-left:0;
  width:100%;
}
.topbar-title-wrap{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.editor-menu-toggle{
  flex:0 0 auto;
  min-width:88px;
  justify-content:center;
}
.editor-menu-icon{
  font-size:18px;
  line-height:1;
}
.editor-sidebar-backdrop{
  display:none;
  position:fixed;
  inset:0;
  z-index:1001;
  border:0;
  padding:0;
  margin:0;
  background:rgba(15,23,42,.28);
  cursor:pointer;
}
.editor-mode.sidebar-open .editor-sidebar-backdrop{
  display:block;
}
.editor-mode.sidebar-open .sidebar{
  box-shadow:16px 0 40px rgba(15,23,42,.16);
}
@media(min-width:761px){
  .editor-mode.sidebar-open .main{
    margin-left:255px;
    width:calc(100% - 255px);
  }
}
@media(min-width:761px) and (max-width:1000px){
  .editor-mode.sidebar-open .main{
    margin-left:220px;
    width:calc(100% - 220px);
  }
}
@media(max-width:760px){
  .editor-mode .app-shell{
    display:block;
  }
  .editor-mode .sidebar{
    position:fixed;
    inset:0 auto 0 0;
    width:min(300px,86vw);
    height:100dvh;
    overflow:hidden;
    padding:18px 14px;
    background:#fff;
  }
  .editor-mode .sidebar nav{
    overflow-y:auto;
    overflow-x:hidden;
  }
  .editor-mode .main,
  .editor-mode.sidebar-open .main,
  .editor-mode.sidebar-hidden .main{
    margin-left:0;
    width:100%;
  }
  .editor-mode .topbar{
    align-items:center;
  }
  .editor-mode .topbar-title-wrap{
    align-items:flex-start;
  }
}
@media(max-width:480px){
  .editor-mode .topbar-title-wrap{
    width:calc(100% - 48px);
  }
  .editor-mode .editor-menu-toggle{
    width:auto;
    min-width:76px;
    padding-left:11px;
    padding-right:11px;
  }
}


/* Layout picker + right-side live A4 preview */
.layout-picker-preview{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(360px,46%);
  gap:18px;
  align-items:start;
}
.layout-list-panel{
  min-width:0;
}
.layout-picker-preview .layout-choice-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.layout-choice-card{
  min-width:0;
}
.layout-choice-main{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-height:62px;
  cursor:pointer;
}
.layout-choice-card.locked .layout-choice-main{
  cursor:not-allowed;
}
.layout-preview-btn{
  margin-top:8px;
  width:100%;
  border:1px solid #d9e1ea;
  border-radius:9px;
  background:#fff;
  color:#334155;
  padding:8px 10px;
  font:inherit;
  font-size:12px;
  font-weight:750;
  cursor:pointer;
}
.layout-preview-btn:hover{
  border-color:#8fb1ee;
  background:#f6f9ff;
}
.layout-choice-card.previewing{
  border-color:#2563eb;
  box-shadow:0 0 0 2px rgba(37,99,235,.11);
  background:#f7faff;
}
.layout-live-preview-panel{
  position:sticky;
  top:18px;
  min-width:0;
  border:1px solid #d9e1ea;
  border-radius:16px;
  background:#fff;
  overflow:hidden;
}
.layout-preview-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:13px 14px;
  border-bottom:1px solid #e7ebf1;
  background:#fbfcfe;
}
.layout-preview-head>div{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.layout-preview-head strong{
  font-size:14px;
}
.layout-preview-head span{
  font-size:11px;
  color:var(--muted);
  overflow-wrap:anywhere;
}
.layout-a4-badge{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:26px;
  border-radius:7px;
  background:#eaf2ff;
  color:#1d4ed8 !important;
  font-weight:800;
}
.layout-preview-frame-wrap{
  width:100%;
  aspect-ratio:210 / 297;
  min-height:520px;
  max-height:760px;
  background:#eef2f7;
}
.layout-preview-frame{
  display:block;
  width:100%;
  height:100%;
  border:0;
  background:#eef2f7;
}
.layout-live-preview-panel>.hint{
  display:block;
  padding:10px 13px 12px;
  margin:0;
}
@media(max-width:1150px){
  .layout-picker-preview{
    grid-template-columns:minmax(0,1fr) minmax(320px,42%);
  }
  .layout-picker-preview .layout-choice-grid{
    grid-template-columns:1fr;
  }
}
@media(max-width:900px){
  .layout-picker-preview{
    grid-template-columns:1fr;
  }
  .layout-live-preview-panel{
    position:static;
  }
  .layout-picker-preview .layout-choice-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .layout-preview-frame-wrap{
    min-height:440px;
    max-height:none;
  }
}
@media(max-width:560px){
  .layout-picker-preview .layout-choice-grid{
    grid-template-columns:1fr;
  }
  .layout-preview-frame-wrap{
    min-height:390px;
  }
}


/* Sales / Purchase bill filtering reports */
.report-filter-form{
  align-items:end;
}
.report-filter-actions .actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.table .right{
  text-align:right;
}
.report-total-row th{
  border-top:2px solid #cbd5e1;
  font-size:13px;
  background:#f8fafc;
}
@media(max-width:760px){
  .report-filter-form{
    grid-template-columns:1fr 1fr;
  }
}
@media(max-width:480px){
  .report-filter-form{
    grid-template-columns:1fr;
  }
}


/* Purchase bill import */
.purchase-import-table{
  min-width:980px;
}
.purchase-import-table input{
  min-width:90px;
}
.purchase-import-table td:first-child input{
  min-width:240px;
}
.whatsapp-share-card .actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}


/* ============================================================
   TBSI MOBILE UI REBUILD
   Compact off-canvas navigation + small-screen card/table rules
   ============================================================ */
.mobile-app-menu-toggle,
.mobile-nav-backdrop{
  display:none;
}

@media(max-width:760px){
  html,body{
    width:100%;
    max-width:100%;
    overflow-x:hidden;
  }

  body{
    background:#f5f7fb;
  }

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

  .sidebar{
    position:fixed!important;
    z-index:10020;
    inset:0 auto 0 0!important;
    width:min(86vw,310px)!important;
    height:100dvh!important;
    overflow-y:auto;
    transform:translateX(-105%);
    transition:transform .22s ease;
    padding:18px 14px 24px!important;
    border-right:1px solid #e5eaf1;
    box-shadow:18px 0 45px rgba(15,23,42,.16);
    background:#fff;
  }

  body.mobile-nav-open .sidebar{
    transform:translateX(0);
  }

  .mobile-nav-backdrop{
    position:fixed;
    z-index:10010;
    inset:0;
    width:100%;
    height:100%;
    border:0;
    padding:0;
    background:rgba(15,23,42,.48);
    backdrop-filter:blur(2px);
  }

  body.mobile-nav-open .mobile-nav-backdrop{
    display:block;
  }

  .sidebar .brand{
    padding:4px 4px 14px;
  }

  .sidebar .app-brand-logo{
    width:58px!important;
    height:58px!important;
  }

  .sidebar .brand-copy strong{
    font-size:20px;
  }

  .sidebar .firm-card{
    margin:4px 0 12px;
    padding:12px;
    border-radius:13px;
  }

  .sidebar nav{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:5px!important;
  }

  .sidebar nav a{
    min-width:0;
    padding:11px 12px!important;
    border-radius:10px;
    font-size:14px;
  }

  .main,
  .editor-mode .main,
  .editor-mode.sidebar-open .main,
  .editor-mode.sidebar-hidden .main{
    margin-left:0!important;
    width:100%!important;
    max-width:100%!important;
    padding:12px!important;
  }

  .topbar{
    position:sticky;
    top:0;
    z-index:9000;
    display:flex;
    align-items:center;
    gap:10px;
    min-height:64px;
    margin:-12px -12px 14px!important;
    padding:10px 12px!important;
    background:rgba(255,255,255,.96);
    border-bottom:1px solid #e6ebf2;
    backdrop-filter:blur(10px);
  }

  .mobile-app-menu-toggle{
    display:grid;
    place-items:center;
    flex:0 0 42px;
    width:42px;
    height:42px;
    border:1px solid #dbe3ee;
    border-radius:12px;
    background:#fff;
    color:#172033;
    font-size:24px;
    line-height:1;
    box-shadow:0 4px 14px rgba(15,23,42,.06);
  }

  .topbar-title-wrap{
    min-width:0;
    flex:1;
    gap:8px!important;
  }

  .topbar h1{
    margin:0;
    max-width:100%;
    font-size:18px!important;
    line-height:1.2;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .topbar p{
    margin:2px 0 0;
    font-size:11px!important;
  }

  .avatar{
    flex:0 0 38px;
    width:38px!important;
    height:38px!important;
  }

  .grid,
  .form-grid,
  .premium-feature-grid,
  .premium-payment-grid,
  .guide-grid{
    grid-template-columns:1fr!important;
  }

  .card,
  .hero,
  .guide-hero,
  .guide-card,
  .premium-feature-card{
    max-width:100%;
    overflow:hidden;
    padding:15px!important;
    border-radius:15px!important;
  }

  .card h2,.card h3,.hero h2{
    overflow-wrap:anywhere;
  }

  .actions{
    display:flex;
    flex-wrap:wrap;
    gap:8px!important;
  }

  .actions .btn,
  .actions button,
  .actions a.btn{
    max-width:100%;
  }

  .form-grid .field,
  .field{
    min-width:0;
    width:100%;
  }

  input,
  select,
  textarea,
  button{
    max-width:100%;
  }

  input,
  select,
  textarea{
    width:100%;
    min-height:44px;
    font-size:16px!important; /* prevents iOS zoom */
  }

  textarea{
    min-height:90px;
  }

  .table-wrap{
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
    border-radius:12px;
  }

  .table{
    min-width:620px;
  }

  .table th,
  .table td{
    padding:10px 9px!important;
    font-size:12px!important;
    white-space:nowrap;
  }

  .report-filter-form{
    gap:10px!important;
  }

  .report-filter-form .actions .btn{
    flex:1 1 120px;
  }

  .purchase-import-table{
    min-width:1050px!important;
  }

  .purchase-import-table input,
  .purchase-import-table select{
    min-width:90px;
    font-size:13px!important;
  }

  .partner-gst-search .gst-search-row{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }

  .premium-price-box{
    width:100%;
    align-items:flex-start!important;
  }

  .settings-image-preview{
    max-width:100%!important;
    height:auto!important;
  }

  .editor-menu-toggle{
    display:none!important;
  }
}

@media(max-width:480px){
  .main{
    padding:10px!important;
  }

  .topbar{
    margin:-10px -10px 12px!important;
    padding:9px 10px!important;
  }

  .topbar h1{
    font-size:16px!important;
  }

  .card,
  .hero,
  .guide-hero,
  .guide-card,
  .premium-feature-card{
    padding:13px!important;
    border-radius:13px!important;
  }

  .btn{
    min-height:42px;
    padding:10px 12px!important;
    font-size:13px!important;
  }

  .actions.mobile-stack,
  .premium-payment-details .actions{
    flex-direction:column;
  }

  .actions.mobile-stack .btn,
  .premium-payment-details .actions .btn{
    width:100%;
  }
}


/* FINAL: bill/quotation editor desktop sidebar auto-hide */
@media(min-width:761px){
  body.editor-mode.sidebar-hidden #appSidebar{
    transform:translateX(-110%)!important;
    visibility:hidden!important;
    pointer-events:none!important;
    box-shadow:none!important;
  }

  body.editor-mode.sidebar-hidden .main{
    margin-left:0!important;
    width:100%!important;
    max-width:100%!important;
  }

  body.editor-mode.sidebar-open #appSidebar{
    transform:translateX(0)!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }

  body.editor-mode.sidebar-open .main{
    margin-left:255px!important;
    width:calc(100% - 255px)!important;
  }
}

@media(min-width:761px) and (max-width:1000px){
  body.editor-mode.sidebar-open .main{
    margin-left:220px!important;
    width:calc(100% - 220px)!important;
  }
}


/* ============================================================
   GLOBAL SIDEBAR SHOW / HIDE
   One View Menu / Hide Menu control across the complete software.
   ============================================================ */
.sidebar-toggle{
  flex:0 0 auto;
  min-height:40px;
  padding:9px 13px;
  border:1px solid #d9e0e9;
  border-radius:10px;
  background:#fff;
  color:#334155;
  font:inherit;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}
.sidebar-toggle:hover{
  background:#f3f6fa;
}

@media(min-width:761px){
  body.app-sidebar-hidden .sidebar{
    transform:translateX(-110%)!important;
    visibility:hidden!important;
    pointer-events:none!important;
    box-shadow:none!important;
  }

  body.app-sidebar-hidden .main{
    margin-left:0!important;
    width:100%!important;
    max-width:100%!important;
  }

  .sidebar{
    transition:transform .2s ease,visibility .2s ease!important;
  }

  .main{
    transition:margin-left .2s ease,width .2s ease!important;
  }

  .sidebar-toggle{
    display:inline-flex!important;
    align-items:center;
    justify-content:center;
  }
}

@media(max-width:760px){
  .sidebar-toggle{
    display:inline-flex!important;
    align-items:center;
    justify-content:center;
    min-width:82px;
    min-height:40px;
    padding:8px 11px;
    font-size:11px;
  }

  body:not(.mobile-nav-open) .sidebar{
    transform:translateX(-105%)!important;
  }

  body.mobile-nav-open .sidebar{
    transform:translateX(0)!important;
  }
}





/* FINAL RECHECK: mobile sidebar uses fixed layout rows so Logout cannot overlap navigation */
@media(max-width:760px){
  #appSidebar{
    display:grid!important;
    grid-template-rows:auto auto minmax(0,1fr) auto!important;
    grid-template-columns:minmax(0,1fr)!important;
    align-content:stretch!important;
    overflow:hidden!important;
    height:100dvh!important;
    max-height:100dvh!important;
    padding:18px 14px 12px!important;
  }

  #appSidebar .brand{
    grid-row:1!important;
    min-width:0!important;
    margin-bottom:12px!important;
  }

  #appSidebar .firm-card{
    grid-row:2!important;
    min-width:0!important;
    margin-bottom:10px!important;
  }

  #appSidebar nav{
    grid-row:3!important;
    display:flex!important;
    flex-direction:column!important;
    min-width:0!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    gap:5px!important;
    padding:0 0 18px!important;
    margin:0!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }

  #appSidebar nav a{
    flex:0 0 auto!important;
  }

  #appSidebar .logout{
    grid-row:4!important;
    position:relative!important;
    inset:auto!important;
    display:block!important;
    width:100%!important;
    min-height:44px!important;
    margin:0!important;
    padding:12px!important;
    border-top:1px solid #e5e7eb!important;
    background:#fff!important;
    z-index:5!important;
  }
}


/* Bill / quotation user education */
.invoice-help-box{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin-top:8px;
  padding:10px 12px;
  border:1px solid #dbe7f7;
  border-radius:10px;
  background:#f7faff;
  color:#475467;
  font-size:11px;
  line-height:1.5;
}
.invoice-help-box strong{color:#1d2939;font-size:12px}
.invoice-help-box a,
.invoice-section-heading a{color:var(--primary);font-weight:750;text-decoration:underline}
.invoice-help-products{margin:12px 0 0}
.invoice-section-heading{margin-top:20px}
.invoice-section-heading h3{margin:0 0 5px}
.invoice-section-heading p{margin:0 0 10px;color:var(--muted);font-size:11px;line-height:1.55}

/* First-time guided tour */
.software-tour[hidden]{display:none!important}
.software-tour{position:fixed;inset:0;z-index:30000}
.software-tour-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.58)}
.software-tour-dialog{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translateX(-50%);
  z-index:30002;
  width:min(520px,calc(100% - 28px));
  padding:20px;
  border:1px solid #d9e2ef;
  border-radius:16px;
  background:#fff;
  box-shadow:0 24px 70px rgba(15,23,42,.28)
}
.software-tour-progress{margin-bottom:8px;color:#667085;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.06em}
.software-tour-dialog h3{margin:0 0 8px;font-size:18px}
.software-tour-dialog p{margin:0;color:#475467;font-size:12px;line-height:1.65}
.software-tour-actions{display:flex;justify-content:space-between;gap:10px;margin-top:18px}
.software-tour-next-actions{display:flex;gap:8px}
.software-tour-highlight{
  position:relative!important;
  z-index:30001!important;
  border-radius:12px!important;
  box-shadow:0 0 0 4px #84adff,0 10px 30px rgba(15,23,42,.2)!important;
  background:#fff!important
}
@media(max-width:760px){
  .software-tour-dialog{bottom:12px;padding:16px}
  .software-tour-actions{display:grid;grid-template-columns:1fr;gap:8px}
  .software-tour-next-actions{display:grid;grid-template-columns:1fr 1fr}
  .software-tour-actions>.btn{width:100%}
  .software-tour-next-actions .btn{width:100%}
}


/* Stock Request acceptance pricing review */
.stock-review-head,
.stock-request-intro,
.stock-review-footer{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}
.stock-review-head h3,
.stock-request-intro h3{margin:0 0 5px}
.stock-accept-review{margin-bottom:18px}
.stock-pricing-table{min-width:980px}
.stock-pricing-table input{
  width:120px;
  min-height:40px;
  border:1px solid #d0d5dd;
  border-radius:9px;
  padding:8px 9px;
  font:inherit;
}
.stock-pricing-table input:focus{
  border-color:#84adff;
  box-shadow:0 0 0 3px #eff4ff;
  outline:none;
}
.stock-review-footer{
  align-items:center;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--line);
}
.stock-review-footer .hint{max-width:760px;margin:0}
@media(max-width:760px){
  .stock-review-head,
  .stock-review-footer{
    display:grid;
    grid-template-columns:1fr;
  }
  .stock-review-head .btn,
  .stock-review-footer .btn{
    width:100%;
  }
  .stock-pricing-table{min-width:900px}
}
