:root{
  --bg1:#07060a;
  --bg2:#0b0f1f;
  --glass:rgba(255,255,255,.06);
  --border:rgba(255,255,255,.10);
  --text:#f4f4f6;
  --muted:rgba(244,244,246,.72);
  --gold1:#caa76a;
  --gold2:#f5e1b6;
  --accent:#7c5cff;
  --danger:#ff4d6d;
  --ok:#3de0b2;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family: var(--font);
  font-size: 15px;
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(124,92,255,.25), transparent 55%),
    radial-gradient(900px 700px at 80% 30%, rgba(202,167,106,.18), transparent 55%),
    radial-gradient(700px 600px at 40% 90%, rgba(61,224,178,.10), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}
.bg:before{
  content:"";
  position:fixed; inset:-2px;
  background:
    radial-gradient(circle at 30% 20%, rgba(245,225,182,.06), transparent 45%),
    radial-gradient(circle at 70% 80%, rgba(202,167,106,.08), transparent 45%);
  filter: blur(0px);
  pointer-events:none;
}
a{color:inherit; text-decoration:none}

/* Layout */
.shell{max-width:100%;margin:0 auto;padding:16px 10px}
.shell.wide{max-width:100%}
@media (min-width: 768px){
  .shell{padding:20px 16px}
}
@media (min-width: 1100px){
  .shell{padding:22px 20px}
}

/* Top bar */
.topbar{
  position:sticky; top:0; z-index:30;
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; margin:8px 8px 0 8px;
  border-radius:16px; border:1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
@media (min-width: 768px){
  .topbar{padding:12px 16px; margin:12px 12px 0 12px; border-radius:18px}
}
.glass{
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  border:1px solid var(--border);
  backdrop-filter: blur(12px);
}
.card{
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}
@media (min-width: 768px){
  .card{padding:16px}
}

/* Brand / Logo */
.brand{display:flex; align-items:center; gap:12px; cursor:pointer}
.brand.mini .logo{width:32px;height:32px}
.brand-title{font-weight:800; letter-spacing:.8px; font-size:15px}
.brand-sub{color:var(--muted); font-size:11px}
@media (min-width: 768px){
  .brand.mini .logo{width:34px;height:34px}
  .brand-title{font-size:16px}
  .brand-sub{font-size:12px}
}
.logo{
  width:44px;height:44px;border-radius:14px;
  background: url('favicon.svg') center/contain no-repeat;
  box-shadow: 0 8px 24px rgba(124,92,255,.30), 0 2px 8px rgba(202,167,106,.20);
  position:relative;
  flex-shrink:0;
}
.logo:after{
  content:"";
  position:absolute; inset:0;
  border-radius:14px;
  background: linear-gradient(135deg, rgba(255,255,255,.18), transparent 60%);
  pointer-events:none;
}

/* Utilities */
.row{display:flex}
.between{justify-content:space-between}
.center{align-items:center}
.gap{gap:8px}
@media (min-width: 768px){.gap{gap:10px}}
.wrap{flex-wrap:wrap}
.stack{display:flex; flex-direction:column; gap:10px}
@media (min-width: 768px){.stack{gap:12px}}
.hr{height:1px;background:rgba(255,255,255,.10); margin:12px 0}
.muted{color:var(--muted)}
.title{font-size:15px;font-weight:800}
@media (min-width: 768px){.title{font-size:16px}}

/* Buttons - larger touch targets */
.btn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 16px;
  border-radius:14px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
  position:relative;
  overflow:hidden;
  user-select:none;
  font-size:14px;
  font-family:var(--font);
  min-height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.btn:hover{transform: translateY(-1px); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16)}
.btn:active{transform: translateY(0px) scale(.97)}
.btn.primary{
  border-color: rgba(202,167,106,.45);
  background: linear-gradient(135deg, rgba(202,167,106,.22), rgba(124,92,255,.18));
}
.btn.danger{
  border-color: rgba(255,77,109,.35);
  background: rgba(255,77,109,.10);
  color: #ff8fa3;
}
.btn.danger:hover{background: rgba(255,77,109,.18); border-color: rgba(255,77,109,.5)}
.btn .shine{
  position:absolute; inset:0;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,.22) 30%, transparent 60%);
  transform: translateX(-120%);
  animation: shine 2.4s ease-in-out infinite;
  pointer-events:none;
}
@keyframes shine{0%,55%{transform:translateX(-120%)} 100%{transform:translateX(120%)}}

/* Forms */
.field{display:flex;flex-direction:column;gap:6px}
.label{font-size:12px;color:var(--muted);font-weight:600}
.input{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  outline:none;
  background: rgba(0,0,0,.25);
  color:var(--text);
  font-size:15px;
  font-family:var(--font);
  min-height:44px;
}
.input.small{padding:9px 10px; border-radius:12px; max-width:240px; min-height:40px}
.input:focus{border-color: rgba(245,225,182,.35); box-shadow: 0 0 0 4px rgba(202,167,106,.08)}
select.input{-webkit-appearance:none; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:32px}
textarea.input{min-height:auto;resize:vertical}

