:root{
  --navy:#12356E; --navy-dark:#0d2a58; --orange:#EF7C1B; --orange-dark:#d96f14;
  --bg:#EEF3FA; --card:#ffffff; --ink:#15223B; --muted:#5b6a82; --line:#e2e8f2;
  --radius:12px; --shadow:0 6px 20px rgba(18,53,110,.08);
  --font:"Poppins",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg);color:var(--ink);font-family:var(--font);line-height:1.55;-webkit-font-smoothing:antialiased}
a{color:var(--navy);text-decoration:none}
img{max-width:100%;display:block}
.container{max-width:1160px;margin:0 auto;padding:0 16px}
h1,h2,h3{font-weight:700;line-height:1.2;margin:0 0 .5em}
.section{padding:32px 0}
.section-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:16px}
.section-head a{font-size:.9rem;color:var(--orange);font-weight:600}

/* buttons */
.btn{display:inline-flex;align-items:center;gap:8px;border:0;border-radius:999px;
  padding:11px 22px;font:inherit;font-weight:600;cursor:pointer;text-align:center}
.btn-primary{background:var(--orange);color:#fff}
.btn-primary:hover{background:var(--orange-dark)}
.btn-navy{background:var(--navy);color:#fff}
.btn-navy:hover{background:var(--navy-dark)}
.btn-block{display:flex;width:100%;justify-content:center}
.btn:disabled{opacity:.5;cursor:not-allowed}

/* header */
.site-header{position:sticky;top:0;z-index:20;background:#fff;border-bottom:1px solid var(--line)}
.site-header .row{display:flex;align-items:center;gap:16px;padding:12px 16px}
.site-header .logo img{height:38px;width:auto}
.site-header form.search{flex:1;display:flex;max-width:560px}
.site-header .search input{flex:1;min-width:0;border:1px solid var(--line);border-right:0;border-radius:999px 0 0 999px;padding:10px 16px;font:inherit}
.site-header .search button{border:0;background:var(--navy);color:#fff;border-radius:0 999px 999px 0;padding:0 18px;cursor:pointer}
.header-actions{display:flex;align-items:center;gap:18px;margin-left:auto}
.header-actions a{display:flex;align-items:center;gap:6px;font-weight:600;font-size:.9rem}
.cart-link{position:relative}
.cart-badge{position:absolute;top:-8px;right:-10px;background:var(--orange);color:#fff;
  font-size:.7rem;font-weight:700;min-width:18px;height:18px;border-radius:999px;
  display:flex;align-items:center;justify-content:center;padding:0 4px}

/* hero */
.hero{background:linear-gradient(120deg,var(--navy),#1f4e9e);color:#fff;border-radius:var(--radius);
  padding:44px 32px;margin:24px 0;display:grid;gap:10px}
.hero h1{font-size:2rem;margin:0}
.hero .tag{color:#ffd9b8;font-weight:600;letter-spacing:.5px}
.hero .btn{margin-top:12px;align-self:start}

/* trust badges */
.trust{background:var(--navy);color:#fff}
.trust .container{display:flex;flex-wrap:wrap;gap:24px;justify-content:space-around;padding:18px 16px;font-size:.85rem;font-weight:600}
.trust span{display:flex;align-items:center;gap:8px}

/* category grid */
.cat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px}
.cat-card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:18px;text-align:center;box-shadow:var(--shadow)}
.cat-card:hover{border-color:var(--orange)}
.cat-card svg{width:40px;height:40px;margin-bottom:8px}
.cat-card b{display:block;color:var(--ink);font-size:.95rem}

/* product card + grid */
/* min() keeps at least two columns, so phones get two products per row. */
.product-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(210px,calc(50% - 8px)),1fr));gap:16px}
.product-card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  overflow:hidden;box-shadow:var(--shadow);display:flex;flex-direction:column}
.product-card:hover{border-color:var(--orange)}
.product-card .thumb{aspect-ratio:1/1;background:var(--card);overflow:hidden}
.product-card .thumb img,.pd .gallery .main img{width:100%;height:100%;object-fit:contain}
.product-card .body{padding:12px;display:flex;flex-direction:column;gap:4px;flex:1}
.product-card .brand,.pd .brand{font-size:.75rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.product-card .title{font-weight:600;color:var(--ink);font-size:.95rem}
.product-card .price{margin-top:auto;font-weight:700;color:var(--navy)}
.product-card .oos{font-size:.75rem;color:#b23b3b;font-weight:600}

/* Featured Products shows complete rows only. Each min-width is where .product-grid
   fits one more column that changes the count: n*210px + (n-1)*16px gaps. */
.featured{container-type:inline-size}
.featured .product-card:nth-child(n+7){display:none}
@container (min-width:888px){.featured .product-card:nth-child(-n+8){display:flex}}
@container (min-width:1114px){.featured .product-card:nth-child(-n+10){display:flex}}

/* log in + register */
.auth{display:flex;justify-content:center;padding:40px 0}
.auth-card{width:100%;max-width:420px;background:var(--card);border:1px solid var(--line);
  border-radius:var(--radius);box-shadow:var(--shadow);padding:clamp(20px,6vw,36px)}
.auth-card h1{font-size:1.5rem;margin:0 0 6px}
.auth-lead{color:var(--muted);font-size:.9rem;margin:0 0 24px}
.field{margin-bottom:16px}
.field label{display:block;font-size:.85rem;font-weight:600;margin-bottom:6px}
.field input{display:block;width:100%;border:1px solid #cbd5e3;border-radius:10px;padding:11px 14px;
  font:inherit;color:var(--ink);background:#fff}
.field input::placeholder{color:#8b98ad}
.field input:focus{outline:none;border-color:var(--navy);box-shadow:0 0 0 3px rgba(18,53,110,.15)}
.field.has-error input{border-color:#c0392b}
.auth-card .errorlist{list-style:none;margin:6px 0 0;padding:0;color:#a12d2d;font-size:.8rem}
.auth-card .errorlist.nonfield{margin:0 0 16px;padding:10px 14px;background:#fbe9e9;border-radius:8px;font-size:.85rem}
.auth-card .btn-block{margin-top:24px}
.auth-switch{margin:20px 0 0;text-align:center;font-size:.9rem;color:var(--muted)}
.auth-switch a{color:var(--orange-dark);font-weight:600}

/* filter bar */
.filter-bar{display:flex;flex-wrap:wrap;gap:10px;align-items:end;background:var(--card);
  border:1px solid var(--line);border-radius:var(--radius);padding:14px;margin-bottom:18px}
.filter-bar label{display:flex;flex-direction:column;font-size:.75rem;font-weight:600;color:var(--muted);gap:4px}
.filter-bar input,.filter-bar select{border:1px solid var(--line);border-radius:8px;padding:8px 10px;font:inherit}

/* pagination */
.pagination{display:flex;gap:6px;justify-content:center;margin-top:24px}
.pagination a,.pagination span{padding:8px 13px;border:1px solid var(--line);border-radius:8px;background:#fff;font-weight:600}
.pagination .current{background:var(--navy);color:#fff;border-color:var(--navy)}

/* product detail */
.pd{display:grid;grid-template-columns:1fr 1fr;gap:32px;margin:24px 0}
.pd .gallery .main{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);aspect-ratio:1/1;overflow:hidden}
.pd .gallery .thumbs{display:flex;gap:8px;margin-top:8px}
.pd .gallery .thumbs img{width:64px;height:64px;border:1px solid var(--line);border-radius:8px;cursor:pointer;object-fit:cover}
.pd .buy{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:20px}
.pd .price{font-size:1.6rem;font-weight:700;color:var(--navy);margin:8px 0}
.pd select,.pd .qty input{border:1px solid var(--line);border-radius:8px;padding:9px 12px;font:inherit}
.pd select{max-width:100%}
.pd .qty{display:flex;align-items:center;gap:8px;margin:12px 0}
.pd .qty button{width:34px;height:34px;border:1px solid var(--line);background:#fff;border-radius:8px;font-size:1.1rem;cursor:pointer}

/* messages */
.messages{list-style:none;padding:0;margin:16px 0}
.messages li{padding:12px 16px;border-radius:8px;margin-bottom:8px;font-weight:600}
.messages li.success{background:#e6f4ec;color:#186a3b}
.messages li.error{background:#fbe9e9;color:#a12d2d}
.messages li.info,.messages li.warning{background:#fef4e6;color:#8a5a12}

/* footer + bottom nav */
.site-footer{background:var(--navy);color:#cdd7e6;margin-top:40px}
.site-footer .container{display:flex;flex-wrap:wrap;gap:32px;justify-content:space-between;padding:32px 16px}
.site-footer a{color:#cdd7e6}
.site-footer .pay{display:flex;gap:8px;margin-top:8px;font-weight:700;color:#fff}
.bottom-nav{display:none}

@media (max-width:820px){
  .pd{grid-template-columns:minmax(0,1fr)}
  .site-header .row{flex-wrap:wrap}
  .site-header form.search{order:3;flex:1 1 100%;max-width:none}
  .hero h1{font-size:1.5rem}
  .bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;background:#fff;border-top:1px solid var(--line);
    justify-content:space-around;padding:8px 0;z-index:30}
  .bottom-nav a{display:flex;flex-direction:column;align-items:center;font-size:.7rem;color:var(--muted);gap:2px}
  .bottom-nav a.active{color:var(--orange)}
  body{padding-bottom:64px}
}

/* cart */
.cart-table{width:100%;border-collapse:collapse;margin:16px 0}
.cart-table td{border-bottom:1px solid var(--line);padding:10px;vertical-align:middle}
.cart-thumb{width:56px;height:56px;object-fit:cover;border-radius:8px}
.cart-summary{max-width:320px;margin-left:auto;background:var(--card);border:1px solid var(--line);
  border-radius:var(--radius);padding:16px;display:grid;gap:8px}
.cart-summary>div{display:flex;justify-content:space-between}
.cart-summary .btn{margin-top:8px}
.pay-methods{display:grid;gap:10px;margin:16px 0}
.pay-methods label{display:flex;align-items:center;gap:10px;border:1px solid var(--line);
  border-radius:10px;padding:12px 14px;cursor:pointer}
.addr-list{display:grid;gap:10px;margin:12px 0}
.addr-list label{display:block;border:1px solid var(--line);border-radius:10px;padding:12px 14px;cursor:pointer}
.confirm{max-width:560px;margin:24px auto;text-align:center}
.confirm .tick{width:64px;height:64px;border-radius:50%;background:#e6f4ec;color:#186a3b;
  display:flex;align-items:center;justify-content:center;font-size:2rem;margin:0 auto 12px}
.status-badge{display:inline-block;padding:2px 10px;border-radius:999px;background:var(--bg);font-size:.8rem;font-weight:700}

/* account */
.account-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin:16px 0}
.account-tile{display:block;padding:16px;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);box-shadow:var(--shadow);color:inherit}
.account-tile:hover{border-color:var(--orange)}
.account-tile b{display:block}
.account-tile span{font-size:.85rem;color:var(--muted)}
.order-row{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);padding:14px;margin-bottom:10px}
.order-row a{font-weight:700}
.addr-card{border:1px solid var(--line);border-radius:var(--radius);background:var(--card);padding:14px;margin-bottom:10px}
.addr-card .badge{display:inline-block;background:var(--navy);color:#fff;font-size:.7rem;font-weight:700;padding:2px 8px;border-radius:999px;margin-left:6px}
.addr-card .row{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}
