.market-page{
  background:
    radial-gradient(circle at 10% 20%, rgba(108,99,255,.18), transparent 25%),
    radial-gradient(circle at 90% 10%, rgba(0,212,255,.15), transparent 20%),
    radial-gradient(circle at 80% 80%, rgba(255,78,205,.12), transparent 18%),
    var(--bg);
  color:var(--text);
}

body.light-theme.market-page{
  background:
    radial-gradient(circle at top left, rgba(108,99,255,0.15), transparent 30%),
    radial-gradient(circle at top right, rgba(0,212,255,0.18), transparent 25%),
    #f3f7ff;
  color:var(--text);
}

.market-page .header,
.quote-page .header{
  position:sticky;
}

.market-page .page-hero,
.quote-page .page-hero{
  padding:37px 0 26px;
  background:
    linear-gradient(135deg, rgba(13,24,48,0.96), rgba(8,49,62,0.94)),
    var(--bg-soft);
  border-bottom:1px solid rgba(255,255,255,0.12);
  color:#f8fbff;
}

.market-page .page-hero .container,
.quote-page .page-hero .container{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:24px;
}

.market-page .page-hero h1,
.quote-page .page-hero h1{
  font-family:'Manrope',sans-serif;
  font-size:clamp(2.1rem,4vw,4.4rem);
  line-height:1.05;
  margin:16px 0 8px;
}

.market-page .page-hero p,
.quote-page .page-hero p{
  color:#cfe1ff;
  max-width:720px;
}

.selected-top-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex:0 0 auto;
  min-height:48px;
  padding:12px 18px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background:linear-gradient(135deg,#0ea5e9,#22c55e);
  color:#fff;
  font-weight:900;
  box-shadow:0 18px 44px rgba(14,165,233,0.22);
}

.selected-top-btn span{
  display:inline-grid;
  place-items:center;
  min-width:28px;
  height:28px;
  padding:0 8px;
  border-radius:999px;
  background:#fff;
  color:#0f766e;
}

.selected-fab{
  position:fixed;
  right:clamp(16px,3vw,40px);
  bottom:clamp(16px,3vw,40px);
  z-index:1200;
  box-shadow:0 16px 40px rgba(0,0,0,0.40);
}

.market-shell{
  padding:32px 0 80px;
}

.market-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:22px;
  padding:16px;
  border-radius:8px;
  background:var(--bg-card);
  border:1px solid var(--line);
  box-shadow:var(--shadow);
}

.market-toolbar h2{
  font-size:1.35rem;
  line-height:1.2;
  color:var(--text);
}

.market-toolbar p{
  color:var(--text-muted);
  font-size:.92rem;
}

.market-search{
  position:relative;
  width:min(420px,100%);
}

.market-search i{
  position:absolute;
  left:16px;
  top:50%;
  transform:translateY(-50%);
  color:#64748b;
}

.market-search input,
.quote-field input,
.qty-control input{
  width:100%;
  border:1px solid var(--line);
  background:rgba(255,255,255,0.08);
  color:var(--text);
  border-radius:8px;
  outline:none;
  transition:border-color .2s ease, box-shadow .2s ease;
}

.market-search input{
  min-height:48px;
  padding:12px 52px 12px 44px;
}

.clear-search-btn{
  position:absolute;
  right:14px;
  top:50%;
  display:none;
  width:32px;
  height:32px;
  padding:0;
  place-items:center;
  transform:translateY(-50%);
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--text-muted);
  cursor:pointer;
  transition:color .2s ease;
}

.clear-search-btn i{
  display:block;
  font-size:14px;
  line-height:1;
}

.clear-search-btn.is-visible{
  display:grid;
}

.clear-search-btn:hover{
  color:var(--text);
}

.market-search input:focus,
.quote-field input:focus,
.qty-control input:focus{
  border-color:#0ea5e9;
  box-shadow:0 0 0 4px rgba(14,165,233,0.12);
}

.market-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(270px,1fr));
  gap:14px;
}

.product-card{
  overflow:hidden;
  border-radius:8px;
  background:var(--bg-card);
  border:1px solid var(--line);
  box-shadow:var(--shadow);
  transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.product-card:hover{
  transform:translateY(-3px);
  border-color:rgba(255,255,255,0.22);
  box-shadow:0 14px 34px rgba(0,0,0,0.18);
}

.product-media{
  position:relative;
  aspect-ratio:1.18;
  background:#eef2f7;
  overflow:hidden;
}

.product-media img{
  width:100%;
  height:100%;
  object-fit:cover;
  transition:transform .35s ease;
}

.product-card:hover .product-media img{
  transform:scale(1.04);
}

.availability{
  position:absolute;
  left:12px;
  bottom:12px;
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:7px 10px;
  border-radius:999px;
  background:rgba(255,255,255,0.92);
  color:#047857;
  font-size:.78rem;
  font-weight:900;
}

.availability::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:50%;
  background:#22c55e;
  box-shadow:0 0 0 4px rgba(34,197,94,0.15);
}

