:root{--wine:#4f1830;--wine-soft:#7c3654;--ink:#27151c;--muted:#755f68;--cream:#fff9f6;--paper:#fff;--line:#eadde2;--rose:#f5e7eb;--green:#15704c;--red:#a52d43;--shadow:0 10px 35px rgba(70,24,45,.09);font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);background:var(--cream)}*{box-sizing:border-box}html{background:var(--cream)}body{margin:0;min-height:100vh;background:linear-gradient(180deg,#fff 0,#fff9f6 38rem);padding-bottom:calc(82px + env(safe-area-inset-bottom))}button,input,select,textarea{font:inherit}button{touch-action:manipulation}.staff-header{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;min-height:68px;padding:max(.45rem,env(safe-area-inset-top)) max(1rem,env(safe-area-inset-right)) .45rem max(1rem,env(safe-area-inset-left));border-bottom:1px solid var(--line);background:rgba(255,249,246,.92);backdrop-filter:blur(16px)}.staff-brand{display:flex;align-items:center;gap:.55rem;color:inherit;text-decoration:none}.staff-brand img{object-fit:contain;border-radius:50%;background:#1d1015}.staff-brand strong,.staff-brand small{display:block}.staff-brand strong{font:600 1.2rem Georgia,serif}.staff-brand small{font-size:.67rem;letter-spacing:.16em;text-transform:uppercase;color:var(--muted)}.staff-header-actions{display:flex;align-items:center;gap:.45rem}.icon-button{min-height:42px;border:1px solid var(--line);border-radius:12px;background:#fff;padding:.55rem .7rem;color:var(--wine);font-weight:700;cursor:pointer}.connection{width:9px;height:9px;border-radius:50%;background:#bbb}.connection.online{background:var(--green)}.connection.offline{background:var(--red)}main{width:min(1060px,100%);margin:auto;padding:0 max(.85rem,env(safe-area-inset-right)) 1rem max(.85rem,env(safe-area-inset-left))}.login-view{min-height:calc(100vh - 84px);display:grid;place-items:center}.login-card{width:min(430px,100%);padding:1.25rem;border:1px solid var(--line);border-radius:24px;background:rgba(255,255,255,.95);box-shadow:var(--shadow);text-align:center}.login-card>img{display:block;margin:auto;object-fit:contain;background:#1d1015;border-radius:28px}.eyebrow{margin:0;color:var(--wine-soft);font-size:.7rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase}.login-card h1,.staff-welcome h1,.section-heading h2,.dialog-heading h2{margin:.3rem 0;font-family:Georgia,serif}.login-card>p:not(.eyebrow):not(.form-message){color:var(--muted);line-height:1.5}.login-card form,.sale-meta{display:grid;gap:.8rem;text-align:left}label{display:grid;gap:.35rem;font-size:.78rem;font-weight:750;color:var(--ink)}label span{font-weight:500;color:var(--muted)}input,select,textarea{width:100%;min-height:48px;border:1px solid #ddcbd2;border-radius:12px;background:#fff;padding:.7rem .8rem;color:var(--ink);font-size:16px}textarea{resize:vertical}.primary-button{min-height:50px;border:0;border-radius:13px;background:var(--wine);color:#fff;padding:.75rem 1rem;font-weight:800;cursor:pointer}.primary-button:disabled{opacity:.5;cursor:not-allowed}.text-button{min-height:44px;border:0;background:transparent;color:var(--wine);text-decoration:underline;cursor:pointer}.form-message{min-height:1.2em;margin:.65rem 0 0;color:var(--red);font-size:.8rem;line-height:1.4}.form-message.success{color:var(--green)}.staff-welcome{display:flex;align-items:center;justify-content:space-between;padding:1.35rem .1rem .8rem}.staff-welcome h1{font-size:2rem}.app-section{display:grid;gap:1rem}.panel{border:1px solid var(--line);border-radius:20px;background:var(--paper);padding:1rem;box-shadow:0 5px 18px rgba(70,24,45,.045)}.sale-meta{grid-template-columns:repeat(3,1fr)}.section-heading{display:flex;align-items:end;justify-content:space-between;gap:.7rem;margin-bottom:.8rem}.section-heading h2{font-size:1.45rem}.section-heading>span{font-size:.72rem;color:var(--muted)}.search-field{position:relative}.search-field span{position:absolute;left:.85rem;top:50%;transform:translateY(-50%);font-size:1.25rem}.search-field input{padding-left:2.35rem}.product-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem;margin-top:.7rem;max-height:390px;overflow:auto}.product-result{display:grid;grid-template-columns:54px 1fr auto;align-items:center;gap:.65rem;min-width:0;border:1px solid var(--line);border-radius:13px;background:#fff;padding:.45rem;text-align:left;color:inherit;cursor:pointer}.product-result img{width:54px;height:66px;border-radius:9px;object-fit:cover;background:var(--rose)}.product-result span{min-width:0}.product-result strong,.product-result small{display:block}.product-result strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.78rem}.product-result small{margin-top:.18rem;color:var(--muted);font-size:.68rem}.product-result>b{color:var(--wine);font-size:1.25rem}.sale-cart{display:grid;gap:.55rem}.empty-state{margin:1rem;color:var(--muted);text-align:center}.cart-line{display:grid;grid-template-columns:1fr auto;gap:.65rem;padding:.7rem;border:1px solid var(--line);border-radius:13px}.cart-line strong,.cart-line small{display:block}.cart-line small{margin-top:.25rem;color:var(--muted);font-size:.73rem}.cart-line-actions{display:grid;justify-items:end;gap:.3rem}.cart-line-actions button{border:0;background:transparent;color:var(--red);cursor:pointer}.sale-total{display:flex;justify-content:space-between;align-items:center;margin:.9rem 0;font-size:1rem}.sale-total strong{font:700 1.45rem Georgia,serif;color:var(--wine)}.period-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:.45rem}.period-tabs button{min-height:44px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--ink);font-weight:750}.period-tabs button[aria-pressed=true]{background:var(--wine);color:#fff}.kpi-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:.7rem}.kpi{min-width:0;border:1px solid var(--line);border-radius:18px;background:#fff;padding:.9rem}.kpi span,.kpi strong{display:block}.kpi span{color:var(--muted);font-size:.7rem}.kpi strong{margin-top:.3rem;font:700 1.35rem Georgia,serif;color:var(--wine);overflow-wrap:anywhere}.stats-list,.bar-list,.history-list{display:grid;gap:.65rem}.stat-row{display:grid;grid-template-columns:1fr auto;gap:.8rem;padding-bottom:.65rem;border-bottom:1px solid var(--line)}.stat-row:last-child{border:0}.stat-row strong,.stat-row small{display:block}.stat-row small{margin-top:.2rem;color:var(--muted);font-size:.72rem}.stat-value{text-align:right}.bar-row{display:grid;grid-template-columns:minmax(100px,1fr) 2fr auto;align-items:center;gap:.6rem;font-size:.76rem}.bar-track{height:9px;border-radius:20px;background:var(--rose);overflow:hidden}.bar-fill{height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--wine),#be718f)}.history-card{padding:.8rem;border:1px solid var(--line);border-radius:14px}.history-card header{display:flex;justify-content:space-between;gap:.5rem}.history-card h3{margin:0;font:700 1rem Georgia,serif}.history-card p{margin:.35rem 0 0;color:var(--muted);font-size:.74rem;line-height:1.4}.staff-nav{position:fixed;z-index:30;left:50%;bottom:0;transform:translateX(-50%);display:grid;grid-template-columns:repeat(3,1fr);width:min(620px,100%);height:calc(70px + env(safe-area-inset-bottom));padding:0 max(.35rem,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(.35rem,env(safe-area-inset-left));border:1px solid var(--line);border-bottom:0;border-radius:20px 20px 0 0;background:rgba(255,255,255,.96);backdrop-filter:blur(18px);box-shadow:0 -8px 28px rgba(70,24,45,.09)}.staff-nav button{display:grid;place-items:center;align-content:center;gap:.15rem;border:0;background:transparent;color:var(--muted);font-size:.68rem;font-weight:750}.staff-nav button span{font-size:1.25rem}.staff-nav button[aria-current=page]{color:var(--wine)}dialog{width:min(440px,calc(100% - 1.5rem));border:1px solid var(--line);border-radius:22px;padding:0;background:#fff;color:var(--ink);box-shadow:0 20px 60px rgba(40,10,25,.25)}dialog::backdrop{background:rgba(35,13,22,.58);backdrop-filter:blur(3px)}dialog form{display:grid;gap:.8rem;padding:1rem}.dialog-heading{display:flex;justify-content:space-between;align-items:start;gap:.5rem}.dialog-heading button{min-width:44px;min-height:44px;border:0;background:transparent;font-size:1.6rem}.stock-note{margin:0;color:var(--muted);font-size:.78rem}.toast{position:fixed;z-index:50;left:50%;bottom:calc(82px + env(safe-area-inset-bottom));transform:translate(-50%,20px);width:min(420px,calc(100% - 2rem));padding:.85rem 1rem;border-radius:13px;background:#27151c;color:#fff;text-align:center;font-size:.8rem;opacity:0;pointer-events:none;transition:.2s}.toast.visible{opacity:1;transform:translate(-50%,0)}[hidden]{display:none!important}:focus-visible{outline:3px solid #c77b99;outline-offset:2px}@media(max-width:700px){.sale-meta{grid-template-columns:1fr}.product-results{grid-template-columns:1fr}.kpi-grid{grid-template-columns:repeat(2,1fr)}.bar-row{grid-template-columns:minmax(80px,1fr) 1.5fr auto}.staff-header{min-height:62px}.staff-brand strong{font-size:1rem}.staff-brand img{width:46px;height:46px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
/* Team access management */
.staff-nav{grid-template-columns:repeat(4,1fr)}
.user-access-card{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem;border:1px solid var(--line);border-radius:14px;background:#fff}
.user-access-card strong,.user-access-card small{display:block}.user-access-card small{margin-top:.25rem;color:var(--muted)}
.user-access-card button{min-height:42px;border:1px solid var(--line);border-radius:11px;background:#fff;color:var(--wine);padding:.55rem .75rem;font-weight:750;cursor:pointer}
#password-dialog p,#reset-dialog p{color:var(--muted);font-size:.8rem;line-height:1.5}
@media(max-width:520px){.staff-nav button{font-size:.6rem}.user-access-card{align-items:flex-start;flex-direction:column}.user-access-card button{width:100%}}

/* Mobile/PWA reliability for iOS Safari and Android browsers. */
@supports (height:100dvh){body{min-height:100dvh}.login-view{min-height:calc(100dvh - 84px)}}
@media(max-width:700px){
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-padding-bottom:calc(82px + env(safe-area-inset-bottom))}
  body{overscroll-behavior-x:none}
  input,select,textarea{font-size:16px}
  button,a,input,select,textarea,[role=button]{touch-action:manipulation}
  .icon-button,.staff-nav button,.product-result button,.sale-line button{min-width:44px;min-height:44px}
  main{padding-bottom:1.25rem}
  dialog{max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 1rem);overflow:auto;margin:auto}
  dialog form{padding-bottom:max(1rem,env(safe-area-inset-bottom))}
  .staff-nav{width:100%;max-width:620px}
  .toast{bottom:calc(82px + env(safe-area-inset-bottom))}
}
@media(max-width:380px){
  .staff-brand small{display:none}
  .staff-header-actions{gap:.2rem}
  .icon-button{padding:.5rem;font-size:.72rem}
  .kpi-grid{grid-template-columns:1fr}
}