/* Alerts & Badges */
.alert{
  border: 1px solid rgba(255,77,109,.35);
  background: rgba(255,77,109,.08);
  border-radius:14px;
  padding:10px 14px;
  font-size:14px;
}
.hidden{display:none}
.hint{font-size:12px}
.pill{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  font-size:12px;
  display:inline-flex;
  align-items:center;
  gap:4px;
  white-space:nowrap;
}
.pill.gold{border-color:rgba(202,167,106,.35); background:rgba(202,167,106,.12); color:var(--gold2)}
.pill.green{border-color:rgba(61,224,178,.35); background:rgba(61,224,178,.10); color:var(--ok)}
.pill.red{border-color:rgba(255,77,109,.35); background:rgba(255,77,109,.10); color:var(--danger)}
.pill.purple{border-color:rgba(124,92,255,.35); background:rgba(124,92,255,.12); color:#b4a0ff}

/* Grid */
.grid{display:grid; gap:12px}
.grid.two{grid-template-columns:1fr}
.grid.pos{grid-template-columns:1fr}
@media (min-width: 768px){
  .grid{gap:14px}
}
@media (min-width: 980px){
  .grid.two{grid-template-columns: 1.35fr .65fr}
  .grid.pos{grid-template-columns: 1.15fr .85fr}
}

/* Filters */
.filters{
  display:flex; flex-wrap:wrap; gap:8px;
  align-items:flex-end;
}
.filters .field{min-width:140px; flex: 1}
.filters .field.small{min-width:120px; flex: 0}
@media (min-width: 768px){
  .filters{gap:10px}
  .filters .field{min-width:160px}
  .filters .field.small{min-width:140px}
}
.badge{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 10px; border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  font-size:12px;
}
.section-gap{margin-top:12px}
@media (min-width: 768px){
  .section-gap{margin-top:18px}
}

/* KPIs */
.kpis{display:grid;grid-template-columns:repeat(3,1fr); gap:8px; margin-top:12px}
@media (min-width: 768px){.kpis{gap:10px}}
.kpi{padding:10px;border-radius:14px;border:1px solid rgba(255,255,255,.10); background: rgba(0,0,0,.18)}
@media (min-width: 768px){.kpi{padding:12px;border-radius:16px}}
.kpi-label{color:var(--muted); font-size:11px; font-weight:600}
.kpi-value{font-weight:900; margin-top:4px; font-size:14px}
@media (min-width: 768px){.kpi-value{font-size:16px; margin-top:6px}}

/* Products Grid (POS) */
.products{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
  max-height: calc(100vh - 340px);
  overflow:auto;
  padding-right:4px;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 600px){
  .products{grid-template-columns: repeat(3, 1fr)}
}
@media (min-width: 900px){
  .products{grid-template-columns: repeat(3, 1fr); gap:12px}
}
@media (min-width: 1100px){
  .products{grid-template-columns: repeat(4, 1fr)}
}
@media (min-width: 980px){
  .products{max-height: calc(100vh - 280px)}
}
.prod{
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  overflow:hidden;
  cursor:pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.prod:hover{transform: translateY(-2px); border-color: rgba(245,225,182,.22); box-shadow: 0 8px 24px rgba(0,0,0,.3)}
.prod:active{transform: scale(.97)}
.prod .img{height:110px;background: rgba(255,255,255,.06); display:flex; align-items:center; justify-content:center}
@media (min-width: 600px){
  .prod .img{height:130px}
}
@media (min-width: 768px){
  .prod .img{height:140px}
  .prod{border-radius:18px}
}
.prod img{width:100%;height:100%;object-fit:cover;display:block}
.prod .meta{padding:10px}
@media (min-width: 768px){.prod .meta{padding:12px}}
.prod .name{font-weight:800;font-size:13px; letter-spacing:.2px; line-height:1.3}
@media (min-width: 768px){.prod .name{font-size:15px}}
.prod .price{color:var(--gold2); font-weight:900; margin-top:4px; font-size:13px}

/* Category filter chips (POS) */
.cat-chips{
  display:flex; gap:8px; flex-wrap:nowrap; overflow-x:auto;
  padding:4px 0 8px 0;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.cat-chips::-webkit-scrollbar{display:none}
.cat-chip{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  border-radius:999px;
  padding:8px 16px;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
  transition: all .12s ease;
  min-height:38px;
  display:flex;
  align-items:center;
}
.cat-chip:active{transform:scale(.95)}
.cat-chip.on{
  border-color: rgba(202,167,106,.45);
  background: linear-gradient(135deg, rgba(202,167,106,.22), rgba(124,92,255,.14));
  color:var(--gold2);
}

/* Cart */
.cart-item{
  display:flex; justify-content:space-between; gap:10px;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  margin-bottom:8px;
}
@media (min-width: 768px){
  .cart-item{padding:12px; border-radius:16px; margin-bottom:10px}
}
.cart-left{min-width:0; flex:1}
.cart-name{font-weight:800; font-size:14px}
.cart-sub{font-size:12px;color:var(--muted); margin-top:3px}
.qty{
  display:flex; align-items:center; gap:6px; flex-shrink:0;
}
.qty button{padding:6px 10px;border-radius:12px; min-height:36px}
.totals b{font-weight:900}

/* Animations */
.lift-in{animation: liftIn .55s cubic-bezier(.2,.9,.2,1) both}
@keyframes liftIn{from{opacity:0; transform: translateY(10px) scale(.98)}to{opacity:1; transform: translateY(0) scale(1)}}
.pulse{animation:pulse 2.2s ease-in-out infinite}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.03)}}