.product-body{
  padding:14px 16px 16px;
}

.product-body h3{
  min-height:44px;
  color:var(--text);
  font-size:1rem;
  line-height:1.35;
  margin-bottom:6px;
}

.product-body p{
  min-height:42px;
  color:var(--text-muted);
  font-size:.9rem;
  line-height:1.45;
}

.price-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:12px 0 14px;
}

.price{
  color:var(--text);
  font-size:1.25rem;
  font-weight:950;
  letter-spacing:0;
  white-space:nowrap;
}

.unit-chip{
  display:inline-flex;
  align-items:center;
  flex-shrink:0;
  white-space:nowrap;
  padding:6px 9px;
  border-radius:999px;
  background:rgba(255,255,255,0.09);
  color:var(--text-muted);
  font-size:.78rem;
  font-weight:800;
}

.select-product{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  border:1px solid var(--line);
  border-radius:8px;
  background:rgba(255,255,255,0.08);
  color:var(--text);
  font-weight:900;
  cursor:pointer;
  transition:background .2s ease, border-color .2s ease, color .2s ease;
}

.select-product:hover,
.select-product.is-selected{
  background:#7888ad;
  border-color:#0f172a;
  color:#fff;
}

.empty-market{
  grid-column:1/-1;
  padding:28px;
  border-radius:8px;
  background:var(--bg-card);
  color:var(--text-muted);
  text-align:center;
  border:1px dashed var(--line);
}

body.light-theme.market-page .market-toolbar,
body.light-theme.market-page .product-card,
body.light-theme.market-page .empty-market{
  background:rgba(255,255,255,0.92);
  border-color:rgba(15,23,42,0.08);
  box-shadow:0 18px 40px rgba(15,23,42,0.10);
}

body.light-theme.market-page .market-search input{
  background:#fff;
  border-color:#d9dee8;
  color:#111827;
}

body.light-theme.market-page .clear-search-btn{
  color:#475569;
}

body.light-theme.market-page .clear-search-btn:hover{
  color:#0f172a;
}

body.light-theme.market-page .product-card:hover{
  border-color:#c9d3e6;
  box-shadow:0 14px 34px rgba(15,23,42,0.12);
}

body.light-theme.market-page .unit-chip{
  background:#f1f5f9;
  color:#475569;
}

body.light-theme.market-page .select-product{
  background:#fff;
  border-color:#d1d9e6;
  color:#0f172a;
}

body.light-theme.market-page .select-product:hover,
body.light-theme.market-page .select-product.is-selected{
  background:#0f172a;
  border-color:#0f172a;
  color:#fff;
}

.quote-page{
  background:
    linear-gradient(135deg, rgba(8,17,32,0.98), rgba(9,38,49,0.98)),
    var(--bg);
  color:#f8fbff;
}

.quote-shell{
  padding:34px 0 86px;
}

.contact-note{
  margin:-8px 0 18px;
  color:var(--text-muted);
  font-size:.95rem;
}

.quote-field .req{
  color:#ff5470;
}

.quote-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) 360px;
  gap:22px;
  align-items:start;
}

.quote-panel{
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.07);
  border-radius:8px;
  padding:22px;
  box-shadow:var(--shadow);
}

.quote-panel h2{
  font-size:1.35rem;
  margin-bottom:16px;
}

.quote-inputs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  margin-bottom:22px;
}

.quote-field label,
.qty-control label{
  display:block;
  color:#e8f0ff;
  font-weight:800;
  margin-bottom:8px;
}

.quote-field input,
.qty-control input{
  min-height:48px;
  padding:12px 14px;
}

.selected-products{
  display:grid;
  gap:12px;
}

.quote-item{
  display:grid;
  grid-template-columns:88px minmax(0,1fr) 136px;
  gap:14px;
  align-items:center;
  padding:12px;
  border-radius:8px;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.10);
}

.quote-item img{
  width:88px;
  height:72px;
  border-radius:8px;
  object-fit:cover;
}

.quote-item h3{
  font-size:1rem;
  line-height:1.3;
}

.quote-item p,
.quote-item small{
  color:#bfd0ef;
}

.qty-control input{
  text-align:right;
  font-weight:900;
}

.line-total{
  display:block;
  color:#67e8f9;
  font-weight:950;
  text-align:right;
  margin-top:8px;
}

.summary-card{
  position:sticky;
  top:96px;
}

.summary-list{
  display:grid;
  gap:10px;
}

.summary-line{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,0.10);
}

.summary-line span{
  color:#bfd0ef;
}

