/* ==========================================================================
   Volthouse POS — design tokens
   Clean-energy retail identity: graphite, vivid green, tactile battery gauges.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root{
  --bg:#F4F6F5;
  --surface:#FFFFFF;
  --surface-2:#EEF2F0;
  --ink:#12181A;
  --ink-2:#1C2420;
  --ink-3:#28322C;
  --green:#1F9D6B;
  --green-deep:#157A54;
  --green-tint:#E1F3EA;
  --amber:#C08A2E;
  --amber-tint:#F5EAD3;
  --red:#B23A2E;
  --red-tint:#F5DEDA;
  --blue:#2E6B9E;
  --blue-tint:#DCEAF4;
  --stone:#63706A;
  --stone-tint:#E7EBE8;
  --border:#E1E6E3;
  --border-soft:#EAEEEC;
  --text-main:#14201B;
  --text-muted:#63706A;

  --font-display:'Space Grotesk', -apple-system, sans-serif;
  --font-body:'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:'JetBrains Mono', ui-monospace, Menlo, monospace;
}

*{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%; scroll-behavior:smooth;}
body{
  margin:0;
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--text-main);
  display:flex;
  min-height:100vh;
  overflow-x:hidden;
  font-size:15px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit; text-decoration:none;}
img{max-width:100%;}
h1,h2,h3,h4{font-family:var(--font-display); font-weight:600; color:var(--ink);}
:focus-visible{outline:2px solid var(--green); outline-offset:2px;}
@media (prefers-reduced-motion: reduce){
  *{animation-duration:0.01ms !important; transition-duration:0.01ms !important;}
}

.skip-link{
  position:absolute; left:-999px; top:auto;
  background:var(--ink); color:#fff; padding:10px 16px; border-radius:0 0 8px 0;
  font-size:13px; font-weight:600; z-index:999;
}
.skip-link:focus{left:0; top:0;}

.stat-value, .mini-value, td.mono, .sku, .serial, table td, .cart-line .price{
  font-variant-numeric:tabular-nums;
}

.icn{flex-shrink:0; vertical-align:-4px;}
.battery-gauge{vertical-align:-3px; color:var(--stone);}

/* Custom scrollbars */
.sidebar-nav::-webkit-scrollbar, .table-responsive::-webkit-scrollbar, .pos-products::-webkit-scrollbar{height:8px; width:7px;}
.sidebar-nav::-webkit-scrollbar-track{background:transparent;}
.sidebar-nav::-webkit-scrollbar-thumb{background:rgba(238,242,240,.16); border-radius:8px;}
.table-responsive::-webkit-scrollbar-track, .pos-products::-webkit-scrollbar-track{background:var(--surface-2);}
.table-responsive::-webkit-scrollbar-thumb, .pos-products::-webkit-scrollbar-thumb{background:var(--border); border-radius:8px;}

.content > *{animation:rise .3s ease both;}
.content > *:nth-child(2){animation-delay:.02s;}
.content > *:nth-child(3){animation-delay:.05s;}
@keyframes rise{ from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:none;} }

