/* Lista de Compras — redesign visual responsivo
   Somente CSS: HTML e JavaScript originais permanecem inalterados. */

:root {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #121d2e;
  --surface-soft: #19283b;
  --surface-hover: #22364c;
  --line: #2b4057;
  --text: #f1f5f9;
  --muted: #9aadc2;
  --primary: #35c99a;
  --primary-hover: #25ad82;
  --accent: #4ea5ff;
  --danger: #ff647c;
  --radius: 18px;
  --shadow: 0 18px 45px rgb(0 0 0 / 24%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  width: min(100% - 32px, 920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

button:hover {
  background: var(--surface-hover);
  border-color: var(--line);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(78 165 255 / 45%);
  outline-offset: 2px;
}

img {
  display: block;
  width: 48px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(
      ellipse at top right,
      rgb(53 201 154 / 13%),
      transparent 50%
    ),
    var(--surface);
  box-shadow: var(--shadow);
}

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.top > span {
  display: none;
}

.top button {
  order: 0;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 25px;
}

.top h2 {
  flex: 1;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.top img {
  width: 46px;
  max-height: 46px;
}

.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opts button {
  flex: 1 1 145px;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 650;
}

.opts button:first-child,
.inps button {
  background: var(--primary);
  color: #06271e;
}

.opts button:first-child:hover,
.inps button:hover {
  background: var(--primary-hover);
}

.mid {
  width: 100%;
}

.mid ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: rgb(5 12 22 / 25%);
}

.mid ul li {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 13px 8px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.mid ul li + li {
  border-left: 1px solid var(--line);
}

.mid ul li span:last-child {
  color: var(--text);
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.inps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 110px 48px;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

input {
  min-width: 0;
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0b1524;
  color: var(--text);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

input::placeholder {
  color: #7f93aa;
  opacity: 1;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(78 165 255 / 12%);
  outline: none;
}

#item {
  width: 100%;
  margin: 0;
}

#qtde,
#valor {
  width: 100%;
}

#qtde::-webkit-outer-spin-button,
#qtde::-webkit-inner-spin-button,
#limitMoney::-webkit-outer-spin-button,
#limitMoney::-webkit-inner-spin-button,
#valor::-webkit-outer-spin-button,
#valor::-webkit-inner-spin-button {
  appearance: none;
  display: none;
}

.inps button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 13px;
  font-size: 27px;
}

#tituloLC {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin: 2px 0 -6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

#tituloLC span {
  margin: 0;
  color: var(--primary);
  font-size: 22px;
}

.box {
  width: 100%;
  height: clamp(240px, 48vh, 540px);
  min-height: 240px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.box ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 2px;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.box ul::-webkit-scrollbar {
  width: 7px;
}

.box ul::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: var(--line);
}

.box ul li {
  display: grid;
  grid-template-columns:
    minmax(0, 1.3fr) minmax(95px, 0.9fr) minmax(80px, 0.8fr)
    38px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.box ul li span {
  width: auto;
  min-width: 0;
  padding: 4px 7px;
  text-align: left;
}

.box ul li span:nth-child(1) {
  width: auto;
  text-align: left;
  font-weight: 650;
}

.box ul li span:nth-child(2) {
  width: auto;
  border-right: 0;
  border-left: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.box ul li span:nth-child(3) {
  width: auto;
  text-align: right;
  font-weight: 750;
  color: var(--primary);
}

.box button {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgb(255 100 124 / 25%);
  border-radius: 10px;
  background: rgb(255 100 124 / 10%);
  color: var(--danger);
  font-size: 20px;
}

.box button:hover {
  background: rgb(255 100 124 / 20%);
}

footer {
  padding: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}

footer b {
  color: var(--primary);
  font-weight: 650;
}

.msgBox,
.msgBoxName {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  min-height: 180px;
  height: auto;
  padding: 24px;
  transform: translate(-50%, -50%);
  border: 1px solid #3d5a72;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgb(0 0 0 / 55%);
}

.msgBox h3,
.msgBoxName h3 {
  font-size: 1.1rem;
  line-height: 1.35;
}

.msgBox input,
.msgBoxName input {
  margin: 0;
  border-color: var(--line);
}

.msgBox button,
.msgBoxName button {
  align-self: flex-end;
  width: 48px;
  min-height: 42px;
  margin: 0;
  background: var(--primary);
  color: #06271e;
}

@media (max-width: 620px) {
  body {
    width: min(100% - 20px, 480px);
    padding: 10px 0 18px;
    gap: 10px;
  }

  header {
    gap: 12px;
    padding: 15px;
    border-radius: 18px;
  }

  .top {
    gap: 10px;
  }

  .top button {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .top img {
    width: 38px;
    max-height: 38px;
  }

  .opts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .opts button {
    min-width: 0;
    padding: 9px 7px;
    font-size: 0.8rem;
  }

  .mid ul li {
    padding: 10px 4px;
    font-size: 0.7rem;
  }

  .inps {
    grid-template-columns: minmax(0, 1fr) 68px 88px 42px;
    gap: 6px;
    padding: 10px;
    border-radius: 15px;
  }

  .inps input {
    padding: 9px 7px;
    font-size: 0.9rem;
  }

  .inps button {
    width: 40px;
    height: 43px;
    font-size: 23px;
  }

  #tituloLC {
    gap: 8px;
    padding: 12px 8px;
    font-size: 0.98rem;
  }

  #tituloLC span {
    font-size: 19px;
  }

  .box {
    height: 52vh;
    min-height: 220px;
    padding: 6px;
  }

  .box ul li {
    grid-template-columns: minmax(0, 1fr) 72px 78px 34px;
    gap: 3px;
    padding: 7px 5px;
    font-size: 0.8rem;
  }

  .box ul li span {
    padding: 4px 3px;
  }

  .box ul li span:nth-child(2) {
    font-size: 0.72rem;
  }

  .box ul li span:nth-child(3) {
    font-size: 0.78rem;
  }

  .box button {
    width: 32px;
    min-width: 32px;
    height: 34px;
    font-size: 18px;
  }
}

@media (max-width: 370px) {
  body {
    width: calc(100% - 14px);
  }

  .top h2 {
    font-size: 1.08rem;
  }

  .top img {
    width: 32px;
  }

  .mid ul li {
    font-size: 0.65rem;
  }

  .inps {
    grid-template-columns: minmax(0, 1fr) 55px 72px 36px;
    gap: 4px;
    padding: 7px;
  }

  .inps input {
    padding: 8px 5px;
    font-size: 0.82rem;
  }

  .inps button {
    width: 35px;
    height: 40px;
  }

  .box ul li {
    grid-template-columns: minmax(0, 1fr) 58px 68px 30px;
    font-size: 0.73rem;
  }

  .box ul li span:nth-child(2) {
    font-size: 0.66rem;
  }

  .box ul li span:nth-child(3) {
    font-size: 0.7rem;
  }

  .box button {
    width: 28px;
    min-width: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --surface-soft: #fff;
    --line: #ddd;
    --text: #111;
    --muted: #555;
  }

  body {
    width: 100%;
    padding: 0;
    background: #fff;
    color: #111;
  }

  header,
  .inps,
  #tituloLC,
  .box {
    box-shadow: none;
  }

  .opts,
  .inps,
  .top button,
  .box button,
  footer {
    display: none !important;
  }

  .box {
    height: auto;
    overflow: visible;
  }

  .box ul {
    overflow: visible;
  }

  .box ul li {
    break-inside: avoid;
    background: #fff;
    color: #111;
  }
}

.some {
  display: none;
}
