:root{--bg:#0f172a;--card:#0b1221;--panel:#eef2ff;--text:#0b1221;--muted:#6b7280;--primary:#f59e0b;--dark:#0b1221;--radius:16px}
*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;color:var(--text);background:#f8fafc;overflow-x:hidden}
.h1,h1{font-size:28px;line-height:1.25;margin:0 0 12px}
.h2,h2{font-size:22px;line-height:1.25;margin:16px 0 8px}
p{line-height:1.6}
.container{max-width:1280px;margin:0 auto;padding:24px}
.narrow{max-width:760px}
.center{text-align:center}
.small{font-size:12px}
.muted{color:var(--muted)}
.btn{display:inline-block;padding:12px 18px;border-radius:999px;text-decoration:none;border:0;cursor:pointer;font-weight:600}
.btn-primary{background:var(--primary);color:white}
.btn-dark{background:var(--dark);color:white}
.link{background:none;border:0;color:#2563eb;padding:0;cursor:pointer}

.hero{padding-top:24px;padding-bottom:8px}
.hero-card{background:white;border-radius:24px;box-shadow:0 10px 30px rgba(0,0,0,.08);overflow:hidden}
.hero-img{display:block;width:100%;height:360px;object-fit:cover;object-position:center center}
.hero-text{padding:20px 24px}
.hero h1{font-size:26px;line-height:1.2;margin:0 0 16px}

.cards{display:grid;gap:18px;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));margin-top:10px}
.card{background:white;border-radius:12px;border:1px solid #e5e7eb;overflow:hidden;display:grid;grid-template-rows:auto 1fr}
.card-top{position:relative;overflow:hidden;background:#f8fafc}
.card-top img{width:100%;height:auto;display:block;padding:0;margin:0;object-fit:contain;object-position:center center}
.badge{position:absolute;top:10px;left:10px;background:#eef2ff;color:#111827;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:600;border:1px solid #dbeafe}
.card-body{padding:12px 14px;display:flex;flex-direction:column;gap:8px}
.card-body h3{min-height:48px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.card-body h3{line-clamp:2}
.card-body p{min-height:56px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.card-body p{line-clamp:3}
.cards .card-body p{display:none}
/* For images that should show fully, switch to contain and allow padding */
.card-top img.img-contain{object-fit:contain;padding:18px;background:#f8fafc}
.card-body .price{margin-top:auto}
.price{font-size:22px;font-weight:700}

.benefits,.faq{background:white;border-radius:20px;border:1px solid #e5e7eb;margin-top:18px;padding:18px}
.benefits h2,.faq h2{margin-top:0}
.checks{display:grid;grid-template-columns:1fr 1fr;gap:8px 16px;padding-left:18px}
.checks li{list-style:'✓ ';}

.footer{display:flex;align-items:center;justify-content:space-between;margin-top:24px;color:var(--muted)}

/* Improve spacing on small screens for main containers */
.container{padding:16px}

.back{display:inline-block;margin-bottom:10px;color:#2563eb;text-decoration:none}
.form-card{background:white;border:1px solid #e5e7eb;border-radius:16px;padding:16px;display:flex;flex-direction:column;gap:10px}
label{display:block;font-weight:600;margin-bottom:4px}
input,textarea,select{width:100%;padding:10px;border-radius:10px;border:1px solid #e5e7eb}
.grid-2{display:grid;gap:12px;grid-template-columns:1fr 1fr}
/* Better radio alignment in checkout */
.radio-group{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.radio-group label{display:inline-flex;align-items:center;margin:0;line-height:1}
/* Robust cross-browser radio styling (fixes iOS Safari misalignment) */
.radio-group input[type=radio]{
  -webkit-appearance:none;appearance:none;display:inline-block;
  width:18px;height:18px;border-radius:50%;
  border:2px solid #94a3b8;background:#fff;margin:0 8px 0 0;position:relative
}
.radio-group input[type=radio]:focus{outline:2px solid #bfdbfe;outline-offset:2px}
.radio-group input[type=radio]:checked{border-color:var(--primary)}
.radio-group input[type=radio]:checked::after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--primary)}
.grid-3{display:grid;gap:12px;grid-template-columns:1fr 1fr 1fr}
.grid-2 .full{grid-column:1 / -1}
.warning{background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;padding:10px;border-radius:12px}
.error{background:#fee2e2;border:1px solid #fecaca;color:#991b1b;padding:10px;border-radius:12px}

.summary{margin-top:16px;display:flex;gap:16px;align-items:center}
.summary img{width:120px;height:80px;object-fit:cover;border-radius:12px}

.admin-nav{display:flex;gap:12px;align-items:center;margin-bottom:10px}
.table-wrap{background:white;border:1px solid #e5e7eb;border-radius:16px;overflow:auto}
.table{width:100%;border-collapse:collapse;min-width:920px}
.table th,.table td{padding:14px 12px;border-bottom:1px solid #e5e7eb;text-align:left;vertical-align:top}
.table tr:last-child td{border-bottom:0}
.table td,.table th{border-right:1px solid #eef2f7}
.table td:last-child,.table th:last-child{border-right:0}
.table thead th{border-bottom:1px solid #e5e7eb}
.table thead th{position:sticky;top:0;background:#f8fafc;z-index:1}
.badge-dot{display:inline-flex;align-items:center;gap:6px;background:#f1f5f9;border:1px solid #e2e8f0;padding:4px 10px;border-radius:999px;font-size:12px;font-weight:600;color:#0f172a}
.dot{width:8px;height:8px;border-radius:999px}
.dot.green{background:#22c55e}
.dot.amber{background:#f59e0b}
.dot.gray{background:#94a3b8}
.btn-sm{padding:8px 12px;border-radius:10px;font-weight:600}
.btn-secondary{background:#f1f5f9;border:1px solid #e2e8f0;color:#0f172a}
.mono{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}
.truncate{max-width:280px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block}
/* Inline text reset inside table cells to avoid chip-like boxes */
.table td .truncate,.table td .mono{display:inline;background:transparent;border:0;padding:0;border-radius:0;box-shadow:none}
.stack{display:flex;flex-direction:column;gap:4px}
.nowrap{white-space:nowrap}
.right{text-align:right}
.muted-small{color:var(--muted);font-size:12px}
.stack-card{background:white;border:1px solid #e5e7eb;border-radius:16px;overflow:hidden}
.stack-section{padding:12px;border-top:1px solid #e5e7eb}
.stack-section:first-child{border-top:0}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
.stat{background:white;border:1px solid #e5e7eb;border-radius:16px;padding:18px;text-align:center}
.stat .num{font-size:28px;font-weight:800}

/* Cart table responsive helpers */
.cart-table{width:100%}
.cart-actions{display:flex;gap:10px;flex-wrap:wrap}
.qty-input{max-width:90px}

/* Product modal */
.product-dialog{position:relative;background:#fff;border-radius:20px;max-width:960px;width:100%;padding:16px;border:1px solid #e5e7eb}
.product-dialog{max-height:80vh;overflow:auto;-webkit-overflow-scrolling:touch;overflow-wrap:anywhere;word-break:break-word;white-space:normal;padding-top:56px}
#productModal{display:flex;align-items:center;justify-content:center;padding:20px;overflow:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.product-dialog .js-close-product{position:absolute;right:12px;top:12px;z-index:10}
.product-dialog > .product-grid{margin-top:8px}
.product-info,.product-info p,.product-info h2{white-space:normal;overflow-wrap:anywhere;word-break:break-word;-webkit-hyphens:auto;hyphens:auto}
.product-info a.btn,.product-info button.btn{flex:1 1 140px;min-width:140px}
.product-grid>*,.product-info{min-width:0}
.product-info,.product-info p{overflow-wrap:anywhere;word-break:break-word;-webkit-hyphens:auto;hyphens:auto}
.product-grid{display:grid;grid-template-columns:1fr 360px;gap:16px;align-items:start}
.product-media{display:flex;align-items:center;justify-content:center;padding:8px;background:#f8fafc;border-radius:12px;max-height:48vh;overflow:hidden}
.product-media img{width:auto;max-width:100%;height:auto;max-height:44vh;object-fit:contain;object-position:center center;border:1px solid #eef2f7;background:#fff}
.product-info h2{margin:0 0 6px}

@media (max-width:720px){
  .hero-img{height:200px}
  .h1,h1{font-size:24px}
  .h2,h2{font-size:20px}
  .grid-2{grid-template-columns:1fr}
  .grid-3{grid-template-columns:1fr 1fr}
  .checks{grid-template-columns:1fr}
  .product-grid{grid-template-columns:1fr}
  .product-media img{max-height:50vh}
  .product-media{padding:8px}
  #productModal{padding:12px}
  .product-dialog{max-width:100%;border-radius:12px;padding:12px;padding-top:56px}
  body{position:relative;left:0;right:0;width:100%;overflow-x:hidden}
  .container{max-width:100%;overflow-x:hidden}
  /* Footer stacks nicely */
  .footer{flex-direction:column;gap:8px;text-align:center}
  /* Buttons wrap better in groups, but don't force global full-width */
  .cart-actions .btn, .product-info .btn{flex:1 1 auto}
  .cart-actions{width:100%}
  /* Cart: convert table to stacked cards */
  .table.cart-table{min-width:0;border-collapse:separate;border-spacing:0}
  .table.cart-table thead{display:none}
  .table.cart-table tbody tr{display:block;background:#fff;border:1px solid #e5e7eb;border-radius:12px;margin-bottom:12px;padding:12px}
  .table.cart-table td{display:flex;justify-content:space-between;align-items:center;border:0;padding:8px 0}
  .table.cart-table td:first-child{padding-top:0}
  .table.cart-table td:last-child{padding-bottom:0}
  .table.cart-table td::before{content:attr(data-label);font-weight:600;color:#334155;margin-right:12px}
  .table.cart-table td > *{max-width:65%}
  .summary{flex-direction:column;align-items:flex-start}
  .summary img{width:100%;height:auto}
  /* Avoid horizontal scroll inside modal/content */
  #productModal, .product-dialog, .product-grid, .product-info{max-width:100%;overflow-x:hidden}
  .product-dialog .js-close-product{position:sticky;top:8px;right:12px;margin-left:auto;background:#fff;border:1px solid #e2e8f0}
}

/* Narrow devices: relax table min-width globally to avoid horizontal scroll */
@media (max-width:920px){
  .table{min-width:0}
}

