:root {
  --maroon: #8f1d2c;
  --maroon-2: #a8293a;
  --cream: #f7f1e8;
  --paper: #fffaf3;
  --ink: #2a1a1c;
  --muted: #7c6a66;
  --line: #ead9c6;
  --ok: #2f7d4a;
  --shadow: 0 10px 30px rgba(80, 20, 25, .12);
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%;
  margin: 0
}

body {
  background: var(--cream);
  color: var(--ink);
  font: 15px/1.45 Inter, system-ui, sans-serif;
  display: flex;
  flex-direction: column
}

[dir=rtl],
.ur {
  font-family: "Noto Nastaliq Urdu", Inter, sans-serif;
  line-height: 2
}

header {
  background: var(--maroon);
  color: #fff;
  padding: 12px 16px 18px;
  position: relative
}

header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 12px;
  background: radial-gradient(circle at 10px 0, var(--maroon) 9px, transparent 10px) 0 0/34px 12px repeat-x
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1100px;
  margin: 0 auto
}

.brand h1 {
  font: 24px "Lilita One", sans-serif;
  letter-spacing: .5px;
  margin: 0
}

.brand small {
  opacity: .8;
  font-size: 12px;
  display: block
}

.brand .sp {
  flex: 1
}

.iconbtn {
  background: rgba(255, 255, 255, .14);
  border: 0;
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font: 600 13px Inter;
  cursor: pointer;
  position: relative
}

.badge[hidden] {
  display: none
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ffd166;
  color: var(--ink);
  border-radius: 999px;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 4px
}

main {
  flex: 1;
  display: flex;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
  gap: 16px;
  padding: 16px 16px 0
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative
}

.chat::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url(/static/PIC-Logo.png) center 42%/min(380px, 70%) auto no-repeat;
  opacity: .07;
  mix-blend-mode: multiply
}

/* Slim scrollbars: hidden until hover, no arrow buttons.
   Chrome/Edge ignore ::-webkit-scrollbar once scrollbar-width/color are set,
   so the standard properties are limited to browsers without the pseudo-elements (Firefox). */
#log::-webkit-scrollbar,
#lines::-webkit-scrollbar,
.sheet .panel::-webkit-scrollbar {
  width: 6px
}

#log::-webkit-scrollbar-button,
#lines::-webkit-scrollbar-button,
.sheet .panel::-webkit-scrollbar-button {
  display: none;
  height: 0
}

#log::-webkit-scrollbar-track,
#lines::-webkit-scrollbar-track,
.sheet .panel::-webkit-scrollbar-track {
  background: transparent
}

#log::-webkit-scrollbar-thumb,
#lines::-webkit-scrollbar-thumb,
.sheet .panel::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px
}

#log:hover::-webkit-scrollbar-thumb,
#lines:hover::-webkit-scrollbar-thumb,
.sheet .panel:hover::-webkit-scrollbar-thumb {
  background: rgba(143, 29, 44, .3)
}

@supports not selector(::-webkit-scrollbar) {

  #log,
  #lines,
  .sheet .panel {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent
  }

  #log:hover,
  #lines:hover,
  .sheet .panel:hover {
    scrollbar-color: rgba(143, 29, 44, .3) transparent
  }
}

#log {
  flex: 1;
  overflow-y: auto;
  padding: 8px 2px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px
}

.msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: pop .18s ease-out
}

.bot {
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  align-self: flex-start
}

.tel {
  color: var(--maroon);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap
}

.me {
  background: var(--maroon);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end
}

.note {
  align-self: center;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  padding: 3px 10px;
  border-radius: 999px
}

@keyframes pop {
  from {
    transform: translateY(4px);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}

.typing {
  display: inline-flex;
  gap: 4px
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: b 1s infinite
}

.typing i:nth-child(2) {
  animation-delay: .15s
}

.typing i:nth-child(3) {
  animation-delay: .3s
}

@keyframes b {

  0%,
  80%,
  100% {
    opacity: .25
  }

  40% {
    opacity: 1
  }
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
  scrollbar-width: none
}

.chip {
  flex: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font: 500 13px Inter;
  cursor: pointer;
  color: var(--maroon)
}

.chip:hover {
  border-color: var(--maroon)
}

#f {
  display: flex;
  gap: 8px;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom))
}

#inp {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  font: 15px Inter;
  background: #fff;
  outline: none
}

#inp:focus {
  border-color: var(--maroon)
}