/* Modal */
.modal-backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:flex; align-items:flex-end; justify-content:center;
  padding:0;
  z-index:100;
}
@media (min-width: 768px){
  .modal-backdrop{align-items:center; padding:16px}
}
.modal{
  width:100%;
  max-width: 720px;
  border-radius: 20px 20px 0 0;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(15,15,22,.95), rgba(10,10,16,.95));
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  overflow:hidden;
  animation: modalIn .22s ease-out both;
  max-height: 90vh;
  display:flex;
  flex-direction:column;
}
@media (min-width: 768px){
  .modal{border-radius:20px; max-height:85vh}
}
@keyframes modalIn{from{opacity:0; transform: translateY(10px) scale(.98)}to{opacity:1; transform: translateY(0) scale(1)}}
.modal-hd{padding:14px 16px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0}
.modal-bd{
  padding:0 16px 16px 16px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  flex:1;
  min-height:0;
}
.modal-ft{padding:12px 16px; display:flex; gap:8px; justify-content:flex-end; border-top:1px solid rgba(255,255,255,.08); flex-shrink:0}

/* Chips */
.chips{display:flex; flex-wrap:wrap; gap:8px}
.chips.scrollx{flex-wrap:nowrap; overflow:auto; padding-bottom:6px; -webkit-overflow-scrolling:touch}
.chips.scrollx .chip{white-space:nowrap}
.chip{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  padding:8px 12px;
  font-size:12px;
  cursor:pointer;
  user-select:none;
  min-height:36px;
  display:flex;
  align-items:center;
}
.chip.on{border-color: rgba(245,225,182,.28); background: rgba(202,167,106,.12)}
.list-scroll{
  max-height: 42vh;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  padding-right:4px;
}
.searchbar{
  display:flex;
  gap:10px;
  align-items:center;
}
.searchbar .input{flex:1}

/* Status pills in sales */
.status-completed{color:var(--ok)}
.status-cancelled{color:var(--danger)}

/* Sale card (improved) */
.sale-card{
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.15);
  margin-bottom:10px;
  transition: border-color .12s ease;
}
.sale-card:hover{border-color:rgba(255,255,255,.16)}
.sale-card .sale-header{display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap}
.sale-card .sale-id{font-weight:900; font-size:15px}
.sale-card .sale-meta{font-size:12px; color:var(--muted); margin-top:4px}
.sale-card .sale-totals{display:flex; gap:16px; flex-wrap:wrap; margin-top:8px; font-size:13px}
.sale-card .sale-actions{display:flex; gap:6px; flex-wrap:wrap; margin-top:10px}

/* Product card (admin) */
.product-card{
  display:flex; gap:12px;
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.15);
  margin-bottom:8px;
  transition: border-color .12s ease;
}
.product-card:hover{border-color:rgba(255,255,255,.16)}
.product-card .prod-img{width:72px;height:72px;border-radius:14px;object-fit:cover;border:1px solid rgba(255,255,255,.10);flex-shrink:0}
.product-card .prod-img-placeholder{width:72px;height:72px;border-radius:14px;border:1px solid rgba(255,255,255,.10);background:rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center;font-size:11px;color:var(--muted);flex-shrink:0}
.product-card .prod-info{flex:1;min-width:0}
.product-card .prod-name{font-weight:800;font-size:14px}
.product-card .prod-detail{font-size:12px;color:var(--muted);margin-top:3px}
.product-card .prod-actions{display:flex;gap:6px;align-items:flex-start;flex-shrink:0}

/* Scrollbar styling */
::-webkit-scrollbar{width:6px; height:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.12); border-radius:10px}
::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.20)}

/* Safe area for notch devices */
@supports (padding-top: env(safe-area-inset-top)){
  .topbar{margin-top:calc(8px + env(safe-area-inset-top))}
}