.summary-total{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin:18px 0;
  padding:16px;
  border-radius:8px;
  background:linear-gradient(135deg,#0ea5e9,#22c55e);
}

.summary-total strong{
  font-size:1.35rem;
}

.quote-actions{
  display:grid;
  gap:10px;
}

.quote-actions .btn{
  width:100%;
}

.finish-quote-btn{
  min-height:54px;
  font-size:1rem;
}

.empty-selection{
  padding:22px;
  border-radius:8px;
  border:1px dashed rgba(255,255,255,0.22);
  color:#bfd0ef;
  text-align:center;
}

body.light-theme.quote-page{
  background:
    radial-gradient(circle at top left, rgba(108,99,255,0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(0,212,255,0.14), transparent 28%),
    #f3f7ff;
  color:#0f172a;
}

body.light-theme.quote-page .quote-panel{
  background:rgba(255,255,255,0.94);
  border-color:rgba(15,23,42,0.10);
  color:#0f172a;
}

body.light-theme.quote-page .quote-panel h2,
body.light-theme.quote-page .quote-item h3,
body.light-theme.quote-page .summary-line strong{
  color:#0f172a;
}

body.light-theme.quote-page .quote-field label,
body.light-theme.quote-page .qty-control label,
body.light-theme.quote-page .summary-line span,
body.light-theme.quote-page .quote-item p,
body.light-theme.quote-page .quote-item small,
body.light-theme.quote-page .empty-selection{
  color:#475569;
}

body.light-theme.quote-page .quote-field input,
body.light-theme.quote-page .qty-control input{
  background:#ffffff;
  border:1px solid rgba(15,23,42,0.12);
  color:#0f172a;
}

body.light-theme.quote-page .quote-field input::placeholder,
body.light-theme.quote-page .qty-control input::placeholder{
  color:#64748b;
}

body.light-theme.quote-page .quote-field input:focus,
body.light-theme.quote-page .qty-control input:focus{
  border-color:#0ea5e9;
  box-shadow:0 0 0 4px rgba(14,165,233,0.14);
  outline:none;
}

body.light-theme.quote-page .quote-item{
  background:#f8fafc;
  border-color:rgba(15,23,42,0.10);
}

body.light-theme.quote-page .line-total{
  color:#047857;
}

body.light-theme.quote-page .summary-line{
  border-bottom-color:rgba(15,23,42,0.10);
}

body.light-theme.quote-page .empty-selection{
  border-color:rgba(15,23,42,0.22);
  background:#f8fafc;
}

.quotation-modal{
  position:fixed;
  inset:0;
  z-index:3000;
  display:none;
  align-items:center;
  justify-content:center;
  padding:28px;
}

.quotation-modal.is-open{
  display:flex;
}

.quotation-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(7,14,24,0.72);
  backdrop-filter:blur(2px);
}

.quotation-modal__dialog{
  position:relative;
  z-index:1;
  width:min(1180px,100%);
  height:min(860px,92vh);
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  overflow:hidden;
  border-radius:8px;
  background:#fff;
  color:#111827;
  box-shadow:0 30px 90px rgba(0,0,0,0.36);
}

.quotation-modal__header,
.quotation-modal__footer{
  display:flex;
  align-items:center;
  gap:14px;
  padding:22px 26px;
  border-bottom:1px solid #e5e7eb;
}

.quotation-modal__header{
  justify-content:space-between;
}

.quotation-modal__header h2{
  margin:0;
  font-family:'Manrope',sans-serif;
  font-size:1.55rem;
  color:#0f172a;
}

.quotation-modal__icon-btn{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border:0;
  border-radius:8px;
  background:transparent;
  color:#6b7280;
  cursor:pointer;
  font-size:1.75rem;
}

.quotation-modal__icon-btn:hover{
  background:#f3f4f6;
  color:#111827;
}

.quotation-modal__body{
  min-height:0;
  padding:26px;
  background:#f8fafc;
}

.quotation-modal__body iframe{
  width:100%;
  height:100%;
  display:block;
  border:0;
  border-radius:2px;
  background:#2b2b2b;
}

.quotation-modal__footer{
  justify-content:flex-end;
  border-top:1px solid #e5e7eb;
  border-bottom:0;
  background:#fff;
}

.quotation-modal__footer .btn{
  width:auto;
  min-width:124px;
}

body.quotation-modal-open{
  overflow:hidden;
}

@media(max-width:980px){
  .market-page .page-hero .container,
  .quote-page .page-hero .container,
  .market-toolbar{
    align-items:flex-start;
    flex-direction:column;
  }

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

  .summary-card{
    position:relative;
    top:0;
  }
}

@media(max-width:680px){
  .market-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .product-body{
    padding:12px;
  }

  .price{
    font-size:1rem;
  }

  .quote-inputs,
  .quote-item{
    grid-template-columns:1fr;
  }

  .quote-item img{
    width:100%;
    height:160px;
  }

  .line-total{
    text-align:left;
  }

  .quotation-modal{
    padding:12px;
  }

  .quotation-modal__dialog{
    height:94vh;
  }

  .quotation-modal__header,
  .quotation-modal__footer{
    padding:16px;
  }

  .quotation-modal__body{
    padding:12px;
  }

  .quotation-modal__footer{
    display:grid;
    grid-template-columns:1fr;
  }

  .quotation-modal__footer .btn{
    width:100%;
  }
}

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