/* CSS Variables matching the theme */
    :root {
      --header-bg: #0F3830;                       /* the shop's dark accent colour (selected items, buttons) */
      --header-text: #ffffff;
      --hdr-bg: #FFFFFF;                          /* the header itself: white, dark text */
      --hdr-text: #111827;
      --hdr-line: #E5E7EB;
      --announcement-bg: #0B2C25;
      --accent-color: #E65A4B;
      --card-bg: #F4F4F6;
      --text-dark: #1F2937;
      --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

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

    body {
      font-family: var(--font-main);
      background-color: #FAFAFA;
      color: var(--text-dark);
    }

    /* Top Announcement Bar */
    .announcement-bar {
      background-color: var(--announcement-bg);
      color: var(--header-text);
      font-size: 12px;
      padding: 8px 24px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .announcement-bar .left-links, .announcement-bar .right-links {
      display: flex;
      gap: 15px;
    }

    .announcement-bar a {
      color: #D1D5DB;
      text-decoration: none;
      cursor: pointer;
    }

    .announcement-bar a:hover {
      color: #FFF;
    }

    /* Main Navigation Header: logo on the left, the shop name in the middle, icon buttons on the right */
    header {
      background-color: var(--hdr-bg);
      color: var(--hdr-text);
      padding: 8px 24px 0;
      border-bottom: 1px solid var(--hdr-line);
    }

    .hdr-row {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      gap: 12px;
      min-height: 64px;
    }
    .hdr-left { display: flex; align-items: center; justify-content: flex-start; min-width: 0; }
    .hdr-left img { max-height: 52px; max-width: 170px; object-fit: contain; cursor: pointer; display: block; }
    .hdr-center { display: flex; justify-content: center; min-width: 0; }
    .hdr-right { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

    /* the shop name: its size comes from the owner's setting, each letter can have its own colour */
    .logo {
      font-size: var(--brand-size, 30px);
      font-weight: 800;
      letter-spacing: -0.5px;
      line-height: 1.1;
      text-align: center;
      cursor: pointer;
      color: var(--hdr-text);
    }
    .logo span { font-size: inherit; vertical-align: baseline; }

    /* Icon buttons (emoji, no words): search, account, about, track order, wishlist, cart */
    .ic {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      border: none;
      border-radius: 50%;
      background: transparent;
      color: var(--hdr-text);
      font-size: 20px;
      line-height: 1;
      font-family: inherit;
      text-decoration: none;
      cursor: pointer;
    }
    .ic:hover, .ic:focus-visible, .ic[aria-expanded="true"] { background: rgba(128, 128, 128, 0.16); outline: none; }
    .ic.has-term::after { content: ''; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-color); }
    #customerGreeting { display: contents; }

    .ic-badge, .cart-badge {
      position: absolute;
      top: 1px;
      right: 0;
      min-width: 16px;
      height: 16px;
      padding: 0 4px;
      border-radius: 8px;
      background: var(--accent-color);
      color: white;
      font-size: 10px;
      font-weight: bold;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .ic-badge:empty { display: none; }

    /* Search: just an icon until it is clicked, then a bar opens under the header */
    .search-panel { display: none; padding: 0 0 12px; }
    .search-panel.open { display: block; }
    .search-box {
      display: flex;
      max-width: 640px;
      margin: 0 auto;
      background: #FFFFFF;
      border: 1px solid #D1D5DB;
      border-radius: 22px;
      overflow: hidden;
      padding: 2px 5px;
      color: #111827;
    }

    .search-box select {
      border: none;
      background: transparent;
      padding: 8px 12px;
      font-size: 13px;
      color: #4B5563;
      outline: none;
      cursor: pointer;
    }

    .search-box input {
      border: none;
      width: 100%;
      padding: 8px 12px;
      outline: none;
      font-size: 14px;
    }

    .search-box button {
      background: transparent;
      border: none;
      padding: 8px 12px;
      color: #4B5563;
      cursor: pointer;
    }

    /* Sub Navigation Menu */
    nav.sub-nav {
      margin-top: 0;
      border-top: 1px solid var(--hdr-line);
      padding: 12px 0;
      display: flex;
      justify-content: center;
      justify-content: safe center;
      gap: 24px;
      font-size: 13px;
      font-weight: 600;
    }

    nav.sub-nav a {
      color: var(--hdr-text);
      opacity: 0.85;
      text-decoration: none;
      text-transform: capitalize;
    }
    nav.sub-nav a:hover { opacity: 1; }

    nav.sub-nav a:hover {
      color: #FFF;
    }

    .badge-onsale {
      background: var(--accent-color);
      color: #FFF;
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 3px;
      margin-left: 4px;
    }

    /* Main Container */
    .container {
      max-width: 1280px;
      margin: 20px auto;
      padding: 0 16px;
    }

    /* Hero Grid Layout */
    .hero-grid {
      display: grid;
      grid-template-columns: 2fr 1fr 1fr;
      grid-auto-rows: 220px;
      grid-auto-flow: row dense;
      gap: 16px;
    }

    .grid-card {
      position: relative;
      border-radius: 12px;
      overflow: hidden;
      background-size: cover;
      background-position: center;
      padding: 24px;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      color: #FFFFFF;
    }

    .grid-card::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.1) 60%);
    }

    .card-content {
      position: relative;
      z-index: 1;
    }

    .card-tag {
      font-size: 11px;
      letter-spacing: 1px;
      font-weight: 700;
      margin-bottom: 6px;
      opacity: 0.9;
    }

    .card-title {
      font-size: 28px;
      font-weight: 800;
      margin-bottom: 14px;
      line-height: 1.1;
    }

    .btn-shop {
      display: inline-block;
      background: #FFFFFF;
      color: #1F2937;
      padding: 8px 18px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 700;
      text-decoration: none;
      transition: background 0.2s;
    }

    .btn-shop:hover {
      background: #E5E7EB;
    }

    .banner-large { grid-row: span 2; }

    /* Banner admin list */
    .banner-admin-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 4px;
      border-bottom: 1px solid #F3F4F6;
    }

    .banner-admin-thumb {
      width: 60px;
      height: 44px;
      object-fit: cover;
      border-radius: 6px;
      background: #F3F4F6;
      flex-shrink: 0;
    }

    .banner-status-badge {
      font-size: 11px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 10px;
    }

    .banner-status-active {
      background: #DCFCE7;
      color: #166534;
    }

    .banner-status-inactive {
      background: #F3F4F6;
      color: #6B7280;
    }

    /* --- PRODUCT GRID LAYOUT --- */
    .product-section-title {
      margin-top: 40px;
      margin-bottom: 20px;
      font-size: 22px;
      font-weight: 700;
      letter-spacing: -0.5px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .product-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 20px;
      margin-bottom: 40px;
      min-height: 100px;
    }

    .product-card {
      display: flex;
      flex-direction: column;
      cursor: pointer;
    }

    .product-image-box {
      position: relative;
      width: 100%;
      padding-top: 100%; /* 1:1 Aspect Ratio Square Box */
      background-color: #F3F4F6;
      border-radius: 4px;
      overflow: hidden;
      margin-bottom: 12px;
    }

    .product-image-box img {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.3s ease;
    }

    .product-card:hover .product-image-box img {
      transform: scale(1.04);
    }

    .product-badge {
      position: absolute;
      bottom: 12px;
      left: 12px;
      font-size: 11px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 12px;
      z-index: 2;
    }

    .badge-soldout {
      background-color: #1F2937;
      color: #FFFFFF;
    }

    .badge-sale {
      background-color: #2563EB;
      color: #FFFFFF;
    }

    .product-info {
      font-size: 13px;
    }

    .product-name {
      color: #374151;
      font-weight: 500;
      margin-bottom: 6px;
    }

    .product-price-box {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
    }

    .original-price {
      text-decoration: line-through;
      color: #9CA3AF;
    }

    .current-price {
      color: #1F2937;
      font-weight: 600;
    }

    .empty-state {
      grid-column: 1 / -1;
      text-align: center;
      color: #9CA3AF;
      font-size: 14px;
      padding: 40px 0;
    }

    /* --- MODAL (shared by Settings + Admin) --- */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 999;
      justify-content: center;
      align-items: center;
      padding: 20px;
    }

    .modal-card {
      background: #FFFFFF;
      width: 90%;
      max-width: 450px;
      border-radius: 12px;
      padding: 24px;
      box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    }

    .admin-modal-card {
      max-width: 560px;
      max-height: 85vh;
      overflow-y: auto;
    }

    .settings-tabs {
      display: flex;
      gap: 4px;
      border-bottom: 1px solid #E5E7EB;
      margin-bottom: 20px;
    }

    .tab-btn {
      background: transparent;
      border: none;
      padding: 10px 4px;
      margin-right: 20px;
      font-size: 13px;
      font-weight: 600;
      color: #9CA3AF;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      margin-bottom: -1px;
    }

    .tab-btn.active {
      color: var(--header-bg);
      border-bottom-color: var(--header-bg);
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
    }

    .modal-header h3 {
      font-size: 18px;
      color: #1F2937;
    }

    .close-btn {
      cursor: pointer;
      font-size: 20px;
      color: #6B7280;
    }

    .form-group {
      margin-bottom: 16px;
      flex: 1;
    }

    .form-row {
      display: flex;
      gap: 12px;
    }

    .form-group label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 6px;
      color: #374151;
    }

    .form-group input,
    .form-group select {
      width: 100%;
      padding: 10px;
      border: 1px solid #D1D5DB;
      border-radius: 6px;
      font-size: 14px;
      outline: none;
      font-family: var(--font-main);
    }

    .btn-save {
      background-color: var(--header-bg);
      color: white;
      border: none;
      padding: 10px 16px;
      border-radius: 6px;
      font-weight: bold;
      cursor: pointer;
      font-size: 14px;
    }

    .btn-save:disabled {
      opacity: 0.6;
      cursor: default;
    }

    .btn-save.full-width {
      width: 100%;
    }

    .form-actions {
      display: flex;
      gap: 10px;
      margin-top: 4px;
    }

    .btn-cancel {
      background: #F3F4F6;
      color: #374151;
      border: none;
      padding: 10px 16px;
      border-radius: 6px;
      font-weight: 600;
      cursor: pointer;
      font-size: 14px;
      flex: 1;
    }

    .form-actions .btn-save { flex: 1; }

    /* Admin product list */
    .admin-product-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 4px;
      border-bottom: 1px solid #F3F4F6;
    }

    .admin-thumb {
      width: 44px;
      height: 44px;
      object-fit: cover;
      border-radius: 6px;
      background: #F3F4F6;
      flex-shrink: 0;
    }

    .admin-row-info {
      flex: 1;
      min-width: 0;
    }

    .admin-row-name {
      font-size: 13px;
      font-weight: 600;
      color: #1F2937;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .admin-row-price {
      font-size: 12px;
      color: #6B7280;
    }

    .admin-row-actions {
      display: flex;
      gap: 6px;
      flex-shrink: 0;
    }

    .btn-icon {
      background: #F3F4F6;
      border: none;
      width: 30px;
      height: 30px;
      border-radius: 6px;
      cursor: pointer;
      color: #374151;
      font-size: 13px;
    }

    .btn-icon:hover {
      background: #E5E7EB;
    }

    .btn-icon-danger:hover {
      background: #FEE2E2;
      color: #DC2626;
    }

    /* Add-to-cart button on product cards */
    .add-to-cart-btn {
      position: absolute;
      top: 10px;
      right: 10px;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: #FFFFFF;
      border: none;
      color: var(--header-bg);
      font-size: 13px;
      cursor: pointer;
      z-index: 3;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }

    .add-to-cart-btn:hover {
      background: var(--header-bg);
      color: #FFFFFF;
    }

    .add-to-cart-btn:disabled {
      background: #E5E7EB;
      color: #9CA3AF;
      cursor: not-allowed;
    }

    .notify-btn {
      background: #25D366;
      color: #FFFFFF;
    }

    .notify-btn:hover {
      background: #1DA851;
      color: #FFFFFF;
    }

    /* Cart modal */
    .cart-modal-card {
      max-width: 480px;
      max-height: 85vh;
      overflow-y: auto;
    }

    .cart-item-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 4px;
      border-bottom: 1px solid #F3F4F6;
    }

    .cart-thumb {
      width: 52px;
      height: 52px;
      object-fit: cover;
      border-radius: 6px;
      background: #F3F4F6;
      flex-shrink: 0;
    }

    .cart-row-info {
      flex: 1;
      min-width: 0;
    }

    .cart-row-name {
      font-size: 13px;
      font-weight: 600;
      color: #1F2937;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .cart-row-price {
      font-size: 12px;
      color: #6B7280;
    }

    .qty-stepper {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }

    .qty-stepper button {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 1px solid #D1D5DB;
      background: #FFFFFF;
      cursor: pointer;
      font-size: 12px;
      color: #374151;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .qty-stepper span {
      font-size: 13px;
      font-weight: 600;
      min-width: 16px;
      text-align: center;
    }

    .cart-remove-btn {
      background: none;
      border: none;
      color: #9CA3AF;
      cursor: pointer;
      font-size: 13px;
      flex-shrink: 0;
      margin-left: 4px;
    }

    .cart-remove-btn:hover {
      color: #DC2626;
    }

    .cart-summary-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 4px 4px;
      font-size: 14px;
      font-weight: 700;
      color: #1F2937;
    }

    .order-line-item {
      display: flex;
      justify-content: space-between;
      font-size: 13px;
      color: #374151;
      padding: 6px 0;
    }

    .payment-method-box {
      display: flex;
      align-items: center;
      gap: 10px;
      background: #F0FDF4;
      border: 1px solid #BBF7D0;
      border-radius: 8px;
      padding: 12px;
      margin-bottom: 16px;
      font-size: 13px;
      color: #166534;
      font-weight: 600;
    }

    .payment-method-box i {
      font-size: 16px;
    }

    .btn-whatsapp {
      background-color: #25D366;
      color: #FFFFFF;
      border: none;
      padding: 10px 16px;
      border-radius: 6px;
      font-weight: bold;
      cursor: pointer;
      font-size: 14px;
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .btn-whatsapp:disabled {
      opacity: 0.6;
      cursor: default;
    }

    .order-success {
      text-align: center;
      padding: 20px 4px;
    }

    .order-success i {
      font-size: 40px;
      color: #25D366;
      margin-bottom: 12px;
    }

    .order-success h4 {
      font-size: 16px;
      color: #1F2937;
      margin-bottom: 8px;
    }

    .order-success p {
      font-size: 13px;
      color: #6B7280;
      margin-bottom: 20px;
      line-height: 1.5;
    }

    /* Orders admin list */
    .order-card {
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      padding: 12px;
      margin-bottom: 10px;
    }

    .order-card-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 8px;
    }

    .order-card-id {
      font-size: 12px;
      font-weight: 700;
      color: #1F2937;
    }

    .order-card-date {
      font-size: 11px;
      color: #9CA3AF;
    }

    .order-card-customer {
      font-size: 12px;
      color: #374151;
      line-height: 1.5;
      margin-bottom: 8px;
    }

    .order-card-items {
      font-size: 12px;
      color: #6B7280;
      border-top: 1px dashed #E5E7EB;
      padding-top: 8px;
      margin-top: 4px;
    }

    /* Responsive adjustments */
    @media (max-width: 900px) {
      .announcement-bar .left-links, .user-text {
        display: none;
      }
      .sub-nav {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }
      .sub-nav::-webkit-scrollbar { display: none; }
      .sub-nav a { flex-shrink: 0; }
      .hero-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
      .banner-large { grid-row: span 1; height: 350px; }
      .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
      .form-row { flex-direction: column; gap: 0; }
    }

    /* Phone-specific fixes */
    @media (max-width: 640px) {
      body { overflow-x: hidden; }

      /* Header on a phone: the logo and the icons share the first row, the shop name sits centred under them */
      header { padding: 6px 14px 0; }
      .hdr-row {
        grid-template-columns: auto 1fr;
        grid-template-areas: "left right" "center center";
        min-height: 0;
        row-gap: 0;
      }
      .hdr-left { grid-area: left; }
      .hdr-right { grid-area: right; }
      .hdr-center { grid-area: center; padding: 0 0 8px; }
      .logo { font-size: min(var(--brand-size, 30px), 11vw); }
      .hdr-left img { max-height: 40px; max-width: 120px; }
      .search-box select, .search-box input { min-width: 0; }

      /* iOS Safari auto-zooms on any input under 16px on focus — bump these
         to 16px so tapping a field doesn't unexpectedly zoom the page */
      .search-box input,
      .form-group input,
      .form-group select {
        font-size: 16px;
      }

      /* Settings modal: 4 tabs don't fit a phone-width modal — let them
         scroll horizontally instead of silently overflowing/breaking layout */
      .settings-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }
      .settings-tabs::-webkit-scrollbar { display: none; }
      .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
      }

      /* Bigger touch targets on small icon controls */
      .qty-stepper button {
        width: 32px;
        height: 32px;
      }
      .add-to-cart-btn {
        width: 36px;
        height: 36px;
      }
      .btn-icon {
        width: 34px;
        height: 34px;
      }

      /* Modals: use more of the viewport width on phones */
      .modal-overlay { padding: 12px; }
      .modal-card { padding: 20px; }
    }