/* ---------- Sidebar ---------- */
.sidebar{
  width:258px;
  min-width:258px;
  background:
    radial-gradient(circle at 85% 0%, rgba(31,157,107,.14), transparent 45%),
    var(--ink);
  color:#DCE4E0;
  display:flex;
  flex-direction:column;
  padding:20px 0 16px;
  height:100vh;
  position:sticky;
  top:0;
  z-index:200;
  transition:transform .25s ease;
  border-right:1px solid rgba(255,255,255,.05);
}
.sidebar-brand{padding:0 20px 16px; border-bottom:1px solid rgba(220,228,224,.12); margin-bottom:10px;}
.brand-lockup{display:flex; align-items:center; gap:10px;}
.brand-lockup .brand-icon{
  width:32px; height:32px; border-radius:8px;
  background:linear-gradient(155deg, var(--green), var(--green-deep));
  display:flex; align-items:center; justify-content:center; color:#06170F; flex-shrink:0;
}
.sidebar-brand h1{font-family:var(--font-display); font-size:17px; font-weight:700; margin:0; color:#fff; line-height:1.2;}
.brand-pill{
  display:inline-flex; align-items:center; gap:6px;
  background:rgba(31,157,107,.18); color:#8FE0BC;
  padding:4px 10px 4px 8px; border-radius:20px; font-size:10.5px; font-weight:600;
  letter-spacing:.4px; text-transform:uppercase; margin-top:10px;
}
.sidebar-section-label{
  font-family:var(--font-mono); font-size:10px; color:#7E8B84; text-transform:uppercase;
  letter-spacing:1.1px; font-weight:500; padding:15px 20px 7px;
}
.sidebar-nav{flex:1; overflow-y:auto;}
.sidebar-link{
  display:flex; align-items:center; gap:11px; padding:9px 20px; margin:0 9px 2px;
  border-radius:8px; font-size:13.7px; font-weight:500; color:#B9C2BD;
  transition:background .15s ease, color .15s ease;
}
.sidebar-link .icn{color:#7E8B84;}
.sidebar-link:hover{background:rgba(220,228,224,.06); color:#fff;}
.sidebar-link:hover .icn{color:#8FE0BC;}
.sidebar-link.active{background:var(--ink-3); color:#fff; box-shadow:inset 2px 0 0 var(--green);}
.sidebar-link.active .icn{color:var(--green);}
.sidebar-footer{padding:12px 20px 0;}
.btn-logout{
  display:flex; align-items:center; justify-content:center; gap:8px; width:100%;
  background:rgba(178,58,46,.16); color:#EAAAA0; border:1px solid rgba(178,58,46,.32);
  padding:9px; border-radius:8px; font-weight:600; font-size:13px; cursor:pointer; font-family:var(--font-body);
}
.btn-logout:hover{background:rgba(178,58,46,.28);}

.sidebar-overlay{display:none; position:fixed; inset:0; background:rgba(10,14,12,.55); z-index:150;}
.menu-toggle{display:none; background:none; border:none; cursor:pointer; width:38px; height:38px; border-radius:8px; align-items:center; justify-content:center; flex-direction:column; gap:4px;}
.menu-toggle span{display:block; width:19px; height:2px; background:var(--ink); border-radius:2px;}
.menu-toggle:hover{background:var(--surface-2);}

/* ---------- Main area ---------- */
.main{flex:1; display:flex; flex-direction:column; min-width:0;}
.topbar{
  background:var(--surface); border-bottom:1px solid var(--border); padding:14px 28px;
  display:flex; justify-content:space-between; align-items:center; gap:12px; position:sticky; top:0; z-index:100;
}
.topbar .title-wrap{display:flex; align-items:center; gap:12px; min-width:0;}
.topbar .title-block{min-width:0;}
.topbar .eyebrow{font-family:var(--font-mono); font-size:10px; letter-spacing:.7px; text-transform:uppercase; color:var(--text-muted); display:block; margin-bottom:1px;}
.topbar .title{font-family:var(--font-display); font-weight:700; color:var(--ink); font-size:16.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.topbar .user-block{display:flex; align-items:center; gap:10px; flex-shrink:0;}
.topbar .user-name{font-weight:600; font-size:13px; color:var(--ink);}
.topbar .user-role{display:block; font-size:10px; color:var(--green-deep); font-weight:600; letter-spacing:.4px; text-transform:uppercase; font-family:var(--font-mono);}
.avatar{width:33px;height:33px;border-radius:50%; background:var(--ink); color:#DCE4E0; display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0; font-family:var(--font-display); font-size:14px;}
.content{padding:26px; flex:1; min-width:0; max-width:100%;}

h2.page-title{font-family:var(--font-display); font-size:24px; font-weight:700; margin:0 0 4px; color:var(--ink);}
p.page-sub{color:var(--text-muted); margin:0 0 20px; font-size:13.5px;}

/* ---------- Cards ---------- */
.card{background:var(--surface); border-radius:12px; border:1px solid var(--border); padding:20px; box-shadow:0 1px 2px rgba(18,24,26,.04); transition:box-shadow .15s ease, transform .15s ease;}
.card-row{display:flex; gap:16px; flex-wrap:wrap; margin-bottom:20px;}
.card > strong:first-child, .card > form > strong:first-child{display:block; font-family:var(--font-display); font-size:15px; font-weight:600; color:var(--ink); margin-bottom:4px;}

.stat-card{flex:1; min-width:200px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:17px 18px; position:relative; border-left:3px solid var(--stone); box-shadow:0 1px 2px rgba(18,24,26,.04); transition:box-shadow .15s ease, transform .15s ease;}
.stat-card:hover{box-shadow:0 6px 18px rgba(18,24,26,.08); transform:translateY(-2px);}
.stat-card .stat-label{font-family:var(--font-mono); font-size:10.2px; font-weight:500; letter-spacing:.7px; text-transform:uppercase; color:var(--text-muted); display:flex; justify-content:space-between; align-items:center;}
.stat-card .stat-label .icn{color:var(--text-muted); opacity:.7;}
.stat-card .stat-value{font-family:var(--font-display); font-size:26px; font-weight:700; margin:9px 0 7px; color:var(--ink);}
.stat-card .stat-foot{font-size:11.5px; color:var(--text-muted); border-top:1px solid var(--border-soft); padding-top:8px;}
.stat-green{border-left-color:var(--green);} .stat-green .stat-value{color:var(--green-deep);}
.stat-ink{border-left-color:var(--ink);} .stat-ink .stat-value{color:var(--ink);}
.stat-amber{border-left-color:var(--amber);} .stat-amber .stat-value{color:var(--amber);}
.stat-blue{border-left-color:var(--blue);} .stat-blue .stat-value{color:var(--blue);}
.stat-red{border-left-color:var(--red);} .stat-red .stat-value{color:var(--red);}

.mini-stat{flex:1; min-width:180px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px; text-align:center;}
.mini-stat .mini-label{font-family:var(--font-mono); font-size:10.2px; font-weight:500; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px;}
.mini-stat .mini-value{font-family:var(--font-display); font-size:22px; font-weight:700; margin-top:7px; color:var(--ink);}

.section-title{display:flex; align-items:center; gap:9px; font-family:var(--font-display); font-size:15.5px; font-weight:600; color:var(--ink); margin:0 0 14px;}
.section-title .icn{color:var(--green-deep);}

.sparkline{display:block; margin-top:6px;}
.sparkline path.fill{opacity:.12;}

/* ---------- Forms ---------- */
label{display:block; font-family:var(--font-mono); font-size:10.2px; font-weight:500; text-transform:uppercase; color:var(--ink-3); margin-bottom:6px; letter-spacing:.5px;}
input[type=text], input[type=number], input[type=password], input[type=date], input[type=time], input[type=email], input[type=tel], input[type=file], select, textarea{
  width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:14px;
  font-family:var(--font-body); margin-bottom:15px; background:var(--surface); color:var(--text-main);
}
select{
  appearance:none; -webkit-appearance:none; padding-right:34px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2363706A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 10px center; background-size:16px; cursor:pointer;
}
input:focus, select:focus, textarea:focus{border-color:var(--green); outline:none; box-shadow:0 0 0 3px var(--green-tint);}
textarea{resize:vertical; min-height:60px;}

.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 18px; border-radius:8px; font-weight:600; font-size:13.3px; border:none; cursor:pointer; text-align:center; font-family:var(--font-body); transition:filter .12s ease, transform .1s ease;}
.btn:hover{filter:brightness(.94); transform:translateY(-1px);}
.btn:active{transform:translateY(0); filter:brightness(.88);}
.btn-block{width:100%;}
.btn-primary{background:var(--ink); color:#EAF0EC;}
.btn-green{background:var(--green); color:#fff;}
.btn-dark{background:var(--ink-3); color:#EAF0EC;}
.btn-red{background:var(--surface); color:var(--red); border:1px solid var(--red);}
.btn-red-solid{background:var(--red); color:#fff;}
.btn-outline{background:var(--surface); color:var(--ink); border:1px solid var(--border);}
.btn-outline:hover{background:var(--surface-2); filter:none;}
.btn-sm{padding:6px 11px; font-size:12px;}
.btn-lg{padding:14px 20px; font-size:14.5px;}

.tabs{display:flex; gap:6px; margin-bottom:18px; flex-wrap:wrap; background:var(--surface-2); padding:4px; border-radius:9px;}
.tabs a{flex:1; min-width:90px; text-align:center; padding:9px; border-radius:7px; font-weight:600; font-size:12.8px; color:var(--ink-3);}
.tabs a.active{background:var(--ink); color:#EAF0EC;}

/* ---------- Tables ---------- */
.table-responsive{width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch;}
table{width:100%; border-collapse:collapse; min-width:640px;}
thead th{text-align:left; font-family:var(--font-mono); font-size:10.2px; text-transform:uppercase; letter-spacing:.7px; color:var(--text-muted); padding:11px 13px; border-bottom:1px solid var(--border); white-space:nowrap; font-weight:500;}
tbody td{padding:12px 13px; border-bottom:1px solid var(--border-soft); font-size:13.3px;}
tbody tr:last-child td{border-bottom:none;}
tbody tr:hover{background:var(--surface-2);}
.empty-state{padding:46px 20px; text-align:center; color:var(--text-muted); font-size:13.3px;}
.empty-state::before{
  content:""; display:block; width:32px; height:32px; margin:0 auto 10px; background-color:var(--border);
  -webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='7' width='16' height='13' rx='1.5'/%3E%3Cpath d='M4 11h16M9 7V5.5h6V7'/%3E%3C/svg%3E");
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='7' width='16' height='13' rx='1.5'/%3E%3Cpath d='M4 11h16M9 7V5.5h6V7'/%3E%3C/svg%3E");
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat; -webkit-mask-position:center; mask-position:center; -webkit-mask-size:contain; mask-size:contain;
}

.badge{padding:3px 9px; border-radius:20px; font-size:10.8px; font-weight:600; display:inline-block; letter-spacing:.2px;}
.badge-green{background:var(--green-tint); color:var(--green-deep);}
.badge-red{background:var(--red-tint); color:var(--red);}
.badge-gray{background:var(--stone-tint); color:var(--stone);}
.badge-blue{background:var(--blue-tint); color:var(--blue);}
.badge-orange{background:var(--amber-tint); color:var(--amber);}

.alert{padding:11px 15px; border-radius:9px; margin-bottom:16px; font-size:13.3px; font-weight:500; display:flex; align-items:center; gap:10px;}
.alert::before{content:""; flex-shrink:0; width:18px; height:18px; -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat; -webkit-mask-size:contain; mask-size:contain; -webkit-mask-position:center; mask-position:center;}
.alert-success{background:var(--green-tint); color:var(--green-deep); border:1px solid #c7e6d5;}
.alert-success::before{
  background-color:var(--green-deep);
  -webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.2'/%3E%3Cpath d='M8.3 12.3l2.4 2.4 5-5.4'/%3E%3C/svg%3E");
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.2'/%3E%3Cpath d='M8.3 12.3l2.4 2.4 5-5.4'/%3E%3C/svg%3E");
}
.alert-error{background:var(--red-tint); color:var(--red); border:1px solid #eaccc6;}
.alert-error::before{
  background-color:var(--red);
  -webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 21.5 20h-19z'/%3E%3Cpath d='M12 10v4.2'/%3E%3Ccircle cx='12' cy='17.3' r='.3' fill='%23000'/%3E%3C/svg%3E");
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 21.5 20h-19z'/%3E%3Cpath d='M12 10v4.2'/%3E%3Ccircle cx='12' cy='17.3' r='.3' fill='%23000'/%3E%3C/svg%3E");
}

.grid-3{display:grid; grid-template-columns:repeat(3,1fr); gap:16px;}
.grid-2{display:grid; grid-template-columns:2fr 1fr; gap:16px;}
.grid-2-even{display:grid; grid-template-columns:1fr 1fr; gap:16px;}

.danger-card{border:1px solid #eaccc6; border-radius:12px; padding:18px; background:var(--surface);}
.danger-card h3{color:var(--red); margin-top:0; font-family:var(--font-display); font-weight:600;}

/* ---------- Login ---------- */
.login-wrap{flex:1; display:flex; align-items:stretch; justify-content:center; background:var(--bg);}
.login-shell{display:flex; width:100%; max-width:900px; margin:auto; border-radius:16px; overflow:hidden; box-shadow:0 20px 60px rgba(18,24,26,.12); border:1px solid var(--border);}
.login-side{flex:1; min-width:270px; background:radial-gradient(circle at 25% 15%, var(--ink-3), var(--ink) 65%); color:#DCE4E0; padding:44px 38px; display:flex; flex-direction:column; justify-content:space-between;}
.login-side .brand-icon{width:44px; height:44px; border-radius:10px; background:linear-gradient(155deg, var(--green), var(--green-deep)); display:flex; align-items:center; justify-content:center; color:#06170F; margin-bottom:22px;}
.login-side h1{font-family:var(--font-display); font-size:26px; font-weight:700; margin:0 0 10px; line-height:1.2;}
.login-side p{color:#AEBAB3; font-size:13.5px; line-height:1.6; margin:0;}
.login-form-side{flex:1; min-width:290px; background:var(--surface); padding:44px 38px; display:flex; flex-direction:column; justify-content:center;}
.login-form-side h2{font-family:var(--font-display); font-size:20px; font-weight:700; margin:0 0 4px; color:var(--ink);}
.login-form-side p.sub{color:var(--text-muted); font-size:13px; margin-top:0; margin-bottom:22px;}

/* ---------- POS terminal layout ---------- */
.pos-layout{display:grid; grid-template-columns:1fr 380px; gap:18px; align-items:start;}
.pos-products{max-height:calc(100vh - 220px); overflow-y:auto; padding-right:4px;}
.product-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px;}
.product-tile{
  background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px; text-align:left; cursor:pointer;
  transition:box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.product-tile:hover{box-shadow:0 8px 20px rgba(18,24,26,.1); transform:translateY(-2px); border-color:var(--green);}
.product-tile .p-name{font-family:var(--font-display); font-weight:600; font-size:13.7px; color:var(--ink); line-height:1.3; margin-bottom:4px;}
.product-tile .p-sku{font-family:var(--font-mono); font-size:10.3px; color:var(--text-muted);}
.product-tile .p-price{font-family:var(--font-display); font-weight:700; color:var(--green-deep); font-size:15px; margin-top:8px;}
.product-tile .p-stock{display:flex; align-items:center; gap:6px; margin-top:8px; font-size:11px; color:var(--text-muted);}

.pos-cart{background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:18px; position:sticky; top:14px;}
.cart-lines{max-height:290px; overflow-y:auto; margin-bottom:10px;}
.cart-line{display:flex; justify-content:space-between; align-items:center; gap:8px; padding:9px 0; border-bottom:1px solid var(--border-soft);}
.cart-line:last-child{border-bottom:none;}
.cart-line .name{font-size:13px; font-weight:600; color:var(--ink);}
.cart-line .meta{font-size:11px; color:var(--text-muted); font-family:var(--font-mono);}
.cart-line .price{font-family:var(--font-mono); font-weight:600; font-size:13px;}
.cart-summary .row{display:flex; justify-content:space-between; padding:5px 0; font-size:13px; font-family:var(--font-mono);}
.cart-summary .row.total{font-weight:700; font-size:17px; border-top:2px solid var(--ink); padding-top:9px; margin-top:5px; font-family:var(--font-display);}
.qty-btn{width:22px; height:22px; border-radius:6px; border:1px solid var(--border); background:var(--surface-2); display:inline-flex; align-items:center; justify-content:center; cursor:pointer;}

/* ---------- Receipt / invoice print (thermal-style) ---------- */
.invoice-box{max-width:420px; margin:0 auto; background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:28px; font-family:var(--font-mono); font-size:12.5px;}
.invoice-box .center{text-align:center;}
.invoice-box hr{border:none; border-top:1px dashed var(--border); margin:12px 0;}
.invoice-totals .row{display:flex; justify-content:space-between; padding:4px 0;}
.invoice-totals .row.total{font-weight:700; font-size:15px; border-top:1px dashed var(--ink); padding-top:8px; margin-top:4px;}

/* ---------- Pro Invoice (formal, full-page document) ---------- */
.pro-invoice{
  max-width:840px; margin:0 auto; background:var(--surface); border:1px solid var(--border); border-radius:14px;
  padding:44px 48px; position:relative; overflow:hidden;
}
.pro-invoice::before{
  content:""; position:absolute; top:0; left:0; right:0; height:6px;
  background:linear-gradient(90deg, var(--green), var(--green-deep));
}
.pi-head{display:flex; justify-content:space-between; align-items:flex-start; gap:24px; flex-wrap:wrap; margin-bottom:30px;}
.pi-brand{display:flex; align-items:center; gap:12px;}
.pi-brand .brand-icon{width:44px; height:44px; border-radius:10px; background:linear-gradient(155deg, var(--green), var(--green-deep)); display:flex; align-items:center; justify-content:center; color:#06170F; flex-shrink:0;}
.pi-brand h2{font-family:var(--font-display); font-size:19px; font-weight:700; margin:0; color:var(--ink);}
.pi-brand .pi-company-meta{font-size:11.5px; color:var(--text-muted); line-height:1.6; margin-top:2px;}
.pi-title-block{text-align:right;}
.pi-title-block h1{font-family:var(--font-display); font-size:28px; font-weight:700; margin:0; color:var(--ink); letter-spacing:.5px;}
.pi-title-block .pi-number{font-family:var(--font-mono); font-size:13px; color:var(--text-muted); margin-top:4px;}
.pi-stamp{display:inline-block; margin-top:10px; padding:5px 14px; border-radius:6px; font-family:var(--font-mono); font-weight:700; font-size:11.5px; letter-spacing:.8px; border:2px solid;}
.stamp-paid{color:var(--green-deep); border-color:var(--green-deep); background:var(--green-tint);}
.stamp-partial{color:var(--amber); border-color:var(--amber); background:var(--amber-tint);}
.stamp-due{color:var(--red); border-color:var(--red); background:var(--red-tint);}
.stamp-void{color:var(--stone); border-color:var(--stone); background:var(--stone-tint);}

.pi-meta-grid{display:grid; grid-template-columns:1fr 1fr 1fr; gap:20px; margin-bottom:28px; padding-bottom:24px; border-bottom:1px solid var(--border);}
.pi-meta-grid .label{font-family:var(--font-mono); font-size:10px; text-transform:uppercase; letter-spacing:.6px; color:var(--text-muted); margin-bottom:5px;}
.pi-meta-grid .value{font-size:13.5px; color:var(--ink); line-height:1.5;}
.pi-meta-grid .value strong{font-family:var(--font-display);}

.pi-table{width:100%; border-collapse:collapse; margin-bottom:24px;}
.pi-table thead th{
  text-align:left; font-family:var(--font-mono); font-size:10.5px; text-transform:uppercase; letter-spacing:.6px;
  color:var(--text-muted); padding:10px 8px; border-bottom:2px solid var(--ink); font-weight:600;
}
.pi-table tbody td{padding:12px 8px; border-bottom:1px solid var(--border-soft); font-size:13.3px; vertical-align:top;}
.pi-table tbody tr:last-child td{border-bottom:1px solid var(--border);}
.pi-table .pi-item-name{font-weight:600; color:var(--ink); font-family:var(--font-display);}
.pi-table .pi-item-meta{font-family:var(--font-mono); font-size:11px; color:var(--text-muted); margin-top:2px;}
.pi-table .num{font-family:var(--font-mono); text-align:right; white-space:nowrap;}

.pi-summary-wrap{display:flex; justify-content:flex-end; margin-bottom:28px;}
.pi-summary{width:280px; max-width:100%; font-family:var(--font-mono);}
.pi-summary .row{display:flex; justify-content:space-between; padding:6px 0; font-size:13px;}
.pi-summary .row.total{font-weight:700; font-size:18px; border-top:2px solid var(--ink); padding-top:10px; margin-top:6px; font-family:var(--font-display);}
.pi-summary .row.balance{font-weight:700; color:var(--red);}
.pi-summary .row.balance.settled{color:var(--green-deep);}

.pi-payments{margin-bottom:24px;}
.pi-payments .pi-pay-row{display:flex; justify-content:space-between; padding:6px 0; font-size:12.5px; border-bottom:1px solid var(--border-soft);}

.pi-notes{background:var(--surface-2); border-radius:10px; padding:16px 18px; font-size:12px; color:var(--text-muted); line-height:1.6; margin-bottom:20px;}
.pi-notes strong{color:var(--ink); font-family:var(--font-display); display:block; margin-bottom:4px; font-size:12.5px;}

.pi-footer{text-align:center; font-size:11px; color:var(--text-muted); border-top:1px solid var(--border); padding-top:16px;}

@media print{
  .pro-invoice{box-shadow:none; border:none; max-width:100%; padding:0;}
  .pro-invoice::before{display:none;}
  @page{ size:A4; margin:18mm; }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1000px){
  .pos-layout{grid-template-columns:1fr;}
  .pos-cart{position:static;}
}
@media (max-width: 900px){
  .sidebar{position:fixed; left:0; top:0; height:100vh; transform:translateX(-100%); box-shadow:4px 0 24px rgba(0,0,0,.25);}
  .sidebar.open{transform:translateX(0);}
  .sidebar-overlay.show{display:block;}
  .menu-toggle{display:flex;}
  .content{padding:18px;}
  .topbar{padding:12px 16px;}
  .grid-3{grid-template-columns:1fr;}
  .grid-2{grid-template-columns:1fr;}
  .grid-2-even{grid-template-columns:1fr;}
  .login-shell{flex-direction:column;}
  .login-side{padding:30px;}
}
@media (max-width: 700px){
  .content{padding:14px;}
  h2.page-title{font-size:20px;}
  .card{padding:15px;}
  .stat-card{min-width:100%; padding:15px;}
  .stat-card .stat-value{font-size:21px;}
  .mini-stat{min-width:calc(50% - 6px); padding:13px;}
  .topbar .user-name, .topbar .user-role{display:none;}
  .topbar .title{font-size:13.5px;}
  .product-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));}
  .invoice-box{padding:20px;}
  .pro-invoice{padding:24px 20px;}
  .pi-meta-grid{grid-template-columns:1fr; gap:14px;}
  .pi-title-block{text-align:left;}
  .pi-head{flex-direction:column;}
}
@media (max-width: 480px){
  .content{padding:10px;}
  .sidebar{width:240px; min-width:240px;}
  table{min-width:520px;}
  .btn{padding:10px 13px; font-size:12.5px;}
}
@media print{
  .sidebar, .topbar, .sidebar-overlay, .no-print{display:none !important;}
  body{background:#fff;}
  .content{padding:0;}
  .invoice-box{border:none; box-shadow:none; max-width:100%;}
}
