<style>
    :root {
      --radius: 14px;
      --gap: 10px;
      --fs-base: 18px;
      --fs-large: 22px;
      --fs-title: 24px;
      font-family: "Noto Sans TC", sans-serif;
    }

    body {
      margin: 0;
      background: #fafafa;
      color: #111;
      font-size: var(--fs-base);
      font-family: "Noto Sans TC", sans-serif;
    }

    * { box-sizing: border-box; }

    img {
      display: block;
      max-width: 100%;
      border-radius: var(--radius);
    }

    input, select, button {
      font-size: var(--fs-base);
      font-family: "Noto Sans TC", sans-serif;
    }

    button {
      border: 1px solid #ccc;
      border-radius: 8px;
      padding: 8px 16px;
      cursor: pointer;
      background: #f3f4f6;
      transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    }

    button:hover { background: #e5e7eb; }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 8px 16px;
      border-radius: 8px;
      border: 1px solid #ccc;
      background: #f3f4f6;
      cursor: pointer;
      font-size: 16px;
      line-height: 1.2;
      color: #111;
      text-decoration: none;
      transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
      white-space: nowrap;
    }

    .btn:hover {
      background: #e5e7eb;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    }

    .btn-primary {
      background: #111;
      border-color: #111;
      color: #fff;
    }

    .btn-primary:hover {
      background: #222;
      border-color: #222;
    }

    .btn-ghost {
      background: #f3f4f6;
      border-color: #ddd;
      color: #111;
    }

    .btn-ghost:hover {
      background: #e5e7eb;
      border-color: #ccc;
    }

    #loginPanel {
      max-width: 420px;
      margin: 80px auto;
      background: #fff;
      padding: 24px;
      border-radius: var(--radius);
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    #loginPanel h1 {
      font-size: var(--fs-title);
      margin-bottom: 20px;
      text-align: center;
    }
    #loginPanel input {
      width: 100%;
      padding: 10px;
      border-radius: 8px;
      border: 1px solid #ccc;
      margin-bottom: 14px;
    }
    #loginPanel .actions {
      display: flex;
      gap: 10px;
      justify-content: center;
    }

    .fixed-header {
      position: sticky;
      top: 0;
      z-index: 3000;
      background: #fff;
      box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 15px;
      border-bottom: 1px solid #f1f5f9;
    }
    .topbar h1 {
      font-size: var(--fs-title);
      margin: 0;
    }
    .topbar .actions button { margin-left: 6px; }

    /* 訂購人資料卡片 */
    .customer-box {
      margin: 10px 15px 8px;
      padding: 10px 12px 12px;
      background: #f8fafc;
      border-radius: 14px;
      border: 1px solid #e5e7eb;
      box-shadow: 0 2px 4px rgba(15,23,42,0.03);
    }

    .customer-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
      padding: 2px 2px 4px;
      font-size: 0.95rem;
      font-weight: 600;
      color: #374151;
    }

    .customer-fields {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: var(--gap);
      margin-top: 8px;
    }

    .customer-fields input,
    .customer-fields select {
      padding: 6px 10px;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      background: #fff;
    }

    .customer-box.collapsed .customer-fields { display: none; }

    .filter-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 15px 10px;
      border-top: 1px solid #f3f4f6;
      border-bottom: 1px solid #ddd;
      background: #fff;
      flex-wrap: wrap;
    }

    #catSelect {
      padding: 6px 10px;
      border-radius: 6px;
      border: 1px solid #ccc;
      background: #fff;
      width: 220px;
      max-width: 40vw;
    }

    .search-group {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 280px;
      max-width: 40vw;
    }

    .search-group input {
      width: 100%;
      padding: 6px 10px;
      border-radius: 6px;
      border: 1px solid #ccc;
    }

    .search-group button {
      padding: 6px 12px;
      border-radius: 8px;
      background: #f3f4f6;
      white-space: nowrap;
    }

    .sort-select {
      margin-left: auto;
      min-width: 150px;
      padding: 6px 10px;
      border-radius: 6px;
      border: 1px solid #ccc;
      background: #fff;
    }

    .products {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
      gap: 16px;
      padding: 16px 15px 120px;
    }

    .product {
      position: relative;
      background: #fff;
      border-radius: var(--radius);
      box-shadow: 0 2px 5px rgba(0,0,0,0.1);
      padding: 10px;
      transition: box-shadow 0.2s;
      overflow: visible;
    }

    .product:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.15); }

    .product h3 {
      margin: 0 0 6px 0;
      font-size: var(--fs-large);
    }

    .product p { margin: 4px 0; }

    .product .spec {
      font-size: 0.9em;
      color: #555;
      line-height: 1.4;
    }

    .price {
      color: #c00;
      font-weight: 700;
    }

    .product-img-wrap {
      position: relative;
      display: inline-block;
      margin-bottom: 6px;
    }

    .product-img-wrap img {
      display: block;
      width: 100%;
      transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
      transform-origin: center center;
      z-index: 1;
      position: relative;
    }

    @media (hover: hover) and (pointer: fine) {
      .product-img-wrap:hover img {
        transform: scale(2);
        z-index: 50;
        box-shadow: 0 8px 24px rgba(0,0,0,0.35);
      }
    }

    .product-img-wrap img.zoomed {
      transform: scale(2);
      z-index: 50;
      box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    }

    .qty-controls {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 6px;
    }

    .qty-controls input {
      width: 50px;
      text-align: center;
      border: none;
      background: transparent;
    }

    .pager {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 6px;
      padding: 20px 0 100px;
      flex-wrap: wrap;
      font-size: 14px;
      color: #555;
    }

    .pager button {
      min-width: 40px;
      padding: 6px 10px;
      border-radius: 6px;
      background: #fff;
    }

    .pager button.active {
      background: #ff5a1f;
      color: #fff;
      font-weight: 700;
      border-color: #ff5a1f;
    }

    .pager button[disabled] { opacity: 0.4; cursor: default; }

    .pager span.ellipsis {
      padding: 4px 6px;
      color: #999;
      user-select: none;
      min-width: 16px;
      text-align: center;
    }

    .footer-bar {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: #fff;
      border-top: 1px solid #ccc;
      padding: 10px 15px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      z-index: 4000;
    }

    .modal {
      position: fixed;
      inset: 0;
      display: none;
      justify-content: center;
      align-items: center;
      background: rgba(0,0,0,0.65);
      z-index: 9999;
      padding: 16px;
      backdrop-filter: blur(3px);
    }

    .modal.active { display: flex; }

    .modal-box {
      background: #fff;
      border-radius: 14px;
      padding: 20px;
      width: 100%;
      max-width: 720px;
      max-height: 85vh;
      overflow: auto;
      box-shadow: 0 10px 30px rgba(0,0,0,0.25);
      color: #111;
    }

    #orderList table {
      width: 100%;
      border-collapse: collapse;
      font-size: 16px;
    }
    #orderList th,
    #orderList td {
      white-space: nowrap;
      padding: 10px 14px;
      border-bottom: 1px solid #eee;
      text-align: left;
      vertical-align: middle;
    }
    #orderList th {
      background: #fafafa;
      font-weight: 700;
      position: sticky;
      top: 0;
      z-index: 1;
    }

    @media (max-width: 768px) {
      .customer-header { font-size: 0.9rem; }
      .customer-box { margin: 8px 10px 6px; padding: 8px 8px 10px; }
      .topbar h1 { font-size: 18px; }
      #catSelect,
      .search-group {
        width: 45%;
        max-width: none;
      }
      .sort-select {
        margin-left: 0;
        width: 100%;
      }
    }

    .error-text {
      color: #dc2626;
      font-size: 0.9em;
      margin-top: 6px;
    }
  </style>
