/* Shared UI consistency layer
   - unified font family across the working UI
   - warehouse contrast corrections for light theme surfaces
*/

:root{
  --ksp-ui-font:"Segoe UI",system-ui,-apple-system,Arial,sans-serif;
  --ksp-ui-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
}

html{
  font-family:var(--ksp-ui-font);
}

body,
button,
input,
select,
textarea,
optgroup,
option,
table,
thead,
tbody,
tfoot,
tr,
th,
td{
  font-family:var(--ksp-ui-font) !important;
}

.mono,
code,
pre,
kbd,
samp{
  font-family:var(--ksp-ui-font-mono) !important;
}

body{
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
}

/* Keep placeholders and auxiliary text visually consistent */
::placeholder{
  font-family:inherit;
}

/* Warehouse light-theme contrast fixes */
body.warehousePage .foldercard,
body.warehousePage .itemcard,
body.warehousePage .doccard,
body.warehousePage .qpPanel,
body.warehousePage .qpCard,
body.warehousePage .fabMenu{
  background:#ffffff !important;
  border:1px solid var(--border) !important;
  box-shadow:var(--shadow) !important;
  color:var(--text) !important;
}

body.warehousePage .foldercard:hover,
body.warehousePage .itemcard:hover,
body.warehousePage .doccard:hover,
body.warehousePage .qpCard:hover{
  background:#f8fafc !important;
  border-color:#c7d2e0 !important;
}

body.warehousePage .foldercard--low,
body.warehousePage .itemcard--low{
  border-color:rgba(245,158,11,.42) !important;
}

body.warehousePage .foldercard--neg,
body.warehousePage .itemcard--neg,
body.warehousePage .doccard--unpaid{
  border-color:rgba(220,38,38,.30) !important;
}

body.warehousePage .doccard--paid{
  border-color:rgba(16,185,129,.32) !important;
}

body.warehousePage .doccard--partial{
  border-color:rgba(245,158,11,.34) !important;
}

body.warehousePage .foldercard__media,
body.warehousePage .itemcard__media,
body.warehousePage .thumb,
body.warehousePage .itemcard__thumb{
  background:#f8fafc !important;
  border:1px solid #e2e8f0 !important;
  color:var(--muted) !important;
}

body.warehousePage .itemcard__media--empty{
  color:#98a2b3 !important;
}

body.warehousePage .itemcard__title,
body.warehousePage .itemcard__qty,
body.warehousePage .itemcard__cost,
body.warehousePage .itemcard__desc,
body.warehousePage .doccard__num,
body.warehousePage .doccard__qty,
body.warehousePage .doccard__sum,
body.warehousePage .doccard__c1r1,
body.warehousePage .doccard__c1r2,
body.warehousePage .doccard__c1r3,
body.warehousePage .doccard__c1r4,
body.warehousePage .doccard__c2r1,
body.warehousePage .doccard__c2r2,
body.warehousePage .doccard__c2r3,
body.warehousePage .doccard__c2r4,
body.warehousePage .qpFolderName,
body.warehousePage .qpItemName,
body.warehousePage .qpDialogTitle{
  color:var(--text) !important;
}

body.warehousePage .itemcard__purchase,
body.warehousePage .itemcard__cost .pricetag,
body.warehousePage .itemcard__purchase .pricetag,
body.warehousePage .itemcard__sale .pricetag,
body.warehousePage .pricetag,
body.warehousePage .qpItemMeta,
body.warehousePage .doccard .muted,
body.warehousePage .qpSep{
  color:var(--muted) !important;
  opacity:1 !important;
}

body.warehousePage .itemcard__sku{
  color:#1d4ed8 !important;
}

body.warehousePage .itemcard__sale{
  color:#b45309 !important;
}

body.warehousePage .qty--ok{
  color:#166534 !important;
}

body.warehousePage .qty--low{
  color:#92400e !important;
}

body.warehousePage .qty--neg{
  color:#b91c1c !important;
}

body.warehousePage .docstat{
  background:#f8fafc !important;
  border:1px solid #e2e8f0 !important;
  color:var(--muted) !important;
}

body.warehousePage .docstat.is-on{
  background:#eef4ff !important;
  border-color:#bfd4f6 !important;
  color:#1d4ed8 !important;
}

body.warehousePage .qpHead{
  background:#fbfcfe !important;
  border-bottom:1px solid #e9eef5 !important;
}

body.warehousePage .qpDialog{
  background:#ffffff !important;
  border-top:1px solid #e9eef5 !important;
}

body.warehousePage .fabMenu__item{
  color:var(--text) !important;
}

body.warehousePage .fabMenu__item:hover{
  background:#f8fafc !important;
}

body.warehousePage .fabMenu{
  box-shadow:0 18px 45px rgba(15,23,42,.14) !important;
}

/* Ensure light cards stay readable even when legacy JS injects generic muted wrappers */
body.warehousePage .foldercard *,
body.warehousePage .itemcard *,
body.warehousePage .doccard *,
body.warehousePage .qpPanel *{
  text-shadow:none;
}

/* Warehouse documents: full-width one-card-per-row list layout */
body.warehousePage #docsCards.doccards{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) !important;
  gap:10px !important;
  width:100% !important;
}

body.warehousePage #docsCards .doccard--list{
  width:100% !important;
  padding:14px 16px !important;
  border-radius:10px !important;
  cursor:pointer;
  transition:border-color .15s ease, box-shadow .15s ease, transform .15s ease, background .15s ease;
}

