:root {
      color-scheme: light;
      --bg: #f6f3ec;
      --surface: #ffffff;
      --surface-soft: #fff9ed;
      --text: #1e2a26;
      --muted: #6b756f;
      --line: #ddd6c9;
      --primary: #12715b;
      --primary-dark: #0d5948;
      --accent: #d9472b;
      --accent-soft: #ffe4dc;
      --shadow: 0 10px 28px rgba(39, 48, 42, 0.09);
      --radius: 8px;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background: var(--bg);
      color: var(--text);
    }

    body.modal-open {
      overflow: hidden;
    }

    button,
    input {
      font: inherit;
    }

    button {
      border: 0;
      cursor: pointer;
    }

    .app {
      width: min(100%, 880px);
      margin: 0 auto;
      padding-bottom: 108px;
    }

    .topbar {
      position: sticky;
      top: 0;
      z-index: 10;
      background: rgba(246, 243, 236, 0.96);
      border-bottom: 1px solid var(--line);
      backdrop-filter: blur(12px);
    }

    .topbar-inner {
      padding: 16px;
    }

    .brand {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .brand h1 {
      margin: 0;
      font-size: 1.35rem;
      line-height: 1.15;
      letter-spacing: 0;
    }

    .brand p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 0.92rem;
    }

    .cart-pill {
      min-width: 58px;
      min-height: 42px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      padding: 0 13px;
      border-radius: 999px;
      background: var(--primary);
      color: #fff;
      font-weight: 800;
      box-shadow: var(--shadow);
    }

    .cart-icon {
      width: 22px;
      height: 22px;
      fill: none;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .controls {
      display: grid;
      gap: 10px;
      margin-top: 14px;
    }

    .search {
      width: 100%;
      min-height: 46px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 0 14px;
      background: var(--surface);
      color: var(--text);
    }

    .category-row {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding-bottom: 2px;
      scrollbar-width: none;
    }

    .category-row::-webkit-scrollbar {
      display: none;
    }

    .chip {
      flex: 0 0 auto;
      min-height: 40px;
      padding: 0 14px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: var(--surface);
      color: var(--text);
      font-weight: 700;
    }

    .chip.active {
      background: var(--primary);
      border-color: var(--primary);
      color: #fff;
    }

    .status {
      margin: 14px 16px 0;
      padding: 10px 12px;
      border-radius: var(--radius);
      border: 1px solid var(--line);
      background: var(--surface-soft);
      color: var(--muted);
      font-size: 0.9rem;
    }

    .products {
      display: grid;
      gap: 12px;
      padding: 16px;
    }

    .product-card {
      display: grid;
      grid-template-columns: 1fr;
      gap: 12px;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: var(--surface);
      box-shadow: var(--shadow);
    }

    .product-main {
      display: flex;
      justify-content: space-between;
      gap: 12px;
    }

    .product-name {
      margin: 0;
      font-size: 1.05rem;
      line-height: 1.25;
    }

    .product-category {
      display: inline-block;
      margin-top: 6px;
      color: var(--muted);
      font-size: 0.86rem;
    }

    .price {
      flex: 0 0 auto;
      text-align: right;
      color: var(--primary-dark);
      font-weight: 850;
      line-height: 1.25;
    }

    .price small {
      display: block;
      color: var(--muted);
      font-weight: 650;
    }

    .buy-row {
      display: grid;
      grid-template-columns: minmax(104px, 132px) 1fr;
      gap: 10px;
    }

    .qty-input {
      width: 100%;
      min-height: 46px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 0 10px;
      background: #fff;
      color: var(--text);
      font-weight: 750;
    }

    .add-btn,
    .wa-btn,
    .copy-btn,
    .clear-btn {
      min-height: 46px;
      border-radius: var(--radius);
      font-weight: 850;
    }

    .add-btn {
      background: var(--primary);
      color: #fff;
    }

    .add-btn:active,
    .wa-btn:active,
    .copy-btn:active,
    .clear-btn:active,
    .chip:active {
      transform: translateY(1px);
    }

    .empty {
      padding: 30px 16px;
      color: var(--muted);
      text-align: center;
    }

    .cart-modal {
      position: fixed;
      inset: 0;
      z-index: 40;
      display: grid;
      align-items: end;
      padding: 16px;
      pointer-events: none;
      visibility: hidden;
    }

    .cart-modal.is-open {
      pointer-events: auto;
      visibility: visible;
    }

    .cart-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(24, 31, 28, 0.48);
      opacity: 0;
      transition: opacity 160ms ease;
    }

    .cart-modal.is-open .cart-backdrop {
      opacity: 1;
    }

    .cart-box {
      position: relative;
      z-index: 1;
      width: min(100%, 520px);
      max-height: min(82vh, 720px);
      overflow: auto;
      margin: 0 auto;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: var(--surface);
      box-shadow: var(--shadow);
      transform: translateY(24px);
      transition: transform 160ms ease;
    }

    .cart-modal.is-open .cart-box {
      transform: translateY(0);
    }

    .cart-header {
      position: sticky;
      top: 0;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 0px -14px 30px;
      padding: 14px;
      border-bottom: 1px solid var(--line);
      background: var(--surface);
      background-color: rgba(197, 197, 197, 0.2);
      backdrop-filter: blur(2px);
    }

    .cart-box h2 {
      margin: 0;
      font-size: 1.15rem;
      letter-spacing: 0;
    }

    .close-btn {
      width: 42px;
      height: 42px;
      border-radius: var(--radius);
      background: #efe7d9;
      color: var(--text);
      font-size: 1.2rem;
      font-weight: 900;
    }

    .cart-items {
      display: grid;
      gap: 10px;
    }

    .cart-item {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      align-items: center;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--line);
    }

    .cart-item:last-child {
      border-bottom: 0;
      padding-bottom: 0;
    }

    .cart-item strong {
      display: block;
      line-height: 1.25;
    }

    .cart-item span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .cart-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .mini-input {
      width: 74px;
      min-height: 40px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 0 8px;
      font-weight: 750;
    }

    .remove-btn {
      width: 40px;
      height: 40px;
      border-radius: var(--radius);
      background: var(--accent-soft);
      color: var(--accent);
      font-size: 1.2rem;
      font-weight: 900;
    }

    .summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-top: 14px;
      padding-top: 14px;
      border-top: 1px solid var(--line);
      font-size: 1.05rem;
      font-weight: 900;
    }

    .message-box {
      width: 100%;
      min-height: 154px;
      margin-top: 14px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #fffdf7;
      color: var(--text);
      white-space: pre-wrap;
      line-height: 1.5;
    }

    .action-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 12px;
    }

    .wa-btn {
      display: grid;
      place-items: center;
      text-decoration: none;
      background: #1d9b5f;
      color: #fff;
    }

    .copy-btn {
      background: var(--primary-dark);
      color: #fff;
    }

    .clear-btn {
      margin-top: 10px;
      width: 100%;
      background: #efe7d9;
      color: var(--text);
    }

    .bottom-total {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 20;
      border-top: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.97);
      backdrop-filter: blur(12px);
    }

    .bottom-inner {
      width: min(100%, 880px);
      min-height: 76px;
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: center;
      gap: 12px;
      margin: 0 auto;
      padding: 12px 16px;
    }

    .bottom-inner small {
      display: block;
      color: var(--muted);
      font-weight: 700;
    }

    .bottom-inner strong {
      display: block;
      margin-top: 2px;
      font-size: 1.08rem;
    }

    .jump-cart {
      min-height: 46px;
      padding: 0 16px;
      border-radius: var(--radius);
      background: var(--primary);
      color: #fff;
      font-weight: 850;
    }

    @media (min-width: 680px) {
      .topbar-inner,
      .products {
        padding-left: 24px;
        padding-right: 24px;
      }

      .cart-modal {
        align-items: center;
      }

      .products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .product-card {
        align-content: space-between;
      }
    }