.send {
  background: var(--maroon);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font: 600 14px Inter;
  cursor: pointer
}

.send:disabled {
  opacity: .5
}

aside {
  width: 340px;
  flex: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100% - 16px);
  overflow: hidden
}

aside h2 {
  font: 20px "Lilita One";
  color: var(--maroon);
  margin: 0;
  padding: 14px 16px 6px;
  display: flex;
  align-items: center
}

aside h2 .x {
  margin-left: auto;
  display: none;
  background: none;
  border: 0;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer
}

#lines {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px
}

.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--line)
}

.line .n {
  font-weight: 600
}

.line .t {
  font-size: 12px;
  color: var(--muted)
}

.line .p {
  font-weight: 600;
  text-align: right
}

.qty {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end
}

.qty button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: var(--maroon);
  font-weight: 700
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 30px 10px
}

.tot {
  padding: 12px 16px;
  border-top: 1px solid var(--line)
}

.row {
  display: flex;
  justify-content: space-between
}

.row.big {
  font: 20px "Lilita One";
  color: var(--maroon)
}

.cta {
  width: 100%;
  margin-top: 10px;
  background: var(--maroon);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  font: 600 15px Inter;
  cursor: pointer
}

.cta:disabled {
  opacity: .4;
  cursor: default
}

.cta.loading {
  opacity: .8
}

.cta.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.flash {
  animation: fl .8s
}

@keyframes fl {
  0% {
    background: #fff3c4
  }

  100% {
    background: transparent
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: .25s;
  pointer-events: none;
  z-index: 50
}

.toast.on {
  opacity: 1;
  bottom: 100px
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(40, 10, 15, .35);
  display: none;
  z-index: 40
}

.sheet.on {
  display: block
}

.sheet .panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82%;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  padding: 12px 16px 24px
}

.sheet h3 {
  font: 18px "Lilita One";
  color: var(--maroon);
  margin: 16px 0 2px
}

.sheet .d {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px
}

.mi {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line)
}

.mi .nm {
  flex: 1
}

.mi .nm small {
  display: block;
  color: var(--muted);
  font-size: 12px
}

.sz {
  display: grid;
  grid-template-columns: repeat(2, minmax(78px, auto));
  gap: 4px;
  justify-content: end
}

.sz.one {
  grid-template-columns: auto
}

.sz button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 8px;
  font: 500 12px Inter;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap
}

.sz button b {
  font-weight: 600;
  color: var(--maroon)
}

.sz button:hover {
  border-color: var(--maroon);
  color: var(--maroon)
}

.off {
  opacity: .45
}

.order pre {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: 13px/1.5 Inter
}

/* checkout: centered popup instead of a bottom sheet */
#orderSheet .panel {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  border-radius: 18px;
  padding: 8px 20px 20px;
  box-shadow: var(--shadow);
  animation: modal-in .2s ease-out
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%)
  }
}

#orderSheet .mx {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer
}

#orderSheet .mx:hover {
  color: var(--maroon)
}

.cust .cta {
  margin-top: 4px
}

.cust label {
  display: block;
  font: 600 13px Inter;
  margin: 12px 0 4px
}

.cust label small {
  font-weight: 400;
  color: var(--muted)
}

.cust input,
.cust textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  font: 15px Inter;
  color: var(--ink);
  resize: vertical
}

.cust input:focus,
.cust textarea:focus {
  outline: none;
  border-color: var(--maroon)
}

.cust .err {
  color: var(--maroon);
  font-size: 12px;
  min-height: 16px;
  margin-top: 8px
}

.cust [aria-invalid="true"] {
  border-color: var(--maroon);
  background: #fff6f6
}

.cust .fe {
  color: var(--maroon);
  font-size: 12px;
  margin-top: 4px
}

.cust .fe:empty {
  display: none
}

.wa {
  display: block;
  text-align: center;
  background: #1f9d55;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  padding: 12px;
  font-weight: 600;
  margin-top: 8px
}

@media (max-width:820px) {
  main {
    padding: 10px 12px 0
  }

  .brand h1 {
    font-size: 18px
  }

  .hide-sm {
    display: none
  }

  .iconbtn {
    padding: 7px 10px
  }

  aside {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 78%;
    border-radius: 20px 20px 0 0;
    transform: translateY(105%);
    transition: transform .25s;
    z-index: 30
  }

  aside.open {
    transform: none
  }

  aside h2 .x {
    display: block
  }
}

@media (min-width:821px) {
  #cartBtn {
    display: none
  }
}