body.warehousePage #docsCards .doccard--list:hover{
  transform:translateY(-1px);
  box-shadow:0 14px 32px rgba(15,23,42,.085) !important;
}

body.warehousePage #docsCards .doccard__layout{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(190px,240px);
  gap:18px;
  align-items:start;
}

body.warehousePage #docsCards .doccard__main{
  min-width:0;
}

body.warehousePage #docsCards .doccard__topline{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:8px;
}

body.warehousePage #docsCards .doccard__type,
body.warehousePage #docsCards .doccard__payment{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:4px 9px;
  border-radius:8px;
  border:1px solid #d7dee8;
  background:#f8fafc;
  color:#334155 !important;
  font-size:12px;
  font-weight:800;
  letter-spacing:.01em;
  line-height:1;
}

body.warehousePage #docsCards .doccard__type--in{
  background:rgba(16,185,129,.09);
  border-color:rgba(16,185,129,.26);
  color:#047857 !important;
}
body.warehousePage #docsCards .doccard__type--out{
  background:rgba(31,122,224,.09);
  border-color:rgba(31,122,224,.24);
  color:#1d4ed8 !important;
}
body.warehousePage #docsCards .doccard__type--req{
  background:rgba(245,158,11,.10);
  border-color:rgba(245,158,11,.28);
  color:#92400e !important;
}
body.warehousePage #docsCards .doccard__type--trf{
  background:rgba(99,102,241,.09);
  border-color:rgba(99,102,241,.24);
  color:#4338ca !important;
}
body.warehousePage #docsCards .doccard__payment--unpaid{
  background:rgba(220,38,38,.08);
  border-color:rgba(220,38,38,.22);
  color:#991b1b !important;
}
body.warehousePage #docsCards .doccard__payment--partial{
  background:rgba(245,158,11,.10);
  border-color:rgba(245,158,11,.28);
  color:#92400e !important;
}
body.warehousePage #docsCards .doccard__payment--paid{
  background:rgba(16,185,129,.09);
  border-color:rgba(16,185,129,.26);
  color:#047857 !important;
}

body.warehousePage #docsCards .doccard__date{
  color:var(--muted) !important;
  font-size:13px;
  font-weight:700;
}

body.warehousePage #docsCards .doccard__identity{
  display:flex;
  align-items:baseline;
  gap:14px;
  min-width:0;
  margin-bottom:8px;
}

body.warehousePage #docsCards .doccard__num{
  color:var(--text) !important;
  font-size:18px !important;
  font-weight:900 !important;
  line-height:1.2;
  white-space:nowrap;
}

body.warehousePage #docsCards .doccard__party{
  min-width:0;
  color:var(--text) !important;
  font-size:15px;
  font-weight:700;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

body.warehousePage #docsCards .doccard__party span{
  color:var(--muted) !important;
  font-weight:700;
}

body.warehousePage #docsCards .doccard__metaRow{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  color:var(--muted) !important;
  font-size:13px;
  line-height:1.45;
}

body.warehousePage #docsCards .doccard__metaRow b{
  color:#475467 !important;
  font-weight:800;
}

body.warehousePage #docsCards .doccard__note{
  margin-top:9px;
  padding:8px 10px;
  border:1px solid #e9eef5;
  border-radius:8px;
  background:#fbfcfe;
  color:#475467 !important;
  font-size:13px;
  line-height:1.45;
  overflow-wrap:anywhere;
}

body.warehousePage #docsCards .doccard__metrics{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  min-width:0;
}

body.warehousePage #docsCards .doccard__metric{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-height:44px;
  padding:8px 10px;
  border:1px solid #e9eef5;
  border-radius:8px;
  background:#fbfcfe;
}

body.warehousePage #docsCards .doccard__metric span{
  color:var(--muted) !important;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.02em;
}

body.warehousePage #docsCards .doccard__qty,
body.warehousePage #docsCards .doccard__sum{
  color:var(--text) !important;
  font-size:16px !important;
  font-weight:900 !important;
  text-align:right !important;
  white-space:nowrap;
}

body.warehousePage #docsCards .doccard__metric--sum{
  background:#f8fafc;
}

body.warehousePage #docsCards .doccard__footer{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) auto !important;
  align-items:center !important;
  gap:12px !important;
  margin-top:12px !important;
  padding-top:12px;
  border-top:1px solid #edf2f7;
}

body.warehousePage #docsCards .doccard__stats{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
}

body.warehousePage #docsCards .docstat{
  min-width:30px;
  min-height:30px;
  border-radius:8px !important;
}

body.warehousePage #docsCards .doccard__actions{
  display:flex !important;
  gap:7px !important;
  justify-self:end !important;
  flex-wrap:wrap;
}

body.warehousePage #docsCards .doccard__actions .btn{
  min-height:32px;
}

@media (max-width: 900px){
  body.warehousePage #docsCards .doccard__layout{
    grid-template-columns:minmax(0,1fr);
  }
  body.warehousePage #docsCards .doccard__metrics{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  body.warehousePage #docsCards .doccard__footer{
    grid-template-columns:minmax(0,1fr) !important;
  }
  body.warehousePage #docsCards .doccard__actions{
    justify-self:start !important;
  }
}

@media (max-width: 620px){
  body.warehousePage #docsCards .doccard__identity{
    display:block;
  }
  body.warehousePage #docsCards .doccard__party{
    margin-top:6px;
    white-space:normal;
  }
  body.warehousePage #docsCards .doccard__metrics{
    grid-template-columns:minmax(0,1fr);
  }
}
