
/* =========================================================
   STOCK SHEET UI
   Styled around the supplied HTML/JS structure.
========================================================= */

:root{
  --primary:#ed687b;
  --secondary:#f6a05d;
  --primary-dark:#d9576c;
  --text:#202124;
  --muted:#777b84;
  --border:#e7e8ec;
  --surface:#fff;
  --bg:#f6f7f9;
  --soft:#fff7f8;
  --green:#28a36a;
  --red:#df5264;
  --amber:#d47a24;
  --shadow:0 10px 35px rgba(31,34,42,.07);
  --radius:16px;
}

*{box-sizing:border-box}

html,body{margin:0;padding:0}

body{
  min-height:100vh;
  background:
    radial-gradient(circle at 85% 0%,rgba(246,160,93,.09),transparent 28rem),
    var(--bg);
  color:var(--text);
  font-family:"Manrope",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:13px;
}

button,input,select,textarea{font:inherit}

button{cursor:pointer}

.hidden{display:none!important}

/* ---------- APP / HEADER ---------- */

.app{
  width:min(1480px,calc(100% - 40px));
  margin:0 auto;
  padding-bottom:110px;
}

.top{
  position:sticky;
  top:0;
  z-index:30;
  margin:0 -20px;
  padding:22px 20px 16px;
  background:rgba(246,247,249,.92);
  backdrop-filter:blur(14px);
  border-bottom:1px solid rgba(231,232,236,.75);
}

.top-row{
  display:flex;
  align-items:center;
  gap:9px;
}

.top h1{
  flex:1;
  margin:0;
  font-size:24px;
  line-height:1.2;
  letter-spacing:-.45px;
  font-weight:700;
}

.top h1 small{
  display:block;
  margin-top:5px;
  color:var(--muted);
  font-size:10px;
  font-weight:500;
  letter-spacing:.1px;
}

.icon-btn{
  position:relative;
  width:39px;
  height:39px;
  border:1px solid var(--border);
  border-radius:11px;
  background:var(--surface);
  color:#555962;
  display:grid;
  place-items:center;
  box-shadow:0 3px 12px rgba(31,34,42,.04);
  transition:.2s ease;
}

.icon-btn:hover{
  color:var(--primary);
  border-color:#f2c3ca;
  transform:translateY(-1px);
}

.badge{
  position:absolute;
  top:-5px;
  right:-5px;
  min-width:17px;
  height:17px;
  padding:0 4px;
  display:none;
  align-items:center;
  justify-content:center;
  border-radius:99px;
  background:var(--primary);
  color:#fff;
  font-size:9px;
  font-weight:800;
}

.search{
  margin-top:13px;
}

.search input{
  width:100%;
  height:43px;
  border:1px solid var(--border);
  outline:none;
  border-radius:11px;
  padding:0 14px;
  background:#fff;
  color:var(--text);
  box-shadow:0 4px 16px rgba(31,34,42,.035);
  transition:.2s ease;
}

.search input::placeholder{color:#a0a3aa}

.search input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(237,104,123,.08);
}

/* ---------- MENU ---------- */

.menu{
  position:fixed;
  top:80px;
  right:max(20px,calc((100vw - 1480px)/2 + 20px));
  z-index:80;
  width:235px;
  padding:7px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:13px;
  box-shadow:0 18px 45px rgba(31,34,42,.15);
  display:none;
}

.menu.open{display:block}

.menu button{
  width:100%;
  padding:10px 11px;
  border:0;
  border-radius:8px;
  background:transparent;
  color:#44474f;
  text-align:left;
  font-size:11px;
  font-weight:700;
}

.menu button:hover{
  background:#fff4f5;
  color:var(--primary);
}

.menu button[data-act="clear"]{
  color:var(--red);
}

/* ---------- SORT BAR ---------- */

.bar{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:18px;
}

.bar select{
  flex:1;
  min-width:0;
}

select,
.range input,
.fgrid input,
.fgrid select{
  height:39px;
  border:1px solid var(--border);
  border-radius:9px;
  outline:none;
  background:#fff;
  color:#41444b;
  padding:0 10px;
  font-size:11px;
  font-weight:500;
}

select:focus,
input:focus,
textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(237,104,123,.08);
}

.btn{
  min-height:39px;
  padding:0 12px;
  border:1px solid var(--border);
  border-radius:9px;
  background:#fff;
  color:#5d6068;
  font-size:10px;
  font-weight:600;
  transition:.2s ease;
}

.btn:hover{
  border-color:#f0bdc5;
  color:var(--primary);
  background:#fffafb;
}

.btn.primary{
  border-color:transparent;
  color:#fff;
  background:linear-gradient(135deg,var(--primary),var(--secondary));
}

.btn.danger{
  color:var(--red);
  background:#fff1f3;
  border-color:#ffd8de;
}

/* ---------- FILTERS ---------- */

#filters{
  display:none;
  margin-top:12px;
  padding:16px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  box-shadow:var(--shadow);
}

#filters.open{display:block}

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

.fgrid>div{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.fgrid label{
  color:#5d6068;
  font-size:9px;
  font-weight:800;
}

.fgrid .span2{grid-column:span 2}

.range{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px;
}

.frow-actions{
  margin-top:13px;
  display:flex;
  justify-content:flex-end;
}

/* ---------- COUNT ---------- */

.count{
  margin:18px 2px 10px;
  color:var(--muted);
  font-size:11px;
  font-weight:700;
}

/* ---------- CARDS ---------- */

#list{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}

.card{
  width:100%;
  min-width:0;
  padding:17px;
  border:1px solid var(--border);
  border-radius:15px;
  background:#fff;
  text-align:left;
  color:var(--text);
  box-shadow:0 7px 24px rgba(31,34,42,.05);
  transition:.23s ease;
}

.card:hover{
  border-color:#f1c1c8;
  transform:translateY(-2px);
  box-shadow:0 14px 34px rgba(31,34,42,.09);
}

.c-head{
  display:flex;
  align-items:center;
  gap:6px;
  min-height:25px;
}

.sn{
  color:#8c9098;
  font-size:10px;
  font-weight:600;
}

.tag,.kind,.price{
  display:inline-flex;
  align-items:center;
  min-height:22px;
  padding:0 7px;
  border-radius:6px;
  font-size:9px;
  font-weight:600;
}

.tag.Sale{
  color:#b84e60;
  background:#fff0f2;
}

.tag.Rent{
  color:#ad6b25;
  background:#fff5e8;
}

.kind{
  color:#59606a;
  background:#f2f3f5;
}

.tag.av{
  color:var(--green);
  background:#edf9f3;
}

.tag.na{
  color:var(--red);
  background:#fff0f2;
}

.price{
  margin-left:auto;
  color:#25282e;
  background:#f7f7f8;
  font-size:10px;
}

.proj{
  margin-top:13px;
  font-size:15px;
  font-weight:700;
  line-height:1.3;
  letter-spacing:-.15px;
}

.no{
  color:#9a9da4;
  font-weight:600;
}

.cust{
  margin-top:9px;
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  align-items:center;
}

.cust b{
  font-size:10px;
  font-weight:500;
}

.cust span{
  color:var(--muted);
  font-size:10px;
}

.where{
  margin-top:8px;
  color:#62666e;
  font-size:10px;
  font-weight:600;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  margin-top:12px;
}

.chip{
  padding:5px 7px;
  border-radius:6px;
  color:#646870;
  background:#f5f6f7;
  font-size:9px;
  font-weight:500;
}

.flags{
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  margin-top:11px;
}

.flags span{
  padding:5px 7px;
  border-radius:6px;
  background:#f5f6f7;
  color:#646870;
  font-size:9px;
  font-weight:500;
}

.flags .yes{
  color:var(--green);
  background:#edf9f3;
}

.flags .alert{
  color:#c45f20;
  background:#fff4e8;
}

.flags .no{
  color:#858990;
  background:#f5f6f7;
}

.note{
  margin-top:11px;
  padding-top:10px;
  border-top:1px dashed #e6e7ea;
  color:#737780;
  font-size:10px;
  line-height:1.55;
}

/* ---------- TABLE ---------- */

.tablewrap{
  overflow:auto;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  box-shadow:var(--shadow);
  -webkit-overflow-scrolling:touch;
}

table{
  width:100%;
  min-width:1650px;
  border-collapse:collapse;
  table-layout:auto;
}

th{
  position:sticky;
  top:0;
  z-index:2;
  padding:12px 13px;
  text-align:left;
  white-space:nowrap;
  background:#fafafa;
  color:#565a62;
  border-bottom:1px solid var(--border);
  font-size:9px;
  font-weight:800;
  cursor:pointer;
}

th.sorted{color:var(--primary)}

td{
  padding:12px 13px;
  color:#3f4249;
  border-bottom:1px solid #f0f1f3;
  font-size:9px;
  font-weight:600;
  white-space:nowrap;
  max-width:260px;
  overflow:hidden;
  text-overflow:ellipsis;
}

tbody tr:hover{background:#fffafb}

/* ---------- EMPTY ---------- */

.empty{
  min-height:230px;
  padding:35px 15px;
  border:1px dashed #dfe1e5;
  border-radius:14px;
  background:#fff;
  text-align:center;
  color:var(--muted);
  font-size:11px;
  line-height:1.5;
}

.empty .btn{margin-top:5px}

/* ---------- FAB ---------- */

.fab{
  position:fixed;
  right:28px;
  bottom:25px;
  z-index:40;
  min-height:46px;
  padding:0 17px;
  border:0;
  border-radius:13px;
  color:#fff;
  background:linear-gradient(135deg,var(--primary),var(--secondary));
  box-shadow:0 13px 30px rgba(237,104,123,.28);
  font-size:11px;
  font-weight:600;
  transition:.22s ease;
}

.fab:hover{
  transform:translateY(-2px);
  box-shadow:0 17px 35px rgba(237,104,123,.34);
}

/* ---------- FORM SHEET ---------- */

.overlay{
  position:fixed;
  inset:0;
  z-index:100;
  display:none;
  align-items:flex-end;
  justify-content:center;
  background:rgba(20,21,25,.5);
  backdrop-filter:blur(5px);
}

.overlay.open{display:flex}

.sheet{
  width:min(920px,100%);
  max-height:min(90vh,900px);
  display:flex;
  flex-direction:column;
  background:#fff;
  border-radius:20px 20px 0 0;
  box-shadow:0 -18px 60px rgba(0,0,0,.17);
  animation:sheetIn .22s ease;
}

@keyframes sheetIn{
  from{transform:translateY(30px);opacity:.5}
  to{transform:translateY(0);opacity:1}
}

.sheet-head{
  flex-shrink:0;
  min-height:67px;
  padding:14px 19px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border);
}

.sheet-head h2{
  margin:0;
  font-size:17px;
  font-weight:800;
}

.sheet-body{
  overflow:auto;
  padding:18px 20px 25px;
}

fieldset{
  margin:0 0 16px;
  padding:13px;
  border:1px solid var(--border);
  border-radius:13px;
}

legend{
  padding:0 6px;
  color:#777b84;
  font-size:9px;
  font-weight:800;
  letter-spacing:.5px;
  text-transform:uppercase;
}

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

.fld{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.fld.full{grid-column:1/-1}

.fld>label{
  color:#4d5159;
  font-size:9px;
  font-weight:800;
}

.fld input,.fld textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:9px;
  outline:0;
  padding:10px;
  background:#fff;
  color:var(--text);
  font-size:11px;
}

.fld textarea{
  min-height:90px;
  resize:vertical;
}

.seg{
  min-height:39px;
  display:flex;
  gap:6px;
}

.seg label{
  flex:1;
  position:relative;
}

.seg input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.seg label span{
  height:39px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  border-radius:9px;
  color:#777b84;
  background:#fff;
  font-size:10px;
  font-weight:600;
  transition:.2s ease;
}

.seg input:checked + span{
  color:var(--primary);
  border-color:#f0bcc4;
  background:#fff4f5;
}

.hint{
  min-height:13px;
  color:#8c9098;
  font-size:9px;
}

.hint a{
  color:var(--primary);
  text-decoration:none;
  font-weight:800;
}

.sheet-foot{
  flex-shrink:0;
  padding:12px 20px;
  display:flex;
  justify-content:flex-end;
  gap:8px;
  border-top:1px solid var(--border);
  background:#fff;
}

/* ---------- TOAST ---------- */

.toast{
  position:fixed;
  left:50%;
  bottom:82px;
  z-index:300;
  transform:translateX(-50%);
  display:none;
  padding:10px 14px;
  border-radius:10px;
  background:#202124;
  color:#fff;
  box-shadow:0 10px 25px rgba(0,0,0,.18);
  font-size:10px;
  font-weight:700;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width:1100px){
  #list{grid-template-columns:repeat(2,minmax(0,1fr))}
  .fgrid{grid-template-columns:repeat(3,minmax(0,1fr))}
}

@media (max-width:700px){
  .app{
    width:calc(100% - 20px);
    padding-bottom:90px;
  }

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

  .top h1{font-size:21px}

  .bar{
    display:grid;
    grid-template-columns:1fr auto;
  }

  .bar select{grid-column:1/-1}

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

  .fgrid .span2{grid-column:1/-1}

  #list{grid-template-columns:1fr}

  .fab{
    right:15px;
    bottom:15px;
  }

  .sheet{
    max-height:94vh;
    border-radius:17px 17px 0 0;
  }

  .sheet-body{
    padding:14px 14px 22px;
  }

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

  .fld.full{grid-column:auto}

  .seg{width:100%}

  .sheet-foot{
    padding:11px 14px;
  }

  .sheet-foot .btn{
    flex:1;
  }

  .toast{
    bottom:72px;
    width:max-content;
    max-width:calc(100% - 30px);
  }
}

@media (max-width:430px){
  .fgrid{grid-template-columns:1fr}

  .fgrid .span2{grid-column:auto}

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

  .top-row .icon-btn{
    width:36px;
    height:36px;
  }

  .menu{
    right:10px;
    top:70px;
  }
}


/* =========================================================
   TYPOGRAPHY REFINEMENT
   Softer weights and slightly larger supporting text.
========================================================= */

body{
  font-size:13px;
  font-weight:400;
  letter-spacing:0;
}

.top h1{
  font-size:24px;
  font-weight:700;
  letter-spacing:-.4px;
}

.top h1 small{
  font-size:10px;
  font-weight:500;
}

.search input{
  font-size:12px;
  font-weight:400;
}

.bar select,
select,
.range input,
.fgrid input,
.fgrid select{
  font-size:11px;
  font-weight:500;
}

.btn{
  font-size:10px;
  font-weight:600;
}

.count{
  font-size:11px;
  font-weight:500;
}

.card{
  padding:17px;
}

.sn{
  font-size:10px;
  font-weight:600;
}

.tag,
.kind,
.price{
  font-size:9px;
  font-weight:600;
}

.price{
  font-size:10px;
  font-weight:700;
}

.proj{
  font-size:15px;
  font-weight:700;
  line-height:1.3;
  letter-spacing:-.1px;
}

.cust b{
  font-size:10px;
  font-weight:600;
}

.cust span{
  font-size:10px;
  font-weight:400;
}

.where{
  font-size:10px;
  font-weight:500;
}

.chip{
  padding:5px 7px;
  font-size:9px;
  font-weight:500;
}

.flags span{
  padding:5px 7px;
  font-size:9px;
  font-weight:500;
}

.note{
  font-size:10px;
  font-weight:400;
  line-height:1.55;
}

@media (max-width:700px){
  .top h1{
    font-size:22px;
  }

  .proj{
    font-size:15px;
  }

  .chip,
  .flags span{
    font-size:9px;
  }
}
